On 2019-07-29 10:37, Mariappan N wrote:
Hi HPS,

Attached the USB analyzer trace for Garmin and other working device connected 
to XHCI. Please download from the following link.

<https://www.dropbox.com/s/prnlpc1uiucpu3b/xhci_usb_working.ufo?dl=0>
https://www.dropbox.com/sh/jkw2zns9l857e4v/AACp7r3dGjR-r9Vfy9KDmzZ6a?dl=0


Hi,

Basically the Garmin doesn't respond to status stage of the set address message, which is a clear USB specification violation. I wonder if doing a bus-reset right before the set-address, like in the other trace, will cause the device to recover. Can you make a new trace with the attached patch?

--HPS
Index: sys/dev/usb/controller/xhci.c
===================================================================
--- sys/dev/usb/controller/xhci.c	(revision 349802)
+++ sys/dev/usb/controller/xhci.c	(working copy)
@@ -165,6 +165,7 @@
 #ifdef USB_DEBUG
 static uint64_t xhci_ctx_get_le64(struct xhci_softc *sc, volatile uint64_t *ptr);
 #endif
+static usb_error_t xhci_cmd_reset_dev(struct xhci_softc *, uint8_t slot_id);
 
 static const struct usb_bus_methods xhci_bus_methods;
 
@@ -1457,7 +1458,14 @@
 		err = xhci_cmd_set_address(sc, buf_inp.physaddr,
 		    (address == 0), index);
 
-		if (err != 0) {
+		/* upon failure, try resetting the device before setting the address */
+		if (err != 0 && address != 0) {
+			err = xhci_cmd_reset_dev(sc, index);
+			if (err == 0)
+				err = xhci_cmd_set_address(sc, buf_inp.physaddr, 0, index);
+			if (err != 0)
+				break;
+		} else if (err != 0) {
 			temp = le32toh(sc->sc_cmd_result[0]);
 			if (address == 0 && sc->sc_port_route != NULL &&
 			    XHCI_TRB_2_ERROR_GET(temp) ==
_______________________________________________
freebsd-usb@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/freebsd-usb
To unsubscribe, send any mail to "freebsd-usb-unsubscr...@freebsd.org"

Reply via email to