From owner-p4-projects@FreeBSD.ORG Tue Nov 4 16:26:17 2008 Return-Path: Delivered-To: p4-projects@freebsd.org Received: by hub.freebsd.org (Postfix, from userid 32767) id 1FCAC1065674; Tue, 4 Nov 2008 16:26:17 +0000 (UTC) Delivered-To: perforce@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id D78701065679 for ; Tue, 4 Nov 2008 16:26:16 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repoman.freebsd.org (repoman.freebsd.org [IPv6:2001:4f8:fff6::29]) by mx1.freebsd.org (Postfix) with ESMTP id C51788FC1B for ; Tue, 4 Nov 2008 16:26:16 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repoman.freebsd.org (localhost [127.0.0.1]) by repoman.freebsd.org (8.14.3/8.14.3) with ESMTP id mA4GQGax015191 for ; Tue, 4 Nov 2008 16:26:16 GMT (envelope-from hselasky@FreeBSD.org) Received: (from perforce@localhost) by repoman.freebsd.org (8.14.3/8.14.3/Submit) id mA4GQGLm015189 for perforce@freebsd.org; Tue, 4 Nov 2008 16:26:16 GMT (envelope-from hselasky@FreeBSD.org) Date: Tue, 4 Nov 2008 16:26:16 GMT Message-Id: <200811041626.mA4GQGLm015189@repoman.freebsd.org> X-Authentication-Warning: repoman.freebsd.org: perforce set sender to hselasky@FreeBSD.org using -f From: Hans Petter Selasky To: Perforce Change Reviews Cc: Subject: PERFORCE change 152460 for review X-BeenThere: p4-projects@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: p4 projects tree changes List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 04 Nov 2008 16:26:17 -0000 http://perforce.freebsd.org/chv.cgi?CH=152460 Change 152460 by hselasky@hselasky_laptop001 on 2008/11/04 16:26:06 Some USB HUBs do not generate an initial port connection change event. Check the initial USB port status by default. Affected files ... .. //depot/projects/usb/src/sys/dev/usb2/core/usb2_hub.c#18 edit Differences ... ==== //depot/projects/usb/src/sys/dev/usb2/core/usb2_hub.c#18 (text+ko) ==== @@ -72,6 +72,7 @@ struct usb2_device *sc_udev; /* USB device */ struct usb2_xfer *sc_xfer[2]; /* interrupt xfer */ uint8_t sc_flags; +#define UHUB_FLAG_DID_EXPLORE 0x01 #define UHUB_FLAG_INTR_STALL 0x02 char sc_name[32]; }; @@ -511,6 +512,14 @@ /* most likely the HUB is gone */ break; } + if (!(sc->sc_flags & UHUB_FLAG_DID_EXPLORE)) { + /* + * Fake a connect status change so that the + * status gets checked initially! + */ + sc->sc_st.port_change |= + UPS_C_CONNECT_STATUS; + } if (sc->sc_st.port_change & UPS_C_PORT_ENABLED) { err = usb2_req_clear_port_feature( udev, &Giant, portno, UHF_C_PORT_ENABLE); @@ -533,7 +542,8 @@ DPRINTFN(0, "port error, giving up " "port %d\n", portno); } else { - sc->sc_st.port_change |= UPS_C_CONNECT_STATUS; + sc->sc_st.port_change |= + UPS_C_CONNECT_STATUS; up->restartcnt++; } } @@ -560,6 +570,11 @@ /* explore succeeded - reset restart counter */ up->restartcnt = 0; } + + /* initial status checked */ + sc->sc_flags |= UHUB_FLAG_DID_EXPLORE; + + /* return success */ return (USB_ERR_NORMAL_COMPLETION); }