summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorkrw <krw@openbsd.org>2007-01-16 00:43:19 +0000
committerkrw <krw@openbsd.org>2007-01-16 00:43:19 +0000
commitb7f9cc29ecf48cdc78d7ac3c2131db2b24efeaf9 (patch)
tree15600538a2cdac49b0cdd7af117ff6fed1c5f3d8
parentansi/deregister (diff)
downloadwireguard-openbsd-b7f9cc29ecf48cdc78d7ac3c2131db2b24efeaf9.tar.xz
wireguard-openbsd-b7f9cc29ecf48cdc78d7ac3c2131db2b24efeaf9.zip
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@
-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;