WICG / webusb

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

Included non-connected devices in device permission result #166

Open odejesush opened 5 years ago

odejesush commented 5 years ago

Figure out the best way to allow sites to see all of the device permissions that they have, even if the devices are not currently connected to the system.

This could perhaps be done by extending getDevices() to have the option to return non-connected devices.

However, it also makes more sense for the Permissions API to return all permissions, including the ones for devices that are not currently connected to the system.

Implementing such a feature would enable developers to skip their permissions request UI if they already have permission to access a devices, and instead tell their users to connect the USB device supported by the site.

mitchellwills commented 5 years ago

This would definitely be helpful for applications to better understand whether a device, which they were previously granted access to, is missing or if the issue is related to a permission. Another use case is for when devices may change modes, resulting in a change in product id, which would require an additional permission request. An API like this would allow the application to determine if the permission request is required and if not provide a more informative error to the user.

It would also be nice if the API included information about permissions granted by the browser through other means. For example, Chrome allows for granting of permissions through a group policy (https://bugs.chromium.org/p/chromium/issues/detail?id=854329#c32) and it would be nice if the effect of the policy (for the current site) was accessible through this API.

yume-chan commented 1 year ago

This could also enable developers to unpair/forget a currently disconnected device.

Now such device management feature can be emulated by saving every paired devices to localStorage, and ignore any "forgotten" devices from getDevices' result. However, users could unpair devices from browsers' permission settings and there is no method to sync that info.