Question

So I was wondering: Since libusb provides userspace access to USB, is it possible to port already existing kernel drivers to libusb?

I do understand it might need rewriting of the driver, but do you think it is possible to write a "virtual kernel" that relies on libusb for access to devices and link already existing drivers to that? Essentially writing a layer between libusb and kernel modules that translates kernel USB commands to libusb commands.

Why bother? If you want to run a kernel driver on Android for example, you need to make sure it was compiled for a particular kernel version/device model. So an app will not be able to run on all devices. On the other hand libusb is fully compatible with most of the latest Android devcices.

Was it helpful?

Solution

AFAIK, libusb is a library that communicates with the higher level of the USB layer of the kernel. The lowest parts of the USB subsystem have to be written in kernel space, because they need to have access to the physical address space of the USB host controller and uses interrupts, and other low-level functions that are not possible to implement in user space.

So I don't think that it is possible to port low-level parts of the USB subsystem in user-space.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top