jay.k
2013-05-05 20:59:18 UTC
I am working on a UVC Compliant USB Webcam.
I am writing a standalone driver for this device using LibUSB instead of
using the UVC driver in the Linux Kernel.
I am facing a issue with sending interrupt packets to this device.
My Interrupt Endpoint descriptor is
bLength: 0x07
bDescriptorType:0x05
bEndpointAddress:0x87 -> Direction: IN - EndpointID: 7
bmAttributes: 0x03 -> Interrupt Transfer Type
wMaxPacketSize:0x0010 = 1 transactions per microframe, 0x10 max bytes
bInterval:0x08
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;
}
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);
}
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);
The first line of the trace captured using usbmon facility is
efbdee40 2217417032 S Ii:2:005:7 -115:128 16 <
I have another code written by someone else, which relies on the UVC driver.
It runs successfully and can capture frames from the camera.
The first line of the usbmon trace captured from that code is
f0f700c0 2152410673 S Ii:2:012:7 -115:8 16 <
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.
We need to set the bInterval of 8 instead of 128.
So is there anyway by which I can tell LibUSB, the value of my bInterval
field of my Interrupt Endpoint, so that my code sends the exact same
interrupt packet as that code?
--
View this message in context: http://libusb.6.n5.nabble.com/LibUSB-Interrupt-Transfer-tp5711901.html
Sent from the LibUSB Dev mailing list archive at Nabble.com.
I am writing a standalone driver for this device using LibUSB instead of
using the UVC driver in the Linux Kernel.
I am facing a issue with sending interrupt packets to this device.
My Interrupt Endpoint descriptor is
bLength: 0x07
bDescriptorType:0x05
bEndpointAddress:0x87 -> Direction: IN - EndpointID: 7
bmAttributes: 0x03 -> Interrupt Transfer Type
wMaxPacketSize:0x0010 = 1 transactions per microframe, 0x10 max bytes
bInterval:0x08
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;
}
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);
}
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);
The first line of the trace captured using usbmon facility is
efbdee40 2217417032 S Ii:2:005:7 -115:128 16 <
I have another code written by someone else, which relies on the UVC driver.
It runs successfully and can capture frames from the camera.
The first line of the usbmon trace captured from that code is
f0f700c0 2152410673 S Ii:2:012:7 -115:8 16 <
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.
We need to set the bInterval of 8 instead of 128.
So is there anyway by which I can tell LibUSB, the value of my bInterval
field of my Interrupt Endpoint, so that my code sends the exact same
interrupt packet as that code?
--
View this message in context: http://libusb.6.n5.nabble.com/LibUSB-Interrupt-Transfer-tp5711901.html
Sent from the LibUSB Dev mailing list archive at Nabble.com.