[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <CAMSzxxRfKA0CTi0x_FAohvf8buTJ+eaB-q2+qrnfTd7E6eTwrQ@mail.gmail.com>
Date: Tue, 29 Apr 2025 10:11:48 -0400
From: Ben Hoff <hoff.benjamin.k@...il.com>
To: Krishna Kurapati <krishna.kurapati@....qualcomm.com>
Cc: gregkh@...uxfoundation.org, linux-kernel@...r.kernel.org,
linux-usb@...r.kernel.org
Subject: Re: [PATCH] usb: gadget: hid: allow dynamic interval configuration
via configfs
Hi Greg, Krishna,
Thanks for the feedback!
You're right — I should not have changed the default bInterval from 4
to 10 for all endpoints.
To preserve the original behavior, I'll resend a v2 patch that:
- Sets the global default bInterval to 4 frames, matching the existing
implementation.
- Leaves the High-Speed interrupt-out endpoints
(hidg_hs_descriptors_intout) at their historic 10-frame default unless
explicitly overridden through configfs.
Thanks again for reviewing this — I'll send an updated patch shortly.
Ben
On Tue, Apr 29, 2025 at 9:50 AM Krishna Kurapati
<krishna.kurapati@....qualcomm.com> wrote:
>
>
>
> On 4/29/2025 7:03 PM, hoff.benjamin.k@...il.com wrote:
> > From: Ben Hoff <hoff.benjamin.k@...il.com>
> >
> > This patch adds support for dynamically configuring the polling interval
> > (bInterval) for HID function drivers using configfs. This enables
> > custom HID gadgets with user-specified poll rates without recompilation.
> >
> > Signed-off-by: Ben Hoff <hoff.benjamin.k@...il.com>
> > ---
> > drivers/usb/gadget/function/f_hid.c | 54 ++++++++++++++---------------
> > drivers/usb/gadget/function/u_hid.h | 1 +
> > 2 files changed, 27 insertions(+), 28 deletions(-)
> >
>
> [...]
>
> > @@ -1468,6 +1462,9 @@ static struct usb_function_instance *hidg_alloc_inst(void)
> > if (!opts)
> > return ERR_PTR(-ENOMEM);
> > mutex_init(&opts->lock);
> > +
> > + opts->interval = 10;
> > +
>
> The default value was 10 only for hidg_hs_descriptors_intout.
> Aren't we now making it 10 for all other ep descriptors as well ?
>
> Regards,
> Krishna,
>
> > opts->func_inst.free_func_inst = hidg_free_inst;
> > ret = &opts->func_inst;
> >
> > @@ -1546,6 +1543,7 @@ static struct usb_function *hidg_alloc(struct usb_function_instance *fi)
> > hidg->bInterfaceProtocol = opts->protocol;
> > hidg->report_length = opts->report_length;
> > hidg->report_desc_length = opts->report_desc_length;
> > + hidg->interval = opts->interval;
> > if (opts->report_desc) {
> > hidg->report_desc = kmemdup(opts->report_desc,
> > opts->report_desc_length,
> > diff --git a/drivers/usb/gadget/function/u_hid.h b/drivers/usb/gadget/function/u_hid.h
> > index 84bb70292855..a29dcb14f738 100644
> > --- a/drivers/usb/gadget/function/u_hid.h
> > +++ b/drivers/usb/gadget/function/u_hid.h
> > @@ -25,6 +25,7 @@ struct f_hid_opts {
> > unsigned short report_desc_length;
> > unsigned char *report_desc;
> > bool report_desc_alloc;
> > + unsigned char interval;
> >
> > /*
> > * Protect the data form concurrent access by read/write
Powered by blists - more mailing lists