On 1/4/19 11:46 AM, Matthias Apitz wrote:
Jan  4 11:26:39 c720-r342378 kernel: uhub_read_port_status: port 13, 
wPortStatus=0x07a0, wPortChange=0x0000, err=USB_ERR_NORMAL_COMPLETION
Jan  4 11:26:41 c720-r342378 kernel: uhub_read_port_status: port 1, 
wPortStatus=0xe070, wPortChange=0x161e, err=USB_ERR_TIMEOUT
Jan  4 11:26:41 c720-r342378 kernel: uhub_read_port_status: port 2, 
wPortStatus=0x0500, wPortChange=0x0000, err=USB_ERR_NORMAL_COMPLETION

Hi,

The problem appears to be that one of the USB HUBs port status request don't respond: USB_ERR_TIMEOUT, which in turn blocks the enumeration thread.

Can you try the attached kernel patch and send new debug log?

--HPS
Index: sys/dev/usb/usb_hub.c
===================================================================
--- sys/dev/usb/usb_hub.c	(revision 342455)
+++ sys/dev/usb/usb_hub.c	(working copy)
@@ -590,11 +590,23 @@
 	err = usbd_req_get_port_status(
 	    sc->sc_udev, NULL, &ps, portno);
 
-	/* update status regardless of error */
+	if (err != 0) {
+		DPRINTFN(4, "port %d, Trying again, err=%s\n",
+		   portno, usbd_errstr(err));
 
-	sc->sc_st.port_status = UGETW(ps.wPortStatus);
-	sc->sc_st.port_change = UGETW(ps.wPortChange);
+		/* try a second time before giving up */
+		err = usbd_req_get_port_status(
+		    sc->sc_udev, NULL, &ps, portno);
+	}
 
+	if (err == 0) {
+		sc->sc_st.port_status = UGETW(ps.wPortStatus);
+		sc->sc_st.port_change = UGETW(ps.wPortChange);
+	} else {
+		sc->sc_st.port_status = 0;
+		sc->sc_st.port_change = 0;
+	}
+
 	/* debugging print */
 
 	DPRINTFN(4, "port %d, wPortStatus=0x%04x, "
Index: sys/dev/usb/usb_request.c
===================================================================
--- sys/dev/usb/usb_request.c	(revision 342455)
+++ sys/dev/usb/usb_request.c	(working copy)
@@ -1601,8 +1601,9 @@
 	USETW(req.wValue, 0);
 	req.wIndex[0] = port;
 	req.wIndex[1] = 0;
-	USETW(req.wLength, sizeof *ps);
-	return (usbd_do_request(udev, mtx, &req, ps));
+	USETW(req.wLength, sizeof(*ps));
+
+	return (usbd_do_request_flags(udev, mtx, &req, ps, 0, NULL, 1000));
 }
 
 /*------------------------------------------------------------------------*
_______________________________________________
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