Commit 7f58b414 authored by John Keeping's avatar John Keeping Committed by Greg Kroah-Hartman
Browse files

usb: gadget: f_hid: fix SuperSpeed descriptors



When adding dynamic configuration for bInterval, the value was removed
from the static SuperSpeed endpoint descriptors but was not set from the
configured value in hidg_bind().  Thus at SuperSpeed the interrupt
endpoints have bInterval as zero which is not valid per the USB
specification.

Add the missing setting for SuperSpeed endpoints.

Fixes: ea34925f ("usb: gadget: hid: allow dynamic interval configuration via configfs")
Cc: stable <stable@kernel.org>
Signed-off-by: default avatarJohn Keeping <jkeeping@inmusicbrands.com>
Acked-by: default avatarPeter Korsgaard <peter@korsgaard.com>
Link: https://patch.msgid.link/20260227111540.431521-1-jkeeping@inmusicbrands.com


Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 9f6a983c
Loading
Loading
Loading
Loading
+4 −0
Original line number Diff line number Diff line
@@ -1207,9 +1207,11 @@ static int hidg_bind(struct usb_configuration *c, struct usb_function *f)
	if (!hidg->interval_user_set) {
		hidg_fs_in_ep_desc.bInterval = 10;
		hidg_hs_in_ep_desc.bInterval = 4;
		hidg_ss_in_ep_desc.bInterval = 4;
	} else {
		hidg_fs_in_ep_desc.bInterval = hidg->interval;
		hidg_hs_in_ep_desc.bInterval = hidg->interval;
		hidg_ss_in_ep_desc.bInterval = hidg->interval;
	}

	hidg_ss_out_comp_desc.wBytesPerInterval =
@@ -1239,9 +1241,11 @@ static int hidg_bind(struct usb_configuration *c, struct usb_function *f)
		if (!hidg->interval_user_set) {
			hidg_fs_out_ep_desc.bInterval = 10;
			hidg_hs_out_ep_desc.bInterval = 4;
			hidg_ss_out_ep_desc.bInterval = 4;
		} else {
			hidg_fs_out_ep_desc.bInterval = hidg->interval;
			hidg_hs_out_ep_desc.bInterval = hidg->interval;
			hidg_ss_out_ep_desc.bInterval = hidg->interval;
		}
		status = usb_assign_descriptors(f,
			    hidg_fs_descriptors_intout,