[PATCH v4 0/2] usb: gadget: f_hid: allow setting different interval for each speed

From: Arthur Crepin Leblond

Date: Mon Aug 31 2026 - 13:10:15 EST


Hi,

I am using the HID USB gadget on a system that can be plugged in to
different machines with different USB speeds (high or full).

Since the HID polling interval unit depends on the USB speed:
- Full speed: the units are in milliseconds
- High/Super speed: the units are in micro-frames of 0.125ms

Exposing directly the bInterval means that I would need to know
which speed is currently in use and have to convert it accordingly.

I propose a solution to to expose the interval for each speed:
- interval_fs: bInterval for full-speed
- interval_hs: bInterval for high-speed
- interval_ss: bInterval for super-speed
- interval: legacy attribute that takes precedence over the per-speed
attributes and sets the same bInterval for each speed to keep backward
compatibility.

Thank you for your reviews!

Arthur Crepin Leblond

Signed-off-by: Arthur Crepin Leblond <arthur@xxxxxxxxxxxxx>
---
Changes in v4:
- Update documentation against 7.4
- Removed unused struct f_hidg::interval
- Edit cover letter
- Link to v3: https://patch.msgid.link/20260804-usb_hid_interval-v3-1-975a9fec2d7b@xxxxxxxxxxxxx

Changes in v3:
- Use sysfs_emit
- Link to v2: https://patch.msgid.link/20260727152705.79384-1-arthur@xxxxxxxxxxxxx

Changes in v2:
- Expose a specific interval attribute per USB speed
- Use a define for the default values
- Update ABI documentation
- Link to v1: https://patch.msgid.link/20260716144921.1120265-1-arthur@xxxxxxxxxxxxx
---
Arthur Crepin Leblond (2):
usb: gadget: f_hid: allow setting different interval for each speed
docs: ABI: testing: document hid interval attributes

Documentation/ABI/testing/configfs-usb-gadget-hid | 18 ++
drivers/usb/gadget/function/f_hid.c | 194 +++++++++++++---------
drivers/usb/gadget/function/u_hid.h | 9 +-
3 files changed, 143 insertions(+), 78 deletions(-)