thegecko/webusb

support for allowing all devices

Closed this issue · 4 comments

In order to enable headless scenario, it would be nice to allow any device matching the filters.

I believe passing options with an empty filter array matches all devices, the same as in the browser.

For a headless scenario, you need a function to select the device, this can be achieved by implementing your own devicesFound function, see this example.

I'm keen to align to the spec where possible, this function is designed to return all previously allowed devices.

Could you outline your use case? I guess an optional allowAll flag could be used, but then you would lose compatibility with the specification and your code wouldn't work as expected in the browser.

You could always use the underlying usb library if you just want to list usb devices:

https://github.com/tessel/node-usb#usbgetdevicelist