FreeBSD Bugzilla – Attachment 233659 Details for
Bug 262882
USB disconnects repeatedly, losing all attached devices on that USB hub
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
Remember
[x]
|
Forgot Password
Login:
[x]
[patch]
Patch to test
a.diff (text/plain), 1.60 KB, created by
Hans Petter Selasky
on 2022-05-02 12:49:51 UTC
(
hide
)
Description:
Patch to test
Filename:
MIME Type:
Creator:
Hans Petter Selasky
Created:
2022-05-02 12:49:51 UTC
Size:
1.60 KB
patch
obsolete
>diff --git a/sys/dev/usb/usb_hub.c b/sys/dev/usb/usb_hub.c >index 1e5427a8bdd..89c4cc41971 100644 >--- a/sys/dev/usb/usb_hub.c >+++ b/sys/dev/usb/usb_hub.c >@@ -560,6 +560,7 @@ static usb_error_t > uhub_read_port_status(struct uhub_softc *sc, uint8_t portno) > { > struct usb_port_status ps; >+ uint16_t delta; > usb_error_t err; > > if (sc->sc_usb_port_errors >= UHUB_USB_PORT_ERRORS_MAX) { >@@ -569,13 +570,35 @@ uhub_read_port_status(struct uhub_softc *sc, uint8_t portno) > return (USB_ERR_TIMEOUT); > } > >- err = usbd_req_get_port_status( >- sc->sc_udev, NULL, &ps, portno); >- >+ err = usbd_req_get_port_status(sc->sc_udev, NULL, &ps, portno); > if (err == 0) { >+ if (sc->sc_usb_port_errors == 0) { >+ delta = sc->sc_st.port_status ^ >+ UGETW(ps.wPortStatus); >+ delta &= (UPS_CURRENT_CONNECT_STATUS | >+ UPS_PORT_ENABLED); >+ } else { >+ delta = 0; >+ sc->sc_usb_port_errors = 0; >+ } >+ > sc->sc_st.port_status = UGETW(ps.wPortStatus); > sc->sc_st.port_change = UGETW(ps.wPortChange); >- sc->sc_usb_port_errors = 0; >+ >+ /* Assert identical change and status bits: */ >+ CTASSERT(UPS_C_PORT_ENABLED == UPS_PORT_ENABLED); >+ CTASSERT(UPS_C_CONNECT_STATUS == UPS_CURRENT_CONNECT_STATUS); >+ >+ /* >+ * Make sure change and enable port events don't get >+ * lost by tracking some port status bits in >+ * software. Apparently this can happen during startup >+ * on some USB HUBs. >+ */ >+ if (delta & ~sc->sc_st.port_change) { >+ DPRINTFN(4, "port %d, missing status change, 0x%04x!\n", portno, delta); >+ sc->sc_st.port_change |= delta; >+ } > } else { > sc->sc_st.port_status = 0; > sc->sc_st.port_change = 0;
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 262882
:
232775
|
232776
|
232856
|
232857
|
232880
|
232881
|
232882
|
233314
|
233622
|
233623
|
233625
|
233647
|
233659
|
233669
|
233691
|
233692
|
233705