Hello
  I am trying to write a driver for my usb camera.
The problem is that i can't understand  what goes wrong every time the driver 
tries to write to a register  to send a command (no data on return). This is 
the function:

static int my_set_reg(struct usb_device *udev, __u16 value, __u16 index)
{
        int err;

        err = usb_control_msg(udev, usb_sndctrlpipe(udev, 0),
                              0,
                              USB_TYPE_VENDOR | USB_DIR_OUT,
                              value,  index,  NULL,  0,  HZ);

        if (err)
                printk(KERN_DEBUG "MY_DRIVER: my_set_reg() failed "
                       "(value %04X, index %02X).\n", value, index);

        return err;
}
A tipical call is    my_set_reg(0x0010, 0x0000);

Can someone explain me what values the third parameter can *exactly* assume?
I think "0" means something like "set control transfer".
Since i don't want data on return, Is NULL right (4th parameter) ?
Is "size" parameter right too?

I tried everything but the function always fails, and the kernel disconnects() 
and probes()  again without any reason (weird):

usb-uhci.c: interrupt, status 2, frame# 862
MY_DRIVER:  my_set_reg() failed (value 0010, index 00).
hub.c: already running port 1 disabled by hub (EMI?), re-enabling...
usb.c: USB disconnect on device 00:07.2-1 address 20
MY_DRIVER:  disconnect() called.
hub.c: new USB device 00:07.2-1, assigned address 21
usb.c: USB device not accepting new address=21 (error=-110)
hub.c: new USB device 00:07.2-1, assigned address 22
MY_DEVICE: probe() called.




-------------------------------------------------------
This SF.NET email is sponsored by: Geek Gift Procrastinating?
Get the perfect geek gift now!  Before the Holidays pass you by.
T H I N K G E E K . C O M      http://www.thinkgeek.com/sf/
_______________________________________________
[EMAIL PROTECTED]
To unsubscribe, use the last form field at:
https://lists.sourceforge.net/lists/listinfo/linux-usb-devel

Reply via email to