Re: libusb driver question: can't write to endpoint
Phil Dibowitz <[email protected]>
| Newsgroups | gmane.linux.usb.devel |
|---|---|
| Message-ID | <[email protected]> |
Alan Stern wrote:
> On Sun, 11 Mar 2007, Phil Dibowitz wrote:
>
>> So I went back and "fixed" the remote by updating on my mac and noticed the
>> software "initializes" it before it "uploads" (generic terms in the GUI),
>> and looking back at the log from the windows box, it sends a few
>> CONTROL_TRANSFERs before it starts up the INTERRUPT_TRANSFERs. So there's
>> one thing I think I'm missing - I don't know what those CONTROL TRANSFERS are.
>
> They could be the standard Windows enumeration sequence.
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.
Thanks!
--
Phil Dibowitz [email protected]
Open Source software and tech docs Insanity Palace of Metallica
http://www.phildev.net/ http://www.ipom.com/
"Never write it in C if you can do it in 'awk';
Never do it in 'awk' if 'sed' can handle it;
Never use 'sed' when 'tr' can do the job;
Never invoke 'tr' when 'cat' is sufficient;
Avoid using 'cat' whenever possible" -- Taylor's Laws of Programming
-------------------------------------------------------------------------
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/
_______________________________________________
[email protected]
To unsubscribe, use the last form field at:
https://lists.sourceforge.net/lists/listinfo/linux-usb-devel
signature.asc
(application/pgp-signature, 252 B)
-----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.6 (GNU/Linux) Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org iD8DBQFGkc1uN5XoxaHnMrsRAuTuAJ9LZnPzuU5mnlfWIy9atAcJTK2ErwCcD6g9 7XfYeb88AjQECEWjPziFf4I= =Y7ur -----END PGP SIGNATURE-----