On Wed, 13 Dec 2006, Garrett D'Amore wrote:

> I've done some more debugging.  I've not had success in getting a debug
> kernel built that will boot my system (Ubuntu) yet, and I don't know why
> _that_ is a problem, but it takes ~4 hours per attempt (compiling Linux
> is _slow_ on this Via 1GHz system), so I took a different tack.

You know, you don't need to recompile an entire kernel from scratch every 
time you make one little change.  Don't do "make clean" in between; the 
kernel build system will then recompile only the files that need it.  
Building a kernel the first time might take a long while, but making small 
changes should take only a minute or two.

> I started using the ioctls directly, and specifically the USBDEVFS_BULK
> ioctl.  I _think_ the Linux framework is dropping bulk-in packets.  More
> below:
> 
> This is for a mass storage device.
> 
> The results I'm seeing look like:
> 
> Bulk-Write 31 bytes (CBW)
>     dCBWDataTransferLength = 36
>     bmCBWFlags = 0x80 (transfer from device to host)
>     bCBWLUN = 0
>     bCBWCBLength = 06
>     CBWCB = 21 data bytes

I hope you mean 16 here, not 21.  If the CBWCB were 21 bytes then the 
total length of the CBW packet would be 36 bytes instead of 31.  Not to 
mention that you would greatly confuse the mass-storage device.

> Bulk-Read, requested 36 data bytes (expected SCSI data), did not arrive
> 
> instead
> 
> Bulk-Read, got 13 data bytes (instead of 36), corresponding to CSW
>     - all values other than dCSWSignature are 0
> 
> So instead of getting my 36 byte data packet, followed by the 13 byte
> CSW, I instead just get the 13 byte CSW. 
> 
> I _think_ that the first 36 byte bulk-in packet is getting
> dropped/overwritten by the second bulk-in packet.

You don't have to guess about these things.  Use usbmon; that's what it's 
for (instructions in Documentation/usb/usbmon.txt).

>   Is this normal,
> expected behavior?

Of course not.

>  Do I need to just spawn a reaper thread that hangs
> around picking up bulk-in packets and puts them in a userland queue?

No.

>  I
> had heretofore assumed that I could just do the bulk ioctls (I've seen
> similar behavior using libusb, which uses submiturb and reapurbndelay)
> and pick up the data when I'm ready for it.  Am I misunderstanding
> something?

No, your understanding is correct.

Alan Stern


-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys - and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
linux-usb-devel@lists.sourceforge.net
To unsubscribe, use the last form field at:
https://lists.sourceforge.net/lists/listinfo/linux-usb-devel

Reply via email to