Add more maintainers
See original GitHub issueWhile I’ve been merging small PRs and occasionally making releases, I’m not really using Node much these days, and so my motivation to work on this library has declined.
The project has reached a point where several long-standing issues have become pressing, while I’m not currently able to put in the effort to deal with them. I’m glad to see the project so widely used, but I hate to see the issues and pull requests piling up. I’m hoping there are contributors interested in taking on a more active role.
Given the risk of supply-chain attacks, I’m going to do this cautiously, with a preference for existing contributors or maintainers of other libraries, and may end up simply recommending publishing under a new npm package name instead.
Here are the issues that most need attention:
Prebuild ABI treadmill
As a C++ extension using V8 / NAN directly, node-usb currently needs to be built for each new Node and Electron release. Users tend not to have compiler toolchains on Windows, so rely on prebuilds that have to be kept updated.
N-API (implemented in https://github.com/tessel/node-usb/pull/399) is the way out of this.
Old libusb
This library is linked against a very outdated fork of libusb, containing my rebase of an old patch from the libusb mailing list adding hotplug event support for Windows. Upstream libusb has still not added hotplug support for Windows, but we’re missing out on several years of upstream bugfixes.
I don’t know what the best answer here is. Libusb is similarly undermaintained, and I don’t expect them to add Windows hotplug support anytime soon. It’s possible that node-usb 2.0 should just make the breaking change of not guaranteeing hotplug support on all platforms.
Testing
The full test suite, which I run prior to releases, requires hardware that was never produced in quantity, running firmware that I seem to have lost the source code for. The firmware is pretty simple, just a couple of endpoints and control requests that echo data back, and it would be good to migrate this to a piece of widely available hardware. (https://github.com/tessel/node-usb/issues/5)
Travis-CI is sunsetting their support for open source projects, necessitating a move to another CI platform, probably GitHub Actions.
API issues
The API was designed before Promise
and async/await
and could use a redesign. Other major deficiencies include broken handling of USB configurations because that was added as an afterthought. The standard for USB in JS nowadays is WebUSB, so a hypothetical node-usb
2.0 should probably just adopt that API wholesale. @thegecko’s webusb wraps this library in a webusb-compatible API and could be a good starting point.
Issue Analytics
- State:
- Created 3 years ago
- Comments:24 (23 by maintainers)
@kevinmehall I’ve added @thegecko
Correct. The libusb hotplug APIs are unsupported on Windows. This maps to the
'attach'
and'detach'
events in node-usb. The version of libusb used in node-usb is based on one of the previous attempts at implementing hotplug on Windows that seemed to work but never got merged upstream.Libwdi could be useful in some cases but I fear it would be a support burden. With how many people report issues here trying to use HID, CDC, or mass storage devices with this library, I’d want a big warning on it, because someone’s going to loop over all their devices and replace all the drivers and break their mouse and keyboard.
The preferred option for custom devices is a WCID descriptor that tells Windows 7+ to bind the WinUSB driver automatically. That’s not always an option, but it’s a more elegant solution when it is.