From: jay.k <jay...@gm...> - 2013-05-06 18:28:50
|
Peter Stuge wrote > 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? * > My aim is to write a usb class driver for this particular camera for > vxWorks * >> 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 >> existonce this function has returned. * > Understood * >> 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? * > I plan to first get this camera working with a standalone driver on linux > and then port it to vxWorks * >> We need to set the bInterval of 8 instead of 128.Why do you think so?In >> the usbmon trace of the other code that uses the UVC driver, the >> bInterval field was 8,but our code written using LibUSB was this field >> set to 128, so we assumed that we were doing something wrong with the >> Interrupt >> Packet.//Peter------------------------------------------------------------------------------Learn >> Graph Databases - Download FREE O'Reilly Book"Graph Databases" is the >> definitive new guide to graph databases and their applications. This >> 200-page book is written by three acclaimed leaders in the field. The >> early access version is available now. Download your free book today! >> http://p.sf.net/sfu/neotech_d2d_may_______________________________________________libusb-devel >> mailing list > libusb-devel@.sourceforge > https://lists.sourceforge.net/lists/listinfo/libusb-devel Peter Stuge wrote > 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 existonce 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------------------------------------------------------------------------------Learn > Graph Databases - Download FREE O'Reilly Book"Graph Databases" is the > definitive new guide to graph databases and their applications. This > 200-page book is written by three acclaimed leaders in the field. The > early access version is available now. Download your free book today! > http://p.sf.net/sfu/neotech_d2d_may_______________________________________________libusb-devel > mailing list > libusb-devel@.sourceforge > https://lists.sourceforge.net/lists/listinfo/libusb-devel Peter Stuge wrote > 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 existonce 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------------------------------------------------------------------------------Learn > Graph Databases - Download FREE O'Reilly Book"Graph Databases" is the > definitive new guide to graph databases and their applications. This > 200-page book is written by three acclaimed leaders in the field. The > early access version is available now. Download your free book today! > http://p.sf.net/sfu/neotech_d2d_may_______________________________________________libusb-devel > mailing list > libusb-devel@.sourceforge > https://lists.sourceforge.net/lists/listinfo/libusb-devel Peter Stuge wrote > 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 existonce 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------------------------------------------------------------------------------Learn > Graph Databases - Download FREE O'Reilly Book"Graph Databases" is the > definitive new guide to graph databases and their applications. This > 200-page book is written by three acclaimed leaders in the field. The > early access version is available now. Download your free book today! > http://p.sf.net/sfu/neotech_d2d_may_______________________________________________libusb-devel > mailing list > libusb-devel@.sourceforge > https://lists.sourceforge.net/lists/listinfo/libusb-devel Peter Stuge wrote > 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 existonce 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------------------------------------------------------------------------------Learn > Graph Databases - Download FREE O'Reilly Book"Graph Databases" is the > definitive new guide to graph databases and their applications. This > 200-page book is written by three acclaimed leaders in the field. The > early access version is available now. Download your free book today! > http://p.sf.net/sfu/neotech_d2d_may_______________________________________________libusb-devel > mailing list > libusb-devel@.sourceforge > https://lists.sourceforge.net/lists/listinfo/libusb-devel -- View this message in context: http://libusb.6.n5.nabble.com/LibUSB-Interrupt-Transfer-tp5711901p5711919.html Sent from the LibUSB Dev mailing list archive at Nabble.com. |