From: Peter S. <pe...@st...> - 2013-05-06 18:11:01
|
jay.k wrote: > I am writing a standalone driver for this device using LibUSB instead > of using the UVC driver in the Linux Kernel. Why? > I am allocating interrupt transfers as follows > > static struct libusb_transfer *allocate_int_transfer(libusb_device_handle > *handle) > { > > struct libusb_transfer *transfer = libusb_alloc_transfer(0); > if (!transfer) > printf("transfer alloc failure"); > > > unsigned char int_buf[16]; > libusb_fill_interrupt_transfer(transfer,handle,0x87, > int_buf, sizeof(int_buf),interrupt_callback, NULL, 0); > > return transfer; > } This is not valid. The memory buffer you provide does not exist once this function has returned. > My Callback function is this: > > static void interrupt_callback(struct libusb_transfer *transfer) > { > printf("interrupt_callback status %d\n", transfer->status); > libusb_submit_transfer(transfer); > } This is OK. > I send the Interrupt transfer in my main loop as follows: > > struct libusb_transfer *int_transfer; > int_transfer = allocate_int_transfer(dev_handle); > > r = libusb_submit_transfer(int_transfer); > if (r < 0) > printf("interrupt submit fail %d\n", r); Also OK. > I am basically trying to reverse engineer and emulate the behaviour of > that code, and accordingly write my code, so I get the exact same > behaviour. Again, why? > We need to set the bInterval of 8 instead of 128. Why do you think so? //Peter |