summaryrefslogtreecommitdiff
path: root/sys/scsi
diff options
context:
space:
mode:
authorKenneth R Westerback <krw@cvs.openbsd.org>2006-12-23 17:35:36 +0000
committerKenneth R Westerback <krw@cvs.openbsd.org>2006-12-23 17:35:36 +0000
commitd99a3bec8bcb064fbf7efc8e8c099158ff08d196 (patch)
tree95ed2af61ddbb3e36aadc0bef165ccd055015928 /sys/scsi
parent06120397e24a1469dc6a97ffd07a2916040d37b2 (diff)
Add the ability to issue GPCMD_REPORT_KEY and GPCMD_SEND_KEY scsi
commands via the DVD_LU_SEND_RPC_STATE and DVD_HOST_SEND_RPC_STATE ioctls respectively. Thus allowing any region protected DVDs mistakenly delivered by Santa to the wrong region to be viewed on recalcitrant DVD drives (with the aid of an appropriate utility like regionset). No change to any current functions. Found in my hackers@ folder from August. From netbsd -> Kurt Miller -> jmc@.
Diffstat (limited to 'sys/scsi')
-rw-r--r--sys/scsi/cd.c29
1 files changed, 28 insertions, 1 deletions
diff --git a/sys/scsi/cd.c b/sys/scsi/cd.c
index 1c40200c0f2..ba15f917677 100644
--- a/sys/scsi/cd.c
+++ b/sys/scsi/cd.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: cd.c,v 1.117 2006/12/12 02:44:36 krw Exp $ */
+/* $OpenBSD: cd.c,v 1.118 2006/12/23 17:35:35 krw Exp $ */
/* $NetBSD: cd.c,v 1.100 1997/04/02 02:29:30 mycroft Exp $ */
/*
@@ -1856,6 +1856,33 @@ dvd_auth(cd, a)
return (error);
return (0);
+ case DVD_LU_SEND_RPC_STATE:
+ cmd.opcode = GPCMD_REPORT_KEY;
+ cmd.bytes[8] = 8;
+ cmd.bytes[9] = 8 | (0 << 6);
+ error = scsi_scsi_cmd(cd->sc_link, &cmd, sizeof(cmd), buf, 8,
+ CDRETRIES, 30000, NULL, SCSI_DATA_IN);
+ if (error)
+ return (error);
+ a->lrpcs.type = (buf[4] >> 6) & 3;
+ a->lrpcs.vra = (buf[4] >> 3) & 7;
+ a->lrpcs.ucca = (buf[4]) & 7;
+ a->lrpcs.region_mask = buf[5];
+ a->lrpcs.rpc_scheme = buf[6];
+ return (0);
+
+ case DVD_HOST_SEND_RPC_STATE:
+ cmd.opcode = GPCMD_SEND_KEY;
+ cmd.bytes[8] = 8;
+ cmd.bytes[9] = 6 | (0 << 6);
+ buf[1] = 6;
+ buf[4] = a->hrpcs.pdrc;
+ error = scsi_scsi_cmd(cd->sc_link, &cmd, sizeof(cmd), buf, 8,
+ CDRETRIES, 30000, NULL, SCSI_DATA_OUT);
+ if (error)
+ return (error);
+ return (0);
+
default:
return (ENOTTY);
}