Problems Accessing USB Device Information in Node.js with npm USB Package on Windows

95 Views Asked by At

I'm developing a Node.js application where I need to access information about connected USB storage devices, identify a specific one based on certain criteria, and transfer data to it.

I've encountered an issue using the npm USB package (version 2.11.0, which is the latest as of now). My application needs to run on Windows, but this package doesn't seem to work out-of-the-box due to dependencies on libusb. I'm looking for a solution that doesn't require end-users to manually install additional drivers.

The specific data I need to filter the USB devices includes their serial number, product ID, and vendor ID. However, when I attempt to open a device, I run into the error (full logs available here)

I'm aware of the USB package windows readme section, but it simply doesn't work as expected. When trying to use usb.useUsbDkBackend(), I encounter the error

[ 0.006065] [00005310] libusb: error [windows_set_option] UsbDk backend not available

Considering this roadblock, my next idea is to develop a custom CPP NodeJS addon to handle USB device interactions. However, this seems like a significant undertaking, especially when the USB package appears to be close to fulfilling my requirements. I am hoping to find a solution that either makes the USB package work on Windows or a less labor-intensive alternative to writing a CPP addon.

I'm using Node.js v18.12.0 on Windows 11.

0

There are 0 best solutions below