1
0
Fork 0
forked from len0rd/rockbox

handle interface-specific control requests a bit more cleanly

git-svn-id: svn://svn.rockbox.org/rockbox/trunk@16519 a1c6a512-1295-4272-9138-f99709370657
This commit is contained in:
Frank Gevaerts 2008-03-04 19:32:23 +00:00
parent c8d2a2458d
commit 1e6d550087

View file

@ -647,16 +647,28 @@ static void usb_core_control_request_handler(struct usb_ctrlrequest* req)
break; break;
} /* USB_REQ_GET_DESCRIPTOR */ } /* USB_REQ_GET_DESCRIPTOR */
default: default: {
bool handled=false;
if((req->bRequestType & 0x1f) == 1) /* Interface */
{
#ifdef USB_STORAGE #ifdef USB_STORAGE
/* does usb_storage know this request? */ /* does usb_storage know this request? */
if (!usb_storage_control_request(req)) if(req->wIndex == mass_storage_interface_descriptor.bInterfaceNumber)
{
handled = usb_storage_control_request(req);
}
#endif #endif
#ifdef USB_SERIAL #ifdef USB_SERIAL
/* does usb_serial know this request? */ /* does usb_serial know this request? */
if (!usb_serial_control_request(req)) if(req->wIndex == serial_interface_descriptor.bInterfaceNumber)
{
handled = usb_serial_control_request(req);
}
#endif #endif
}
if(!handled)
{ {
/* nope. flag error */ /* nope. flag error */
logf("usb bad req %d", req->bRequest); logf("usb bad req %d", req->bRequest);
@ -664,6 +676,7 @@ static void usb_core_control_request_handler(struct usb_ctrlrequest* req)
ack_control(req); ack_control(req);
} }
break; break;
}
} }
logf("control handled"); logf("control handled");
} }