summaryrefslogtreecommitdiff
path: root/sys/scsi/scsi_ioctl.c
diff options
context:
space:
mode:
authorKenneth R Westerback <krw@cvs.openbsd.org>2007-01-16 00:43:20 +0000
committerKenneth R Westerback <krw@cvs.openbsd.org>2007-01-16 00:43:20 +0000
commit71ee1d8cc18c86ec434e7d430b07c1d37bb21f17 (patch)
tree17ac6d9320e78d2ff8153db6d6646e1855831148 /sys/scsi/scsi_ioctl.c
parent17d31f8b198554658065a3a5aaaab6de5f1f73c0 (diff)
Report SDEV_UMASS devices as non-'SCSI', i.e. 'ATAPI', devices when
asked via SCIOCIDENTIFY. More closely emulates the Linux SCIOCIDENTIFY/SG_EMULATED_HOST combination used by cdparanoia (and god knows what other ports). Nothing in the tree itself uses SCIOCIDENTIFY. Fixes cdparanoia's handling of USB CD drives that can't handle the MODE SENSE command. cdparanoia sends 'ATAPI' devices only MODE SENSE BIG (0x5a) commands. Finding actual SCSI devices that might have trouble with MODE SENSE BIG (i.e. very old devices) behind USB is deemed highly unlikely. Problem reported, debugged and fix tested by bernd@. ok marco@ millert@ miod@
Diffstat (limited to 'sys/scsi/scsi_ioctl.c')
-rw-r--r--sys/scsi/scsi_ioctl.c10
1 files changed, 7 insertions, 3 deletions
diff --git a/sys/scsi/scsi_ioctl.c b/sys/scsi/scsi_ioctl.c
index 41e48bf2fd6..2b71e9b017b 100644
--- a/sys/scsi/scsi_ioctl.c
+++ b/sys/scsi/scsi_ioctl.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: scsi_ioctl.c,v 1.27 2006/12/21 02:05:46 krw Exp $ */
+/* $OpenBSD: scsi_ioctl.c,v 1.28 2007/01/16 00:43:19 krw Exp $ */
/* $NetBSD: scsi_ioctl.c,v 1.23 1996/10/12 23:23:17 christos Exp $ */
/*
@@ -344,8 +344,12 @@ scsi_do_ioctl(struct scsi_link *sc_link, dev_t dev, u_long cmd, caddr_t addr,
case SCIOCIDENTIFY: {
struct scsi_addr *sca = (struct scsi_addr *)addr;
- sca->type = (sc_link->flags & SDEV_ATAPI)
- ? TYPE_ATAPI : TYPE_SCSI;
+ if ((sc_link->flags & (SDEV_ATAPI | SDEV_UMASS)) == 0)
+ /* A 'real' SCSI target. */
+ sca->type = TYPE_SCSI;
+ else
+ /* An 'emulated' SCSI target. */
+ sca->type = TYPE_ATAPI;
sca->scbus = sc_link->scsibus;
sca->target = sc_link->target;
sca->lun = sc_link->lun;