Linux to QNX USB driver convert

40 views Asked by At

I've just started using QNX. I'm trying to write a USB3 vision driver under QNX by adapting a code found on GitHub: https://github.com/ni/usb3vision/tree/master

and I wanted to know how to replace the usb_bulk_msg() function by the functions of the QNX libusbdi but I can't figure out how to do it.

Most of the functions are identical, but I can't figure out how to replace usb_bulk_msg().

1

There are 1 answers

0
Will Miles On

I only have access to libusbdi documentation for QNX 6.5 and prior. At that time, QNX libusbdi did not supply synchronous messaging functions, only an asynchronous completion callback interface via usbd_io. You will need to write your own shim function.

usb_bulk_msg itself is actually implemented using an underlying asynchronous USB API very similar to libusbdi; you can use the kernel source code there as a guide on how to implement it. On QNX, struct completion could be implemented with a condvar. Note that you'll also need to track outstanding requests so as to manage cleanup in the device removal callback.