WICG / webhid

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

HID Headsets send two reports in a sequence if push 'Mute' button #72

Closed Alex-us closed 3 years ago

Alex-us commented 3 years ago

Looks like this is not related to device, since tried on different with the same result: Sennheiser, Jabra, Poly. If you connect one of listed USB headset and add inputReport listener, you will find that on pressing mute button you receive 2 reports in a sequence first with value 1 and second with value 0. The sequence is always the same: 1 then 0.

Alex-us commented 3 years ago

Looks like not a bug

nondebug commented 3 years ago

Yes, I think this is related to how HID telephony devices synchronize the mute state between the host and device. Depending on how the device is being used, the mute signal might come from the device or from the host.

There are two HID usages involved in muting: the Phone Mute usage on the Telephony page (usage page 0x000B, usage 0x002F) and the Microphone usage on the LED page (usage page 0x0008, usage 0x0021). When the headset's mute button is pressed it sends Telephony / Phone Mute with value 1 to the host, which should reply LED / Microphone with value 1.

It sounds like your headset is trying to synchronize the mute state but doesn't get the expected reply, so it times out and resets the mute state to the default. Try modifying your application to respond with an output report containing the LED / Microphone usage and see if the behavior changes.

For Jabra devices, this is documented in the Jabra HID usb.org specification. See 5.5 Mute Microphone.

Alex-us commented 3 years ago

Thank you @nondebug for the answer. I'm doing headset support via WebHID API for my company and already test lots of headsets, including Jabra, Poly, Sennheiser, Logitech, Cisco, etc. If we talking about mute and my first post with 2 input reports in a sequence, the flow you described is not the case, because:

  1. My app answering with Microphone : 1 and Mute: 1 after receiving Phone Mute with value 1 from device.
  2. Delay between 2 input report with mute 1 and mute 0 is very small and it is not possible to send reply after mute 1 and mute 0. Looks like device just sending 2 reports regardless you replied or not.

Different devices form different vendors sometimes behaves differently. The most headache is Logi. Some examples: initial device state: hook-switch:1 Action: Pressing telephony button on device Input reports: hook-switch:1 then hook-switch:0 - Looks like it shows that switching from state 1 to 0 Next initial device state: hook-switch:0 Action: Pressing telephony button on device Input reports: hook-switch:0 then hook-switch:1 - Looks like it shows that switching from state 0 to 1

Most of them sends 2 input reports. Same with mute.

Some Logi's does not reply at all after sending hook-switch or mute (but LED lights are switching on device actually) Is there any way to debug WebHID API communication to understand which behavior is wrong? I'm a bit frustrated about all these things. every vendor has it's communication flow. Jabra, Sennheiser and Cisco doing things much better since the flow is similar and document sent by you helped me a lot. Thank you )