Add new quirk: NO_REQUEST_SENSE

Submit by: Dave Sainty
This commit is contained in:
gehenna 2001-12-22 13:21:59 +00:00
parent 5e2e7b5a79
commit e1839209b8
3 changed files with 36 additions and 5 deletions

View File

@ -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
},

View File

@ -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. */

View File

@ -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 */