Author Topic: Windows polls unused USB HID?  (Read 9429 times)

Renate

  • Frequent Contributor
  • ****
  • Posts: 97
Windows polls unused USB HID?
« on: September 24, 2019, 01:13:02 pm »
I have an ATMega32u4 as an HID.
It takes commands on an interrupt endpoint.
It provides a realtime status out on an interrupt endpoint with a bInterval of 16.
It works perfectly when connected to a Windows app or an Android app.
No complaints there.

To double check polling on the in endpoint (and how bInterval got rounded),
I added some test code to the ATMega to toggle a test point when the in endpoint got loaded.
I saw what I expected: bInterval=10, poll=8, bInterval=16, poll=16.

But... On the Android when the the Android app was not running there was no polling.
On the Windows when the Windows app was not running there was still polling going on.
I don't have a Linux app, but I connected it to a RPi and polling went on when I cat /dev/hidraw0 and goes off when I ^C.
Ok, this does not really have anything to do with the USB standard exactly.
It's more of a question of whether a host should leave USB devices alone if the user is not using them.

Has anybody seen this sort of stuff or have an explanation?
I guess that MS wants to keep HID input buffers full in case somebody might want to use it.
« Last Edit: September 24, 2019, 01:15:58 pm by Renate »

Jan Axelson

  • Administrator
  • Frequent Contributor
  • *****
  • Posts: 3033
    • Lakeview Research
Re: Windows polls unused USB HID?
« Reply #1 on: September 24, 2019, 08:42:55 pm »
Yes, the Windows HID driver polls the interrupt IN input whether or not an application has opened a handle to the HID. The specs don't forbid or require doing so. The only downside is that it can use bandwidth unnecessarily. For system devices like keyboards of course, the host needs to poll continuously.