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