Re: Data toggles not reset on "set configuration" for ports handled by "xhci_hcd" driver

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 24.8.2020 16.48, Mathias Nyman wrote:
> 
> Looks like libusb set_configuration could end up calling usb_reset_configuration() instead.
> If there are no changes it's possible usb_hcd_alloc_bandwidth() never gets called, and
> toggles never reset.
> 
> see drivers/usb/core/devio.c proc_setconfig()  
> 

Can you try the code below? It should force dropping and adding the endpoints
for the intrface(s) of that configuration, and xhci should reset the toggles.

Completely untested, it compiles :)

diff --git a/drivers/usb/core/message.c b/drivers/usb/core/message.c
index 6197938dcc2d..4a1439b29918 100644
--- a/drivers/usb/core/message.c
+++ b/drivers/usb/core/message.c
@@ -1554,19 +1554,9 @@ int usb_reset_configuration(struct usb_device *dev)
 		return -ENOMEM;
 	}
 	/* Make sure we have enough bandwidth for each alternate setting 0 */
-	for (i = 0; i < config->desc.bNumInterfaces; i++) {
-		struct usb_interface *intf = config->interface[i];
-		struct usb_host_interface *alt;
+	 /* TEST, drop and re-add endpoints to clear toggle */
+	retval = usb_hcd_alloc_bandwidth(dev, config, NULL, NULL);
 
-		alt = usb_altnum_to_altsetting(intf, 0);
-		if (!alt)
-			alt = &intf->altsetting[0];
-		if (alt != intf->cur_altsetting)
-			retval = usb_hcd_alloc_bandwidth(dev, NULL,
-					intf->cur_altsetting, alt);
-		if (retval < 0)
-			break;
-	}
 	/* If not, reinstate the old alternate settings */
 	if (retval < 0) {
 reset_old_alts:



[Index of Archives]     [Linux Media]     [Linux Input]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [Old Linux USB Devel Archive]

  Powered by Linux