On Thu, 7 Feb 2008, Francis Moreau wrote: > I'm trying to port a custom hardware with an embedded UDC. > > It works so far but I need to pass "stall=0" option to make the mass > storage driver work with a windows XP host although the HW can stall > any endpoints in theory.
Well, either the theory is wrong or else the controller driver isn't applying it correctly. > If the host is Linux, it works without the need of stall parameter. > But I can see strange things happened even in this case: It's a little tricky to interpret this because the host- and client-side log messages are interspersed in a peculiar way... > sb-storage: Command MODE_SENSE (6 bytes) > usb-storage: 1a 00 3f 00 c0 00 > usb-storage: Bulk Command S 0x43425355 T 0x6 L 192 F 128 Trg 0 LUN 0 CL 6 > usb-storage: usb_stor_bulk_transfer_buf: xfer 31 bytes At this point the command has been sent and the gadget has queued its 20-byte response to be sent back on the bulk-IN endpoint. It tries to halt the endpoint after the data has been sent: > g_file_storage gadget: bulk-in set halt > usb-storage: Status code 0; transferred 31/31 > usb-storage: -- transfer complete > usb-storage: Bulk command transfer result=0 > usb-storage: usb_stor_bulk_transfer_sglist: xfer 192 bytes, 1 entries > usb-storage: Status code -32; transferred 0/192 Here the host did not receive the 20 bytes of data; instead it saw only the stall. > usb-storage: clearing endpoint halt for pipe 0xc0008280 > usb-storage: usb_stor_control_msg: rq=01 rqtype=02 value=0000 index=81 len=0 > usb-storage: usb_stor_clear_halt: result = 0 > usb-storage: Bulk data transfer result 0x2 > usb-storage: Attempting to get CSW... > usb-storage: usb_stor_bulk_transfer_buf: xfer 13 bytes > usb-storage: Status code -75; transferred 0/13 > usb-storage: -- babble At this point it appears that the host received the 20 bytes of bulk-in data, at a time when it was expecting to receive only 13 bytes. > usb-storage: Bulk status result = 3 > usb-storage: -- transport indicates error, resetting > usb-storage: storage_pre_reset > > Linux host tries this sequence a couple of time with reseting the > device between each try and eventually the device work. Yes, Linux was able to recover from the errors. But the stalls still didn't work right. The pending bulk-IN data should be completely sent before the endpoint is halted. > Does this parameter exist for other class ? IOW can other classes > stall bulk endpoint or is it really mass storage class specific ? I don't know of any other classes that need to stall bulk endpoints. Alan Stern - To unsubscribe from this list: send the line "unsubscribe linux-usb" in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html
