Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

WebUSB getDevices empty list

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 []
like image 249
Tauri28 Avatar asked Jan 26 '17 15:01

Tauri28


1 Answers

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().

like image 53
Supersharp Avatar answered Sep 30 '22 19:09

Supersharp