Hello, i am writing an usb driver for my webcam and i need to know
why usb_control_msg() fails when i try to set a register.
Specifications say:
"Vendor-Specific requests:
The W9968CF supports two vendor-specific requests for the control registers
In/Out transfers on the default pipe (endpoint 0): Get W9968CF Control and
Set W9968CF Control. The vendor-specific requests defined for the W9968CF are
shown in table 7.4 [below]. The W9968CF returns STALL if an unrecognized or
unsupported vendor-specific request is received.
[Table]
bmRequest type bRequest wValue wIndex wLength Data
-------------- -------- ------ ------ ------- ----
11000000B GET_W9968CF_CONTROL(1) Zero Index Length Data
01000000B SET_w9968CF_CONTROL(0) Data0 Index Length Data
Note 1. Index specifies the starting index of the control registers to be
accssed. An index counter, loaded with the index value, will be incremented
by one after every two bytes of data transferred.
Note 2. Length specifies number of data bytes transferred during the second
phase of the control transfer. It should be an even value. If this field is
zero, there is no data transfer phase.
Note 3. Data0 is a word-sized data to be programmed into the control register
indexed by the Index field, no matter the Length field is zero or not. The
internal index counter will be incremented by one once Data0 is transferred.
Get W9968CF Contro: [....]
Set W9968CF Control: The W9968CF supports a Set W9968CF Control request
W9968CF control registers OUT transfer . Length field should be an even
number value. If the length field is zero, only Data0 is transferred with no
data transfer phase. The W9968CF returns STALL for any unsupported Set
W9968CF Control request. "
Ok, I think i should use that Set W9968CF Control command to give a command to
the webcam. I don't want data on return, given that i just want to set a
register to a specified value. Below is the function which always fails
returning -110 or -32, depending on the parameters i pass to
usb_control_msg() (i tried everything!)
static int w9968cf_set_reg(struct usb_device *udev, __u16 value, __u16 index)
{
int res;
res = usb_control_msg(udev, usb_sndctrlpipe(udev, 0), 0x40,
USB_TYPE_VENDOR | USB_DIR_OUT,
value, index, NULL, 0, HZ);
if (res < 0)
printk(KERN_DEBUG "W996[87]CF: w9968cf_set_reg() failed "
"(value %04X, index %02X, error %d).\n",
value, index, res);
return res;
}
I also tried to add some other flags like "USB_RECIP_ENDPOINT" and some other
things, but it always fails. Sometimes, after failing, the disconnect() and
probe() function are automatically called (weird)...
To "turn on" the camera i do this:
w9968cf_set_reg(0xbf10, 0x0000);
The kernel message is:
usb-uhci.c: interrupt, status 3, frame# 486
W996[87]CF: w9968cf_set_reg() failed (value BF10, index 00, error -110).
-------------------------------------------------------
This sf.net email is sponsored by:ThinkGeek
Welcome to geek heaven.
http://thinkgeek.com/sf
_______________________________________________
[EMAIL PROTECTED]
To unsubscribe, use the last form field at:
https://lists.sourceforge.net/lists/listinfo/linux-usb-devel