Using user-space USB drivers

Feature image

When you need to install a driver to get your USB device working, this driver is installed in kernel-space. On macOS this is called a kernel extension , which is a nice descriptive term. On Linux it's usually not even necessary not install anything, as support for almost every USB device is already built into the kernel. On Windows, the situation is ... a bit different.

With the release of macOS High Sierra, Apple is making it really difficult to install kernel extensions. Some have even called it a kextpocalypse. While I think Apple have made some serious UX mistakes in implementing this, I do agree with the sentiment regarding security. Kernel-space drivers run in a highly privileged mode which can seriously screw with your machine.

There is a great macOS app called Serial for connecting to serial USB devices. The first time I used it felt like magic, as it was able to connect to devices without having to install any kernel extensions. I contacted the developer and he explained that he basically wrote user-space drivers for all the devices.

Yesterday I added a user-space USB driver for CDC-ACM devices[1] written in Node.js by Nordic to the Tidepool Uploader. It works great on Linux and macOS, but not on Windows.

The reason is that even if you have a user-space driver, you still need to install a USB driver on Windows. That is because Windows apparently can't tell on its own that a USB device is a USB device and you always have to install a driver to tell it that.

The result of this is that Microsoft essentially requires anyone who want to use a USB device (that doesn't have a driver already built into Windows), to have administrator privileges and install a driver to use said device. Contrast that with macOS, where Apple effectively said with High Sierra that they don't want people to install drivers, so that user-space drivers are basically encouraged.

  1. that includes the Dexcom receiver and Tandem insulin pump we support at Tidepool ↩︎