WICG / webusb

Connecting hardware to the web.
https://wicg.github.io/webusb/
Other
1.3k stars 127 forks source link

Add example of using permission api #111

Open scheib opened 6 years ago

karelbilek commented 6 years ago

I tried this, but I got only errors

await navigator.permissions.query({name:'usb', filters: []})

karelbilek commented 6 years ago

The error is as follows:

Uncaught (in promise) TypeError: Failed to read the 'query' property from 'Permissions': The provided value 'usb' is not a valid enum value of type PermissionName.

reillyeon commented 6 years ago

Chrome does not yet support WebUSB in the permissions API. This is tracked by Chromium issue 638721.

jogshraddha commented 6 years ago

Hi.. is this still not supported by chrome? I am trying to use web usb but when I call device.open it throws me "Access denied" error. any suggestions will be appreciated. Thanks

odejesush commented 6 years ago

Hi @jogshraddha, WebUSB is enabled by default on Chrome since 61. There are a couple of reasons that may be producing this error. The first is that the origin does not have permission to open the USB device. This can happen on Android if the device has revoked access to the USB device. The second reason is that Chrome failed to grab the device handle. If you are still unable to open the device, please file a bug report at https://crbug.com/ with details on how to reproduce the issue. I hope that this helps.