thegecko / webusb

Node.js implementation of the WebUSB Specification
https://thegecko.github.io/webusb/
MIT License
183 stars 27 forks source link

Search all available devices #84

Open ahmedprusevic opened 3 years ago

ahmedprusevic commented 3 years ago

I'm developing an app using electron. Requesting devices with:

usb.requestDevice({ filters: [] })

This promise simply does not return all available devices, when vendor id is passed it works. Is there any way to get all available devices?

thegecko commented 3 years ago

You need to insert a selection function in order to control which device is selected and this will mimic the experience seen in the browser. This can be done by creating your own instance of the WebUSB class, see:

https://thegecko.github.io/webusb/docs/index.html#creating-your-own-usb-instances

The default instance you are using will return the first device matching your filters.