WICG / webhid

Web API for accessing Human Interface Devices (HID)
Other
140 stars 35 forks source link

A new filter option to exclude already-authorized devices #49

Open yoichiro opened 3 years ago

yoichiro commented 3 years ago

I want to add a new filter option to exclude already-authorized devices for the requestDevice method.

dictionary HIDDeviceFilter {
    unsigned long vendorId;
    unsigned short productId;
    unsigned short usagePage;
    unsigned short usage;
    boolean excludeAuthorisedDevices;  // <- New filter option
};

Currently, there is no such option. Therefore, users see all connected devices including devices which was already authorized on the dialog opened by calling the requestDevice method.

In the other hand, we can get all authorized devices by calling the getDevices method. Generally, most apps should call the getDevices method at launching for the purpose of displaying a device list, I guess. Also, most apps should keep and manage the list of authorized devices.

If a user selects already-authorized devices from the dialog opened by calling the requestDevice method, we need to check whether the selected device is included in the list of the result retrieved from calling getDevices method or not. However, if there is an option to exclude already-authorized devices from the device list on the dialog opened by calling the requestDevice method, it is unnecessary.

nondebug commented 3 years ago

This seems like a nice improvement that would also benefit other APIs that use a chooser-based permission dialog. (WebUSB, Serial, etc)

beaufortfrancois commented 2 years ago

It seems like the exclusionFilters option proposal at https://github.com/WICG/webhid/pull/93 could help as well with this feature request.