freemyipod r952 - Code Review

Jump to: navigation, search
Repository:freemyipod
Revision:r951‎ | r952 | r953 >
Date:12:59, 16 June 2014
Author:theseven
Status:new
Tags:
Comment:
UMSboot: Backport upstream USB driver fixes
Modified paths:
  • /umsboot/src/protocol/usb/usb.c (modified) (history)

Diff [purge]

Index: umsboot/src/protocol/usb/usb.c
@@ -277,50 +277,50 @@
278278 default: break;
279279 }
280280 break;
281 - default: break;
 281+ default: break;
282282 }
283283 break;
284 - case USB_SETUP_BMREQUESTTYPE_RECIPIENT_ENDPOINT:
 284+ }
 285+ case USB_SETUP_BMREQUESTTYPE_RECIPIENT_ENDPOINT:
 286+ {
 287+ if (!data->state->current_configuration) break;
 288+ union usb_endpoint_number ep = { .byte = buffer->setup.wIndex };
 289+ int intfid;
 290+ int epid;
 291+ const struct usb_endpoint* endpoint = usb_find_endpoint(data, ep, &intfid, &epid);
 292+ if (!endpoint) break;
 293+ if (endpoint->ctrl_request) size = endpoint->ctrl_request(data, intfid, epid, buffer, &addr);
 294+ if (size != -1) break;
 295+ switch (buffer->setup.bmRequestType.type)
285296 {
286 - if (!data->state->current_configuration) break;
287 - union usb_endpoint_number ep = { .byte = buffer->setup.wIndex };
288 - int intfid;
289 - int epid;
290 - const struct usb_endpoint* endpoint = usb_find_endpoint(data, ep, &intfid, &epid);
291 - if (!endpoint) break;
292 - if (endpoint->ctrl_request) size = endpoint->ctrl_request(data, intfid, epid, buffer, &addr);
293 - if (size != -1) break;
294 - switch (buffer->setup.bmRequestType.type)
 297+ case USB_SETUP_BMREQUESTTYPE_TYPE_STANDARD:
 298+ switch (buffer->setup.bRequest.req)
295299 {
296 - case USB_SETUP_BMREQUESTTYPE_TYPE_STANDARD:
297 - switch (buffer->setup.bRequest.req)
298 - {
299 - case USB_SETUP_BREQUEST_GET_STATUS:
300 - if (buffer->setup.wLength != 2 || buffer->setup.wValue) break;
301 - data->buffer->raw[0] = 0;
302 - data->buffer->raw[1] = data->driver->get_stall(data, ep);
303 - addr = data->buffer;
304 - size = 2;
305 - break;
306 - case USB_SETUP_BREQUEST_CLEAR_FEATURE:
307 - if (buffer->setup.wLength || buffer->setup.wValue) break;
308 - usb_set_stall(data, ep, false);
309 - size = 0;
310 - break;
311 - case USB_SETUP_BREQUEST_SET_FEATURE:
312 - if (buffer->setup.wLength || buffer->setup.wValue) break;
313 - usb_set_stall(data, ep, true);
314 - size = 0;
315 - break;
316 - default: break;
317 - }
 300+ case USB_SETUP_BREQUEST_GET_STATUS:
 301+ if (buffer->setup.wLength != 2 || buffer->setup.wValue) break;
 302+ data->buffer->raw[0] = 0;
 303+ data->buffer->raw[1] = data->driver->get_stall(data, ep);
 304+ addr = data->buffer;
 305+ size = 2;
318306 break;
319 - default: break;
 307+ case USB_SETUP_BREQUEST_CLEAR_FEATURE:
 308+ if (buffer->setup.wLength || buffer->setup.wValue) break;
 309+ usb_set_stall(data, ep, false);
 310+ size = 0;
 311+ break;
 312+ case USB_SETUP_BREQUEST_SET_FEATURE:
 313+ if (buffer->setup.wLength || buffer->setup.wValue) break;
 314+ usb_set_stall(data, ep, true);
 315+ size = 0;
 316+ break;
 317+ default: break;
320318 }
321319 break;
 320+ default: break;
322321 }
323 - default: break;
 322+ break;
324323 }
 324+ default: break;
325325 }
326326 union usb_endpoint_number ep0in = { .number = 0, .direction = USB_ENDPOINT_DIRECTION_IN };
327327 union usb_endpoint_number ep0out = { .number = 0, .direction = USB_ENDPOINT_DIRECTION_OUT };