Benoit PAPILLAULT wrote:
> Up to now, I was using libusb and functions like usb_bulk_read(),
> usb_bulk_write() and usb_control_msg(). All is fine, except all those functions
> have a timeout, which made them unusable for receiving.
>
> I tried directly the ioctl USBDEVFS_SUBMITURB (don't know what is the use of
> USBDEVFS_REAPURB). I found little documentation, so I read and reread the
> kernel sources. But I only get crashes at random time and many stranges
> messages in my /var/log/messages.
>
> Maybe you can help me on this part or point me to a source sample using
> USBDEVFS_SUBMITURB and USBDEVFS_REAPURB.
Checkout the libusb source code, and how it does stuff using IOCTL_USB_BULK.
I'm only going off the source code myself - it appears to be fairly
unusual to use USB from userspace, so there no examples. The
USBDEVFS_REAPURB is the 'read' function that allows you to read from an
endpoint. It sleeps the process then reads the next packet that comes
in from the device.
I guess if you're reading/writing at the URB level you have to work out
the details yourself. However it looks quite hard to do.
The IOCTL_USB_BULK stuff doesn't need to receive the whole block. If
you look at the source you'll see that it returns the length of data
copied. If you give it a max buffer size it'll return up to that
length. If you want it to wait forever just give it a timeout of -1
(better to give it a timeout of 1 second or so, so you can housekeep in
the background).
The libusb version of the USB_BULK stuff looks wrong, as it requires the
exact size to be returned. Better to write your own (libusb isn't even
in beta yet, and it's marked 'for developers only' so using it could be
creating more problems than its worth).
Tony
--
Don't click on this sig - a cyberwoozle will eat your underwear.
[EMAIL PROTECTED] http://www.nothing-on.tv
_______________________________________________
[EMAIL PROTECTED]
To unsubscribe, use the last form field at:
http://lists.sourceforge.net/lists/listinfo/linux-usb-users