linux-usb.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Ben Hoff <hoff.benjamin.k@gmail.com>
To: Krishna Kurapati <krishna.kurapati@oss.qualcomm.com>
Cc: gregkh@linuxfoundation.org, linux-kernel@vger.kernel.org,
	 linux-usb@vger.kernel.org
Subject: Re: [PATCH] usb: gadget: hid: allow dynamic interval configuration via configfs
Date: Tue, 29 Apr 2025 10:11:48 -0400	[thread overview]
Message-ID: <CAMSzxxRfKA0CTi0x_FAohvf8buTJ+eaB-q2+qrnfTd7E6eTwrQ@mail.gmail.com> (raw)
In-Reply-To: <af771944-8236-462f-9097-2bf2336b361c@oss.qualcomm.com>

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@oss.qualcomm.com> wrote:
>
>
>
> On 4/29/2025 7:03 PM, hoff.benjamin.k@gmail.com wrote:
> > From: Ben Hoff <hoff.benjamin.k@gmail.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@gmail.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

      reply	other threads:[~2025-04-29 14:11 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-04-29 13:33 [PATCH] usb: gadget: hid: allow dynamic interval configuration via configfs hoff.benjamin.k
2025-04-29 13:48 ` Greg KH
2025-04-29 13:50 ` Krishna Kurapati
2025-04-29 14:11   ` Ben Hoff [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=CAMSzxxRfKA0CTi0x_FAohvf8buTJ+eaB-q2+qrnfTd7E6eTwrQ@mail.gmail.com \
    --to=hoff.benjamin.k@gmail.com \
    --cc=gregkh@linuxfoundation.org \
    --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;
as well as URLs for NNTP newsgroup(s).