Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 29 Jul 2019 11:44:31 +0200
From:      Hans Petter Selasky <hps@selasky.org>
To:        Mariappan N <nmarijoe@outlook.com>, "freebsd-usb@freebsd.org" <freebsd-usb@freebsd.org>
Subject:   Re: Problem attaching USB Garmin device
Message-ID:  <2f317631-7e92-6fcc-7061-ae098ce99a68@selasky.org>
In-Reply-To: <MAXPR01MB2944810CD093ED926AC0FBE7C5DD0@MAXPR01MB2944.INDPRD01.PROD.OUTLOOK.COM>
References:  <MAXPR01MB2944036F77333AE51E8EE717C5C10@MAXPR01MB2944.INDPRD01.PROD.OUTLOOK.COM> <20701523-c2e3-e184-b695-ecd6dfed639b@selasky.org> <MAXPR01MB29449BB16DCD455AAB055C99C5C00@MAXPR01MB2944.INDPRD01.PROD.OUTLOOK.COM> <d0e0e473-969d-cee1-b591-5513b935a560@selasky.org> <a0b1c069-0716-3405-0ad2-a09c6cc62c07@selasky.org> <4aaaaadf-cf6b-8dc6-62a8-d4a577d19691@selasky.org> <MAXPR01MB2944063272F35B324622BDF9C5C00@MAXPR01MB2944.INDPRD01.PROD.OUTLOOK.COM> <c19c35e1-e1c0-4ea7-d076-8e9eb5a02e3d@selasky.org> <dc939281-1716-b839-2726-b69aea39ebf4@selasky.org> <MAXPR01MB2944169058EDDE7A7F55BB4AC5C20@MAXPR01MB2944.INDPRD01.PROD.OUTLOOK.COM> <MAXPR01MB2944810CD093ED926AC0FBE7C5DD0@MAXPR01MB2944.INDPRD01.PROD.OUTLOOK.COM>

next in thread | previous in thread | raw e-mail | index | archive | help
This is a multi-part message in MIME format.
--------------ABD72E887FFD97DC44F9B1CD
Content-Type: text/plain; charset=utf-8; format=flowed
Content-Transfer-Encoding: 7bit

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

--------------ABD72E887FFD97DC44F9B1CD
Content-Type: text/x-patch;
 name="xhci.diff"
Content-Transfer-Encoding: 7bit
Content-Disposition: attachment;
 filename="xhci.diff"

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) ==

--------------ABD72E887FFD97DC44F9B1CD--



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?2f317631-7e92-6fcc-7061-ae098ce99a68>