webusb icon indicating copy to clipboard operation
webusb copied to clipboard

Add example of using permission api

Open scheib opened this issue 8 years ago • 5 comments

scheib avatar Nov 16 '17 22:11 scheib

I tried this, but I got only errors

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

karelbilek avatar Nov 29 '17 00:11 karelbilek

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.

karelbilek avatar Nov 29 '17 00:11 karelbilek

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

reillyeon avatar Nov 29 '17 01:11 reillyeon

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

jogshraddha avatar Jun 22 '18 09:06 jogshraddha

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.

odejesush avatar Jun 22 '18 15:06 odejesush