summaryrefslogtreecommitdiff
path: root/sys/dev
diff options
context:
space:
mode:
authorgehenna <gehenna@NetBSD.org>2001-12-22 13:21:59 +0000
committergehenna <gehenna@NetBSD.org>2001-12-22 13:21:59 +0000
commite1839209b80cf41224ebad0076a28c902c3eb9e6 (patch)
tree9a608f8ea69a65eeb4efc0fbbfb5456d43eb8733 /sys/dev
parent5e2e7b5a79feea8f3e31af10eecd5e372c8c55e3 (diff)
Add new quirk: NO_REQUEST_SENSE
Submit by: Dave Sainty
Diffstat (limited to 'sys/dev')
-rw-r--r--sys/dev/usb/umass_quirks.c5
-rw-r--r--sys/dev/usb/umassbus.c33
-rw-r--r--sys/dev/usb/umassvar.h3
3 files changed, 36 insertions, 5 deletions
diff --git a/sys/dev/usb/umass_quirks.c b/sys/dev/usb/umass_quirks.c
index 4c577aa9262..75a7531b978 100644
--- a/sys/dev/usb/umass_quirks.c
+++ b/sys/dev/usb/umass_quirks.c
@@ -1,4 +1,4 @@
-/* $NetBSD: umass_quirks.c,v 1.1 2001/12/17 12:16:15 gehenna Exp $ */
+/* $NetBSD: umass_quirks.c,v 1.2 2001/12/22 13:21:59 gehenna Exp $ */
/*
* Copyright (c) 2001 The NetBSD Foundation, Inc.
@@ -60,7 +60,8 @@ Static void umass_fixup_yedata(struct umass_softc *);
Static const struct umass_quirk umass_quirks[] = {
{ { USB_VENDOR_FUJIPHOTO, USB_PRODUCT_FUJIPHOTO_MASS0100 },
UMASS_WPROTO_UNSPEC, UMASS_CPROTO_UNSPEC,
- UMASS_QUIRK_NO_TEST_UNIT_READY | UMASS_QUIRK_NO_START_STOP,
+ UMASS_QUIRK_NO_TEST_UNIT_READY | UMASS_QUIRK_NO_START_STOP |
+ UMASS_QUIRK_NO_REQUEST_SENSE,
UMATCH_DEVCLASS_DEVSUBCLASS_DEVPROTO,
NULL, NULL
},
diff --git a/sys/dev/usb/umassbus.c b/sys/dev/usb/umassbus.c
index 5790465e27c..96ef750a6eb 100644
--- a/sys/dev/usb/umassbus.c
+++ b/sys/dev/usb/umassbus.c
@@ -1,4 +1,4 @@
-/* $NetBSD: umassbus.c,v 1.17 2001/12/17 12:16:15 gehenna Exp $ */
+/* $NetBSD: umassbus.c,v 1.18 2001/12/22 13:21:59 gehenna Exp $ */
/*
* Copyright (c) 2001 The NetBSD Foundation, Inc.
@@ -38,7 +38,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: umassbus.c,v 1.17 2001/12/17 12:16:15 gehenna Exp $");
+__KERNEL_RCSID(0, "$NetBSD: umassbus.c,v 1.18 2001/12/22 13:21:59 gehenna Exp $");
#include "atapibus.h"
#include "scsibus.h"
@@ -149,6 +149,8 @@ umass_attach_bus(struct umass_softc *sc)
if (sc->sc_quirks & UMASS_QUIRK_NO_TEST_UNIT_READY)
sc->bus.sc_channel.chan_defquirks |= PQUIRK_NOTUR;
+ if (sc->sc_quirks & UMASS_QUIRK_NO_REQUEST_SENSE)
+ sc->bus.sc_channel.chan_defquirks |= PQUIRK_NOSENSE;
DPRINTF(UDMASS_USB, ("%s: umass_attach_bus: ATAPI\n",
USBDEVNAME(sc->sc_dev)));
sc->bus.sc_child =
@@ -459,6 +461,32 @@ umass_scsipi_cb(struct umass_softc *sc, void *priv, int residue, int status)
break;
case STATUS_CMD_UNKNOWN:
+ /* we can't issue REQUEST SENSE */
+ if (xs->xs_periph->periph_quirks & PQUIRK_NOSENSE) {
+ /*
+ * If no residue and no other USB error,
+ * command succeeded.
+ */
+ if (residue == 0) {
+ xs->error = XS_NOERROR;
+ break;
+ }
+
+ /*
+ * Some devices return a short INQUIRY
+ * response, omitting response data from the
+ * "vendor specific data" on...
+ */
+ if (xs->cmd->opcode == INQUIRY &&
+ residue < xs->datalen) {
+ xs->error = XS_NOERROR;
+ break;
+ }
+
+ xs->error = XS_DRIVER_STUFFUP;
+ break;
+ }
+ /* FALLTHROUGH */
case STATUS_CMD_FAILED:
/* fetch sense data */
memset(&sc->bus.sc_sense_cmd, 0, sizeof(sc->bus.sc_sense_cmd));
@@ -577,6 +605,7 @@ umass_atapi_probe_device(struct atapibus_softc *atapi, int target)
periph->periph_channel = chan;
periph->periph_switch = &atapi_probe_periphsw;
periph->periph_target = target;
+ periph->periph_quirks = chan->chan_defquirks;
DPRINTF(UDMASS_SCSI, ("umass_atapi_probe_device: doing inquiry\n"));
/* Now go ask the device all about itself. */
diff --git a/sys/dev/usb/umassvar.h b/sys/dev/usb/umassvar.h
index f2cf207b4da..3f9de859b91 100644
--- a/sys/dev/usb/umassvar.h
+++ b/sys/dev/usb/umassvar.h
@@ -1,4 +1,4 @@
-/* $NetBSD: umassvar.h,v 1.9 2001/12/17 12:16:15 gehenna Exp $ */
+/* $NetBSD: umassvar.h,v 1.10 2001/12/22 13:21:59 gehenna Exp $ */
/*-
* Copyright (c) 1999 MAEKAWA Masahide <bishop@rr.iij4u.or.jp>,
* Nick Hibma <n_hibma@freebsd.org>
@@ -185,6 +185,7 @@ struct umass_softc {
#define UMASS_QUIRK_NO_START_STOP 0x00000004
#define UMASS_QUIRK_FORCE_SHORT_INQUIRY 0x00000008
#define UMASS_QUIRK_WRONG_CSWSIG 0x00000010
+#define UMASS_QUIRK_NO_REQUEST_SENSE 0x00000020
/* Bulk specific variables for transfers in progress */
umass_bbb_cbw_t cbw; /* command block wrapper */