Index: umsboot/src/protocol/usb/usb.c |
— | — | @@ -277,50 +277,50 @@ |
278 | 278 | default: break; |
279 | 279 | } |
280 | 280 | break; |
281 | | - default: break; |
| 281 | + default: break; |
282 | 282 | } |
283 | 283 | 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) |
285 | 296 | { |
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) |
295 | 299 | { |
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; |
318 | 306 | 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; |
320 | 318 | } |
321 | 319 | break; |
| 320 | + default: break; |
322 | 321 | } |
323 | | - default: break; |
| 322 | + break; |
324 | 323 | } |
| 324 | + default: break; |
325 | 325 | } |
326 | 326 | union usb_endpoint_number ep0in = { .number = 0, .direction = USB_ENDPOINT_DIRECTION_IN }; |
327 | 327 | union usb_endpoint_number ep0out = { .number = 0, .direction = USB_ENDPOINT_DIRECTION_OUT }; |