diff options
author | Kenneth R Westerback <krw@cvs.openbsd.org> | 2006-12-23 17:35:36 +0000 |
---|---|---|
committer | Kenneth R Westerback <krw@cvs.openbsd.org> | 2006-12-23 17:35:36 +0000 |
commit | d99a3bec8bcb064fbf7efc8e8c099158ff08d196 (patch) | |
tree | 95ed2af61ddbb3e36aadc0bef165ccd055015928 /sys | |
parent | 06120397e24a1469dc6a97ffd07a2916040d37b2 (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')
-rw-r--r-- | sys/scsi/cd.c | 29 | ||||
-rw-r--r-- | sys/sys/cdio.h | 19 |
2 files changed, 46 insertions, 2 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); } diff --git a/sys/sys/cdio.h b/sys/sys/cdio.h index 4808e184c7a..fcae3f3d117 100644 --- a/sys/sys/cdio.h +++ b/sys/sys/cdio.h @@ -1,4 +1,4 @@ -/* $OpenBSD: cdio.h,v 1.15 2006/07/11 00:32:27 pedro Exp $ */ +/* $OpenBSD: cdio.h,v 1.16 2006/12/23 17:35:35 krw Exp $ */ /* $NetBSD: cdio.h,v 1.11 1996/02/19 18:29:04 scottr Exp $ */ #ifndef _SYS_CDIO_H_ @@ -340,6 +340,8 @@ union dvd_struct { #define DVD_LU_SEND_TITLE_KEY 7 #define DVD_LU_SEND_ASF 8 #define DVD_INVALIDATE_AGID 9 +#define DVD_LU_SEND_RPC_STATE 10 +#define DVD_HOST_SEND_RPC_STATE 11 #if 0 /* State data */ @@ -405,6 +407,19 @@ struct dvd_lu_send_asf { u_int8_t asf; }; +struct dvd_host_send_rpcstate { + u_int8_t type; + u_int8_t pdrc; +}; + +struct dvd_lu_send_rpcstate { + u_int8_t type; + u_int8_t vra; + u_int8_t ucca; + u_int8_t region_mask; + u_int8_t rpc_scheme; + }; + union dvd_authinfo { u_int8_t type; @@ -415,5 +430,7 @@ union dvd_authinfo { struct dvd_send_key hsk; struct dvd_lu_send_title_key lstk; struct dvd_lu_send_asf lsasf; + struct dvd_host_send_rpcstate hrpcs; + struct dvd_lu_send_rpcstate lrpcs; }; #endif /* !_SYS_CDIO_H_ */ |