diff options
author | Kenneth R Westerback <krw@cvs.openbsd.org> | 2005-04-28 00:12:56 +0000 |
---|---|---|
committer | Kenneth R Westerback <krw@cvs.openbsd.org> | 2005-04-28 00:12:56 +0000 |
commit | 502930e15d0d559ab16e6d64ae222009e95401a3 (patch) | |
tree | 4d38da87c34bc7b6430b6d357c500f336e19a1d8 /sys | |
parent | 03832ae83bfefc3dd374b7f4dfccea32b5c66746 (diff) |
Some really braindead usb devices such as x-in-1 card reader/writers
try to help equally braindead os's by presenting any inserted media as
LUN 0 until another LUN is used in a command. Trick them by issuing a
gratuitous/harmless INQUIRY to LUN 1 after issuing the LUN 0 INQUIRY
but before any other command. Only umass scsi devices with >1 lun are
affected.
Fixes dlg's reader/writer for one.
Lots of diagnosis and testing by dlg@, ok dlg@, ok marco@.
Diffstat (limited to 'sys')
-rw-r--r-- | sys/scsi/scsiconf.c | 16 |
1 files changed, 15 insertions, 1 deletions
diff --git a/sys/scsi/scsiconf.c b/sys/scsi/scsiconf.c index e205e35d619..437687e523c 100644 --- a/sys/scsi/scsiconf.c +++ b/sys/scsi/scsiconf.c @@ -1,4 +1,4 @@ -/* $OpenBSD: scsiconf.c,v 1.93 2005/04/27 23:54:44 krw Exp $ */ +/* $OpenBSD: scsiconf.c,v 1.94 2005/04/28 00:12:55 krw Exp $ */ /* $NetBSD: scsiconf.c,v 1.57 1996/05/02 01:09:01 neil Exp $ */ /* @@ -742,6 +742,20 @@ scsi_probedev(scsi, inqbuflun0, target, lun) goto bad; } + /* + * Braindead USB devices, especially some x-in-1 media readers, try to + * 'help' by pretending any LUN is actually LUN 0 until they see a + * different LUN used in a command. So do an INQUIRY on LUN 1 at this + * point (since we are done with the data in inqbuf) to prevent such + * helpfulness before it causes confusion. + */ + if (lun == 0 && (sc_link->flags & SDEV_UMASS) && + scsi->sc_link[target][1] == NULL && sc_link->luns > 1) { + sc_link->lun = 1; + scsi_inquire(sc_link, &inqbuf, scsi_autoconf | SCSI_SILENT); + sc_link->lun = 0; + } + scsi->sc_link[target][lun] = sc_link; /* |