summaryrefslogtreecommitdiffstats
path: root/sys/dev/usb
diff options
context:
space:
mode:
authorn_hibma <n_hibma@FreeBSD.org>2008-10-30 08:17:27 +0000
committern_hibma <n_hibma@FreeBSD.org>2008-10-30 08:17:27 +0000
commit44ed6d08339327fda6dbc63350b4acffd14a24f4 (patch)
tree7e4d637f71b9757ea79193870648819ccb936768 /sys/dev/usb
parent01935a18635c64776b6cc431956c024f5cfcecce (diff)
downloadFreeBSD-src-44ed6d08339327fda6dbc63350b4acffd14a24f4.zip
FreeBSD-src-44ed6d08339327fda6dbc63350b4acffd14a24f4.tar.gz
Bugfix: Check the error code for in progress as well, after starting the
transfer. Some changes to improve the debugging experience.
Diffstat (limited to 'sys/dev/usb')
-rw-r--r--sys/dev/usb/u3g.c18
1 files changed, 10 insertions, 8 deletions
diff --git a/sys/dev/usb/u3g.c b/sys/dev/usb/u3g.c
index 8a25e1b..320e740 100644
--- a/sys/dev/usb/u3g.c
+++ b/sys/dev/usb/u3g.c
@@ -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 *sc, struct usb_attach_arg *uaa)
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 *sc, struct usb_attach_arg *uaa)
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) {
OpenPOWER on IntegriCloud