mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Krishna Kurapati <krishna.kurapati@oss.qualcomm.com>
To: hoff.benjamin.k@gmail.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 19:20:18 +0530	[thread overview]
Message-ID: <af771944-8236-462f-9097-2bf2336b361c@oss.qualcomm.com> (raw)
In-Reply-To: <20250429133310.353977-1-hoff.benjamin.k@gmail.com>



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

  parent reply	other threads:[~2025-04-29 13:50 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-04-29 13:33 hoff.benjamin.k
2025-04-29 13:48 ` Greg KH
2025-04-29 13:50 ` Krishna Kurapati [this message]
2025-04-29 14:11   ` Ben Hoff

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=af771944-8236-462f-9097-2bf2336b361c@oss.qualcomm.com \
    --to=krishna.kurapati@oss.qualcomm.com \
    --cc=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

all inboxes | Powered by JetHome®