Linux USB
 help / color / mirror / Atom feed
From: Arthur Crepin Leblond <arthur@marmottus.net>
To: linux-usb@vger.kernel.org
Cc: Krishna Kurapati <krishna.kurapati@oss.qualcomm.com>,
	 Ben Hoff <hoff.benjamin.k@gmail.com>,
	 Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	 linux-kernel@vger.kernel.org,
	Arthur Crepin Leblond <arthur@marmottus.net>
Subject: [PATCH v4 0/2] usb: gadget: f_hid: allow setting different interval for each speed
Date: Mon, 31 Aug 2026 15:57:21 +0200	[thread overview]
Message-ID: <20260831-usb_hid_interval-v4-0-609394103dcb@marmottus.net> (raw)

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@marmottus.net>
---
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@marmottus.net

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

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@marmottus.net
---
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(-)


             reply	other threads:[~2026-08-31 13:58 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-08-31 13:57 Arthur Crepin Leblond [this message]
2026-08-31 13:57 ` [PATCH v4 1/2] usb: gadget: f_hid: allow setting different interval for each speed Arthur Crepin Leblond
2026-08-31 13:57 ` [PATCH v4 2/2] docs: ABI: testing: document hid interval attributes Arthur Crepin Leblond

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20260831-usb_hid_interval-v4-0-609394103dcb@marmottus.net \
    --to=arthur@marmottus.net \
    --cc=gregkh@linuxfoundation.org \
    --cc=hoff.benjamin.k@gmail.com \
    --cc=krishna.kurapati@oss.qualcomm.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-usb@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox