lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <2025042929-activate-easter-77ae@gregkh>
Date: Tue, 29 Apr 2025 20:14:54 +0200
From: Greg KH <gregkh@...uxfoundation.org>
To: hoff.benjamin.k@...il.com
Cc: linux-usb@...r.kernel.org, linux-kernel@...r.kernel.org
Subject: Re: [PATCH v2] usb: gadget: hid: allow dynamic interval
 configuration via configfs

On Tue, Apr 29, 2025 at 02:01:28PM -0400, hoff.benjamin.k@...il.com wrote:
> From: Ben Hoff <hoff.benjamin.k@...il.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

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ