Running Chrome 56.0.2924.76 (64-bit) on Windows 10 PRO Version 1511 (OS Build 10586.753). Have enabled experimental-web-platform-features on chrome, running it with flag --disable-webusb-security and as administrator. I try to get USB device list on localhost (using https) with getDevices but I get empty list, although chrome://device-log is showing me plenty of devices. What could be the issue?
navigator.usb.getDevices().then(function(devices){
console.log(devices);
});
// console outputs []
You should use requestDevice()
before in order to get access permissions on selected devices.
navigator.usb.requestDevice({filters:[]}).then(function(device){
console.log(device);
});
After that you'll be able to call getDevices()
.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With