Can a driver wrap another driver to use WEBUSB

288 views Asked by At

I have a device that I would like to access through WebUsb, the driver is source-closed, so Is there a way I can create my own driver to wrap the official driver ?, just to give the device visibility from chrome and WebUsb ?

Update:

After the answer that really helped me a lot I can say the following:

If you don't have access to the firmware of the USB and cannot modify it so its compatible with WebUsb, the next approach is to learn how the device works at low level, you dont need to know the full USB Protocol, but at least know how to send and receive commands, and in WINDOWS is a must, that the driver for your usb device be WinUsb.sys

You dont need to create a full new driver, only know how the comunication between the device and the computer works, and rewrite that in javascript.

1

There are 1 answers

2
Reilly Grant On BEST ANSWER

WebUSB is designed to provide low-level access to USB devices, at the level of individual USB transfers. If the device has an existing driver then that should be taking care of the transfers and presenting a higher-level interface to applications on your system. Trying to wrap that in something which presented the low-level interface again would be counterproductive.

Without more information about the device in question and its driver I can't give more precise advice.

One option, which would be a lot of work but could be more broadly applicable would be writing a wrapper around the existing driver that would allow it to use WebUSB to connect to the device. There has been work, for example, it port user-space drivers using libusb to the web by providing a port of libusb that uses WebUSB internally. This works much more easily for open-source drivers because you can recompile them to use the wrapper. If this is a closed-source native Windows driver, for example, running that inside of an emulator on the web would be an enormous undertaking.