From: Greg KH <gregkh@linuxfoundation.org>
To: hoff.benjamin.k@gmail.com
Cc: linux-usb@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH v2] usb: gadget: hid: allow dynamic interval configuration via configfs
Date: Tue, 29 Apr 2025 20:14:54 +0200 [thread overview]
Message-ID: <2025042929-activate-easter-77ae@gregkh> (raw)
In-Reply-To: <20250429180128.806780-1-hoff.benjamin.k@gmail.com>
On Tue, Apr 29, 2025 at 02:01:28PM -0400, hoff.benjamin.k@gmail.com wrote:
> From: Ben Hoff <hoff.benjamin.k@gmail.com>
>
> This patch enhances the HID gadget driver to support dynamic configuration
> of the interrupt polling interval (bInterval) via configfs. A new
> ‘interval’ attribute is exposed under each HID function’s configfs
> directory, and any write to it will adjust the poll rate for all endpoints
> without requiring a rebuild.
>
> When the attribute has never been written, legacy defaults are preserved:
> • Full-Speed (FS) endpoints (IN & OUT) poll every 10 ms
> • High-Speed (HS) endpoints (IN & OUT) poll every 4 micro-frames
> (~1 ms)
>
> To implement this cleanly:
> • Add two new fields to f_hid_opts and f_hidg:
> – unsigned char interval
> – bool interval_user_set
> • Introduce dedicated f_hid_opts_interval_show/store functions.
> The store routine parses into an unsigned int, bounds‐checks against
> UCHAR_MAX, assigns to opts->interval, and sets
> opts->interval_user_set = true.
> • Remove the string-compare hack from the generic F_HID_OPT macro.
> • Initialize opts->interval = 4 and opts->interval_user_set = false in
> hidg_alloc_inst(), then copy both into the live f_hidg instance in
> hidg_alloc().
> • In hidg_bind(), set each endpoint’s bInterval based on whether the
> user has written the attribute:
> – If interval_user_set == false, use FS=10 / HS=4
> – If interval_user_set == true, use the user’s value for both FS
> & HS
> • Add <limits.h> to support UCHAR_MAX in the store helper.
>
> Changes since v1:
> - Added dedicated interval_show/store helpers instead of macro hack.
> - Restored original default values (FS=10 ms, HS=4 µ-frame) for both
> IN and OUT when unset.
The "changes" stuff goes below the --- line as per the documentation, as
that's not needed in the changelog.
Send a v3?
thanks,
greg k-h
prev parent reply other threads:[~2025-04-29 18:16 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-04-29 18:01 [PATCH v2] usb: gadget: hid: allow dynamic interval configuration via configfs hoff.benjamin.k
2025-04-29 18:14 ` Greg KH [this message]
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=2025042929-activate-easter-77ae@gregkh \
--to=gregkh@linuxfoundation.org \
--cc=hoff.benjamin.k@gmail.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