On Sun, 8 Jul 2007, Phil Dibowitz wrote:

> With a bit of help, I've found the device has a handful of standard "Vendor"
> control commands. But when I try to send them with usb_control_msg(), I'm
> getting back 'Broken pipe'.
> 
> The only thing I can think of is that I'm not assembling my requestType
> right, but it seems right to me. I'm doing this (keep in mind I'm using
> libusb, not in-kernel USB... but for usb_control_msg() they should be the
> same except for request and requestType are switched in order of parameters):
> 
>         int retval;
>         int len = 100;
>         int timeout = 1000;
>         char buf[len];
>         retval = usb_control_msg(udev,
>                 USB_ENDPOINT_IN + USB_TYPE_VENDOR + USB_RECIP_INTERFACE,
>                 COMMAND_GET_VERSION, 0, DEVICE_INT, buf, len, timeout);
> 
> I've also tried that with USB_RECIP_DEVICE and USB_RECIP_ENDPOINT.
> COMMAND_GET_VERSION is a #define for 0x10. DEVICE_INT is a #define for 0.
> 
> This fails and usb_strerror() is "Broken pipe"... however, I can do
> "standard" commands like:
> 
>         int retval;
>         int len;
>         len = 2;
>         char buf[len];
>         retval = usb_control_msg(udev,
>                 GET_STATUS_TYPE, GET_STATUS,0,0,buf,len,1000);
> 
> GET_STATUS_TYPE is 0x80 (or USB_ENDPOINT_IN + USB_TYPE_STANDARD +
> USB_RECIP_DEVICE) and GET_STATUS is 0x00, as found in several drivers in the
> USB kernel tree.
> 
> Am I doing something obviously wrong here? If not, I'm probably
> misunderstanding how the device works, but before I spin my wheels too long,
> I thought I'd see if I was making some obvious mistake.

Use usbmon.  Compare what your program does with the Windows packet 
traces.

Alan Stern


-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
_______________________________________________
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