webusb icon indicating copy to clipboard operation
webusb copied to clipboard

Search all available devices

Open ahmedprusevic opened this issue 3 years ago • 1 comments

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?

ahmedprusevic avatar Jul 10 '21 14:07 ahmedprusevic

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.

thegecko avatar Jul 10 '21 17:07 thegecko