On Sat, 1 Aug 2009, Lucas Jacobs wrote: > Greetings linux-usb, > > I've been having problems for about a month with a driver I wrote for > a USB device, first in Windows using UMDF, and now as a Linux kernel > module. In short, at certain points in the driver, usb_bulk_msg(), > usb_submit_urb(), etc. return -75, (-EOVERFLOW) which has been > associated with unexpected extra data. ('babble') > > In order to address these problems I need a good way to 'clear' all > data sent by the device through the input bulk endpoint. Currently I > have a function that basically calls usb_bulk_msg(), reading in > wMaxPacketSize bytes at a time until the length of the read reported > does not match this maximum packet size. (typically 512) This fixes > some problems, but usage of the input endpoint immediately following > this 'flush' function (for data that's requested after the flush takes > place) fails with -75. > > In UMDF, there's a method called IWDFUsbTargetPipe::Flush() that wipes > data from the fifo buffer associated with the USB endpoint: > http://msdn.microsoft.com/en-us/library/dd184035.aspx > I'm not sure if usbcore performs buffering, or if the USB host > controller does this, or what is going on, but does the Linux USB > subsystem include similar functionality, allowing a bulk input to be > 'wiped' of data, or 'reset'? It doesn't. This is because usbcore does not maintain any buffers associated with endpoints. All such buffering is done in your driver or on the device. If you want the device to flush its buffers, you'll have to send it an appropriate command. USB doesn't define any standard commands for this; it will have to be something device-specific. There are other, more drastic ways of resetting a device. You could consider using usb_reset_device(), for instance. But read the kerneldoc for that function; it has some very particular locking requirements. Alan Stern -- To unsubscribe from this list: send the line "unsubscribe linux-usb" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html