Skip to content
Advertisement

How would I reproduce the functionality of the Windows winusb driver on Linux? Do I even need to?

I need to implement an application on Linux that drives a USB connected device (a medical instrument). The application will be written in C++ (2011 standard).

The current application is written for Windows 10 in C# and uses the standard Winusb driver enumerated for the device. I have a complete protocol specification for the commands and the events/interrupts coming back. Unfortunately, I’m not sure how I can pass these to the USB layer in Linux. If it was a simple serial device, there would be no problem but I’m guessing the command responses and the interrupt events are multiplexed by the driver using the functionality in the Winusb driver.

Where’s the best place to start in terms of documentation? Alternatively, is there a Linux library (or driver) that provides more or less the same functionality as winusb for Linux?

Any help appreciated. Thanks

Advertisement

Answer

Alternatively, is there a Linux library (or driver) that provides more or less the same functionality as winusb for Linux?

One way is using directly the generic kernel API for USB (see the Asynchronous I/O parts to get the interrupts):

https://www.kernel.org/doc/html/v4.15/driver-api/usb/usb.html

This is the strict Linux equivalent of WinUSB.

The potentially less hard way is using libusb, which also get you cross-platform features.

(I am assuming your device is recognized correctly by the kernel, and doesn’t need a custom driver)

User contributions licensed under: CC BY-SA
5 People found this is helpful
Advertisement