From owner-svn-src-all@FreeBSD.ORG Thu Oct 30 08:17:28 2008 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 623921065676; Thu, 30 Oct 2008 08:17:28 +0000 (UTC) (envelope-from n_hibma@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 515D68FC1D; Thu, 30 Oct 2008 08:17:28 +0000 (UTC) (envelope-from n_hibma@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id m9U8HSOE045477; Thu, 30 Oct 2008 08:17:28 GMT (envelope-from n_hibma@svn.freebsd.org) Received: (from n_hibma@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id m9U8HSKF045476; Thu, 30 Oct 2008 08:17:28 GMT (envelope-from n_hibma@svn.freebsd.org) Message-Id: <200810300817.m9U8HSKF045476@svn.freebsd.org> From: Nick Hibma Date: Thu, 30 Oct 2008 08:17:28 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r184465 - head/sys/dev/usb X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 30 Oct 2008 08:17:28 -0000 Author: n_hibma Date: Thu Oct 30 08:17:27 2008 New Revision: 184465 URL: http://svn.freebsd.org/changeset/base/184465 Log: Bugfix: Check the error code for in progress as well, after starting the transfer. Some changes to improve the debugging experience. Modified: head/sys/dev/usb/u3g.c Modified: head/sys/dev/usb/u3g.c ============================================================================== --- head/sys/dev/usb/u3g.c Thu Oct 30 08:13:49 2008 (r184464) +++ head/sys/dev/usb/u3g.c Thu Oct 30 08:17:27 2008 (r184465) @@ -51,7 +51,7 @@ #endif #include "usbdevs.h" -/* #define U3G_DEBUG */ +//#define U3G_DEBUG #ifdef U3G_DEBUG #define DPRINTF(x...) do { if (u3gdebug) device_printf(sc->sc_dev, ##x); } while (0) int u3gdebug = 1; @@ -483,8 +483,10 @@ u3gstub_scsi_eject(struct u3gstub_softc break; } - if (i == id->bNumEndpoints) + if (i == id->bNumEndpoints) { + DPRINTF("failed to find bulk-out pipe\n"); return 0; + } if (usbd_open_pipe(uaa->iface, ed->bEndpointAddress, USBD_EXCLUSIVE_USE, &sc->sc_pipe) != USBD_NORMAL_COMPLETION) { @@ -501,7 +503,8 @@ u3gstub_scsi_eject(struct u3gstub_softc usbd_setup_xfer(sc->sc_xfer, sc->sc_pipe, NULL, cmd, sizeof(cmd), 0, USBD_DEFAULT_TIMEOUT, NULL); - if (usbd_transfer(sc->sc_xfer) != USBD_NORMAL_COMPLETION) { + int err = usbd_transfer(sc->sc_xfer) != USBD_NORMAL_COMPLETION; + if (err != USBD_NORMAL_COMPLETION && err != USBD_IN_PROGRESS) { DPRINTF("failed to start transfer\n"); return 0; } @@ -545,8 +548,8 @@ u3gstub_match(device_t self) return UMATCH_NONE; if (u3g_dev_type->flags&U3GFL_HUAWEI_INIT - || u3g_dev_type->flags&U3GFL_SIERRA_INIT || u3g_dev_type->flags&U3GFL_SCSI_EJECT + || u3g_dev_type->flags&U3GFL_SIERRA_INIT || u3g_dev_type->flags&U3GFL_STUB_WAIT) { /* We assume that if the first interface is still a mass * storage device the device has not yet changed appearance. @@ -574,9 +577,8 @@ u3gstub_attach(device_t self) sc->sc_dev = self; sc->sc_udev = uaa->device; - if (uaa->iface) - for (i = 0; i < uaa->nifaces; i++) - uaa->ifaces[i] = NULL; // claim all interfaces + for (i = 0; i < uaa->nifaces; i++) + uaa->ifaces[i] = NULL; // claim all interfaces u3g_dev_type = u3g_lookup(uaa->vendor, uaa->product); if (u3g_dev_type->flags&U3GFL_HUAWEI_INIT) { @@ -584,7 +586,7 @@ u3gstub_attach(device_t self) if (!u3gstub_huawei_init(sc, uaa)) return ENXIO; } else if (u3g_dev_type->flags&U3GFL_SCSI_EJECT) { - DPRINTF("sending CD eject command to change to modem mode \n"); + DPRINTF("sending CD eject command to change to modem mode\n"); if (!u3gstub_scsi_eject(sc, uaa)) return ENXIO; } else if (u3g_dev_type->flags&U3GFL_SIERRA_INIT) {