WICG / webhid

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

Different websites use the same HID device, oninputreport only trigger one of the listeners #96

Open Ltyi opened 2 years ago

Ltyi commented 2 years ago

Different websites use the same HID device, oninputreport only trigger one of the listeners

How can I make oninputreport trigger both?

// A application
HIDScanner.oninputreport = (e) => {
  console.log("A")
};
// B application
HIDScanner.oninputreport = (e) => {
  console.log("B")
};

First scan:

"A" triggerd

Second scan:

"B" triggerd

nondebug commented 2 years ago

This should work. Which OS are you using?

Ltyi commented 2 years ago

This should work. Which OS are you using?

OS is Windows 10 21H2, and the scanner is honeywell 7580g

nondebug commented 2 years ago

It looks like 7580g is a barcode scanner: Genesis 7580g Hands-Free Scanner

I don't have any barcode scanners so I tested with a USB headset (Jabra Engage) on Windows 10 21H2 and was able to receive input report events on two separate domains. Barcode scanners have special support in Windows 8.1 and later with hidscanner.dll which I suppose could be interfering:

https://docs.microsoft.com/en-us/windows-hardware/drivers/hid/hid-architecture#hid-clients-supported-in-windows

The documentation says access mode is Shared so I wouldn't expect any issues with multiple clients accessing the same input reports. Maybe there's a hidscanner.dll bug where it doesn't work properly when there are multiple clients from the same application?

For other (probably unrelated) issues, users have reported success changing the driver from hidscanner.dll to hidclass.sys. Could you try that and see if it changes the WebHID behavior?

Ltyi commented 2 years ago

It looks like 7580g is a barcode scanner: Genesis 7580g Hands-Free Scanner

I don't have any barcode scanners so I tested with a USB headset (Jabra Engage) on Windows 10 21H2 and was able to receive input report events on two separate domains. Barcode scanners have special support in Windows 8.1 and later with hidscanner.dll which I suppose could be interfering:

https://docs.microsoft.com/en-us/windows-hardware/drivers/hid/hid-architecture#hid-clients-supported-in-windows

The documentation says access mode is Shared so I wouldn't expect any issues with multiple clients accessing the same input reports. Maybe there's a hidscanner.dll bug where it doesn't work properly when there are multiple clients from the same application?

For other (probably unrelated) issues, users have reported success changing the driver from hidscanner.dll to hidclass.sys. Could you try that and see if it changes the WebHID behavior?

Oh! you're right.

After I changed the driver to hidclass.sys the problem was solved.

Thank you so much!