On Sun, 30 Jan 2005, Alan Stern wrote:

> On Sun, 30 Jan 2005, Antonio Vinci wrote:
> 
> > Hi all,
> > I'm new in this list and i'm approaching libusb programming.
> > Trying to write a sane backend for my scanner, i do the following steps:
> > 
> > open the device with scanner = usb_open(dev);
> > set the device configuration with usb_set_configuration(scanner, 1);
> > claim the device with usb_claim_interface(scanner, 0);
> > 
> > when i try to send any data to the device:
> > usb_bulk_write(scanner, 81, cmd, length, 1000)
> > returns -22 (Invalid argument).
> > 
> > I'm wondering what is the "Invalid argument" referred to?
> 
> Should the 81 really be 0x81?

No, obviously it shouldn't since 0x81 would be in IN endpoint and this is 
a write.

There are several things that can result in -EINVAL.  Among them are:
using a non-existent endpoint, trying to transfer too much data, passing
an invalid pointer for the buffer address, and passing a negative transfer 
length.  The last three seem unlikely in your case, but maybe the endpoint 
number is wrong.  Have you looked in /proc/bus/usb/devices to check?

Alan Stern



-------------------------------------------------------
This SF.Net email is sponsored by: IntelliVIEW -- Interactive Reporting
Tool for open source databases. Create drag-&-drop reports. Save time
by over 75%! Publish reports on the web. Export to DOC, XLS, RTF, etc.
Download a FREE copy at http://www.intelliview.com/go/osdn_nl
_______________________________________________
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