On Sun, 21 Aug 2005, Peter Urbanec wrote: > Hi everyone, > > I have a user space application that uses USBDEVFS_BULK ioctl() to > communicate with a device. The USB implementation on this device appears > to be "fragile". From what I can see, the device stops responding when > it receives a data packet with (size % 512) == 0.
You probably mean a message (not a packet) with length divisible by 512. On a high-speed USB connection, whenever a bulk message is longer than 512 bytes it will be divided into packets, where each packet before the last one contains 512 bytes. You seem to be saying that the device doesn't work right when the last packet also contains 512 bytes. > The behaviour appears > to be consistent with the device not noticing that the last 512 byte > packet was delivered. This results in the device no longer responding to > further USB traffic or the protocol state being out of sync and > eventually the device firmware will completely crash, requiring a > lengthy power cycle and fsck on reboot. > > From what I can see, the URB_ZERO_PACKET flag appears to address this > issue, however one needs to set this flag on the URB itself. This is not > possible when using USBDEVFS_BULK, since the URBs are managed by the > underlying driver. Is there a way of somehow passing the URB_ZERO_PACKET > flag through usbfs? Yes, you can use USBDEVFS_SUBMITURB. It's a little more awkward than USBDEVFS_BULK but it allows you to specify the flags. > If not, what's the recommended process for dealing with this type of > device? I'd rather address this from user space before resorting to > writing a device driver. Will an USBDEVFS_BULK with > usbdevfs_bulktransfer.len = 0 have the same effect? In principle it ought to. If the ioctl works then it will have the same effect. However it might not work, since the usbdevfs code doesn't really expect to see transfer lengths of 0. Try it and see. Alan Stern ------------------------------------------------------- SF.Net email is Sponsored by the Better Software Conference & EXPO September 19-22, 2005 * San Francisco, CA * Development Lifecycle Practices Agile & Plan-Driven Development * Managing Projects & Teams * Testing & QA Security * Process Improvement & Measurement * http://www.sqe.com/bsce5sf _______________________________________________ [EMAIL PROTECTED] To unsubscribe, use the last form field at: https://lists.sourceforge.net/lists/listinfo/linux-usb-devel
