This is the bug/patch tracker for Rockbox. Click here for more information.
Quick links: Bugs · Patches · Rockbox frontpage
FS#7962 - USB device code for sansa
Attached to Project:
Rockbox
Opened by Björn Stenberg (zagor) - Monday, 15 October 2007, 13:49 GMT+2
Last edited by Björn Stenberg (zagor) - Friday, 23 November 2007, 22:48 GMT+2
Opened by Björn Stenberg (zagor) - Monday, 15 October 2007, 13:49 GMT+2
Last edited by Björn Stenberg (zagor) - Friday, 23 November 2007, 22:48 GMT+2
|
DetailsCurrent state of my USB implementation. Configuration/enumeration/setup works, but the bulk input (OUT) endpoint doesn't trigger any interrupt so the usb-storage commands are not received.
|
This task depends upon
Closed by Björn Stenberg (zagor)
Friday, 23 November 2007, 22:48 GMT+2
Reason for closing: Accepted
Additional comments about closing: Committed to SVN
Friday, 23 November 2007, 22:48 GMT+2
Reason for closing: Accepted
Additional comments about closing: Committed to SVN
Something that looks suspicious is the endpoint number assignment, you use endpoint number 1 for both the bulk in and the bulk out endpoints, with the two endpoints only distinguished by the direction bit. The USB2.0 spec is a bit vague on whether this is supported, but I can't remember ever seeing something like this being used in other USB devices. Better would be endpoint addresses 0x01 for OUT and 0x82 for IN.
Also nothing seem to happen yet on reception of a USB_REQ_SET_CONFIGURATION request. I think this is a good place to enable/configure the endpoints.
Example from Linux driver (fsl_ep_enable / dr_ep_setup):
http://lxr.linux.no/source/drivers/usb/gadget/fsl_usb2_udc.c#L448
http://lxr.linux.no/source/drivers/usb/gadget/fsl_usb2_udc.c#L318
SET_CONFIGURATION is not looked at (only ACKed immediately) because the device only has one configuration, which is already active. If we add more configurations, SET_CONFIGURATION will do more.
The problem I'm fighting currently is that my CSWs (command status wrappers, sort of ACKs for usb-storage) don't come out on the bus the way I send them to the driver. The first CSW is all zeroes, and subsequent ones have a too old cbw tag! See http://bjorn.haxx.se/usbmon.txt.
It's almost as if old CSWs are being buffered in the driver and sent later. Yet the driver only uses a single transmit buffer, which inbetween the failed CSWs is also used for sucessfully sending the data-in portions (the INQUIRY struct). So that's a bit of a mystery at this point.
The purpose of my effort is to try and implement USB with simple straight-forward code that is easy to understand and easy to debug.