SuperFlyTV / xkeys

A Node.js module to interact with the X-keys panels.
MIT License
33 stars 12 forks source link

Intermittent "NotAllowedError: Failed to write the report." on Chrome v115+ #92

Closed KhangxLi closed 1 year ago

KhangxLi commented 1 year ago

The following uncaught exception (or promise rejection, not sure) "NotAllowedError: Failed to write the report." gets thrown from within function setupXkeysPanel.

On Chrome versions 117+ (tested on 117, 118, 120), this happens consistently until Chrome is restarted ( can use chrome://restart ). The issue gets resolved only after a random number of Chrome restarts and sometimes requiring XKeys to be replugged. The issue can then be reintroduced after a certain random number of Chrome restarts again.

The issue is never reproduced on Chrome v115 and below. Chrome v116 behaviour is untested.

In Chrome device log ( chrome://device-log/ ) I see either one of these 2 errors when the issue occurs when calling setupXkeysPanel:

Reproduced with:

Any ideas?

michaelhatPIengineering commented 1 year ago

This is the first we have heard of. The output report has stayed the same. It may be trying to write to the wrong end point. The X-keys is several "devices" to the OS as it is a compound USB device. Be sure to check the write length is longer than 20 or HID usage page 0xc (12 dec )

Writing to device "0" for example does not always work if the OS enumerates them in a different order.

Julusian commented 1 year ago

This was pretty easy to reproduce, and I could see that when approving the device it returns 3 different objects where we were always taking the first of this list.

Filtering this to only return and accept ones with usagePage 12 has made the issue go away for me

KhangxLi commented 1 year ago

Correction: Issue might have been present on earlier Chrome version (115) and was exposed by a combination of Windows upgrade and Chrome update.

michaelhatPIengineering commented 1 year ago

I reviewed with our firmware engineer; she recommends: filter only on: VID PID Usage page 12 write length > 20 to get the "device" supported by this lib. other things are redundant or not consistent over all OSs

KhangxLi commented 1 year ago

thanks guys, I'm able to fix it locally since I can access these fields.

Will update my package once https://github.com/SuperFlyTV/xkeys/pull/93 is merged since it seems to also take care of an uncaught promise rejection.

Won't close this issue myself until above is merged

nytamin commented 1 year ago

This is now fixed in version v3.0.1, thanks for contributing!