aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorDouglas Gilbert <dgilbert@interlog.com>2007-11-06 01:19:07 +0000
committerDouglas Gilbert <dgilbert@interlog.com>2007-11-06 01:19:07 +0000
commitce3fcfc9a3ec5594d2344f28d4ec4fc1d419b3a0 (patch)
tree25585ca086a82c6456a8d0043f72c4f1a892b66d /src
parent0938f9e2dd6bf7fa68a55d1d1104126aac8dac15 (diff)
downloadsg3_utils-ce3fcfc9a3ec5594d2344f28d4ec4fc1d419b3a0.tar.gz
sync sg_get_config with mmc6r01; add vrprotect option to sg_verify and associated sg_cmds_extra update
git-svn-id: https://svn.bingwo.ca/repos/sg3_utils/trunk@116 6180dd3e-e324-4e3e-922d-17de1ae2f315
Diffstat (limited to 'src')
-rw-r--r--src/sg_get_config.c79
-rw-r--r--src/sg_verify.c36
2 files changed, 95 insertions, 20 deletions
diff --git a/src/sg_get_config.c b/src/sg_get_config.c
index dccde24b..3c3cbc2c 100644
--- a/src/sg_get_config.c
+++ b/src/sg_get_config.c
@@ -45,11 +45,11 @@
/* A utility program for the Linux OS SCSI subsystem.
*
* This program outputs information provided by a SCSI "Get Configuration"
- command [0x46] which is only defined for CD/DVDs (in MMC-2,3,4,5).
+ command [0x46] which is only defined for CD/DVDs (in MMC-2,3,4,5,6).
*/
-static char * version_str = "0.30 20070919";
+static char * version_str = "0.31 20071026"; /* mmc6r01 */
#define MX_ALLOC_LEN 8192
#define NAME_BUFF_SZ 64
@@ -112,7 +112,7 @@ struct code_desc {
static struct code_desc profile_desc_arr[] = {
{0x0, "No current profile"},
- {0x1, "Non-removable disk"},
+ {0x1, "Non-removable disk (obs)"},
{0x2, "Removable disk"},
{0x3, "Magneto optical erasable"},
{0x4, "Optical write once"},
@@ -127,6 +127,8 @@ static struct code_desc profile_desc_arr[] = {
{0x14, "DVD-RW sequential recording"},
{0x15, "DVD-R dual layer sequental recording"},
{0x16, "DVD-R dual layer jump recording"},
+ {0x17, "DVD-RW dual layer"},
+ {0x18, "DVD-Download disc recording"},
{0x1a, "DVD+RW"},
{0x1b, "DVD+R"},
{0x20, "DDCD-ROM"},
@@ -141,6 +143,9 @@ static struct code_desc profile_desc_arr[] = {
{0x50, "HD DVD-ROM"},
{0x51, "HD DVD-R"},
{0x52, "HD DVD-RAM"},
+ {0x53, "HD DVD-RW"},
+ {0x58, "HD DVD-R dual layer"},
+ {0x5a, "HD DVD-RW dual layer"},
{0xffff, "Non-conforming profile"},
};
@@ -189,6 +194,8 @@ static struct code_desc feature_desc_arr[] = {
{0x31, "Double density CD-R write"},
{0x32, "Double density CD-RW write"},
{0x33, "Layer jump recording"},
+ {0x34, "LJ rigid restricted oberwrite"},
+ {0x35, "Stop long operation"},
{0x37, "CD-RW media write support"},
{0x38, "BD-R POW"},
{0x3a, "DVD+RW dual layer"},
@@ -198,6 +205,7 @@ static struct code_desc feature_desc_arr[] = {
{0x42, "TSR (timely safe recording)"},
{0x50, "HD DVD read"},
{0x51, "HD DVD write"},
+ {0x52, "HD DVD-RW fragment recording"},
{0x80, "Hybrid disc"},
{0x100, "Power management"},
{0x101, "SMART"},
@@ -213,7 +221,9 @@ static struct code_desc feature_desc_arr[] = {
{0x10b, "DVD CPRM"},
{0x10c, "Firmware information"},
{0x10d, "AACS"},
+ {0x10e, "DVD CSS managed recording"},
{0x110, "VCPS"},
+ {0x113, "SecurDisc"},
{0x120, "BD CPS"},
};
@@ -316,8 +326,9 @@ static void decode_feature(int feature, unsigned char * ucp, int len)
break;
}
printf(" Loading mechanism: %s\n", cp);
- printf(" Eject=%d, Prevent jumper=%d, Lock=%d\n",
- !!(ucp[4] & 0x8), !!(ucp[4] & 0x4), !!(ucp[4] & 0x1));
+ printf(" Load=%d, Eject=%d, Prevent jumper=%d, Lock=%d\n",
+ !!(ucp[4] & 0x10), !!(ucp[4] & 0x8), !!(ucp[4] & 0x4),
+ !!(ucp[4] & 0x1));
break;
case 4: /* Write protect */
printf(" version=%d, persist=%d, current=%d [0x%x]\n",
@@ -346,11 +357,13 @@ static void decode_feature(int feature, unsigned char * ucp, int len)
case 0x22: /* Sector erasable */
case 0x26: /* Restricted overwrite */
case 0x27: /* CDRW CAV write */
+ case 0x35: /* Stop long operation */
case 0x38: /* BD-R pseudo-overwrite (POW) */
case 0x42: /* TSR (timely safe recording) */
case 0x100: /* Power management */
case 0x109: /* Media serial number */
case 0x110: /* VCPS */
+ case 0x113: /* SecurDisc */
printf(" version=%d, persist=%d, current=%d [0x%x]\n",
((ucp[2] >> 2) & 0xf), !!(ucp[2] & 0x2), !!(ucp[2] & 0x1),
feature);
@@ -374,8 +387,8 @@ static void decode_feature(int feature, unsigned char * ucp, int len)
printf(" additional length [%d] too short\n", len - 4);
break;
}
- printf(" MULTI110=%d, Dual-R=%d\n", !!(ucp[4] & 0x1),
- !!(ucp[6] & 0x1));
+ printf(" MULTI110=%d, Dual-RW=%d, Dual-R=%d\n",
+ !!(ucp[4] & 0x1), !!(ucp[6] & 0x2), !!(ucp[6] & 0x1));
break;
case 0x20: /* Random writable */
printf(" version=%d, persist=%d, current=%d [0x%x]\n",
@@ -407,14 +420,15 @@ static void decode_feature(int feature, unsigned char * ucp, int len)
for (k = 0; k < num; ++k)
printf(" %d\n", ucp[8 + k]);
break;
+ /* case 0x22: Sector erasable -> see 0x1d entry */
case 0x23: /* Formattable */
printf(" version=%d, persist=%d, current=%d [0x%x]\n",
((ucp[2] >> 2) & 0xf), !!(ucp[2] & 0x2), !!(ucp[2] & 0x1),
feature);
if (len > 4)
- printf(" BD-RE: RENoSA=%d, Expand=%d, QCert=%d, Cert=%d\n",
- !!(ucp[4] & 0x8), !!(ucp[4] & 0x4), !!(ucp[4] & 0x2),
- !!(ucp[4] & 0x1));
+ printf(" BD-RE: RENoSA=%d, Expand=%d, QCert=%d, Cert=%d, "
+ "FRF=%d\n", !!(ucp[4] & 0x8), !!(ucp[4] & 0x4),
+ !!(ucp[4] & 0x2), !!(ucp[4] & 0x1), !!(ucp[5] & 0x80));
if (len > 8)
printf(" BD-R: RRM=%d\n", !!(ucp[8] & 0x1));
break;
@@ -437,6 +451,8 @@ static void decode_feature(int feature, unsigned char * ucp, int len)
printf(" Logical block size=0x%x, blocking=0x%x, PP=%d\n",
num, ((ucp[8] << 8) + ucp[9]), !!(ucp[10] & 0x1));
break;
+ /* case 0x26: Restricted overwrite -> see 0x1d entry */
+ /* case 0x27: CDRW CAV write -> see 0x1d entry */
case 0x28: /* MRW (Mount Rainier reWriteable) */
printf(" version=%d, persist=%d, current=%d [0x%x]\n",
((ucp[2] >> 2) & 0xf), !!(ucp[2] & 0x2), !!(ucp[2] & 0x1),
@@ -528,7 +544,7 @@ static void decode_feature(int feature, unsigned char * ucp, int len)
printf(" additional length [%d] too short\n", len - 4);
break;
}
- printf(" BUF=%d, RDL=%d, Test write=%d, DVD-RW=%d\n",
+ printf(" BUF=%d, RDL=%d, Test write=%d, DVD-RW SL=%d\n",
!!(ucp[4] & 0x40), !!(ucp[4] & 0x8), !!(ucp[4] & 0x4),
!!(ucp[4] & 0x2));
break;
@@ -545,6 +561,18 @@ static void decode_feature(int feature, unsigned char * ucp, int len)
for (k = 0; k < num; ++k)
printf(" %d\n", ucp[8 + k]);
break;
+ case 0x34: /* Layer jump rigid restricted overwrite */
+ printf(" version=%d, persist=%d, current=%d [0x%x]\n",
+ ((ucp[2] >> 2) & 0xf), !!(ucp[2] & 0x2), !!(ucp[2] & 0x1),
+ feature);
+ if (len < 8) {
+ printf(" additional length [%d] too short\n", len - 4);
+ break;
+ }
+ printf(" CLJB=%d\n", !!(ucp[4] & 0x1));
+ printf(" Buffer block size=%d\n", ucp[7]);
+ break;
+ /* case 0x35: Stop long operation -> see 0x1d entry */
case 0x37: /* CD-RW media write support */
printf(" version=%d, persist=%d, current=%d [0x%x]\n",
((ucp[2] >> 2) & 0xf), !!(ucp[2] & 0x2), !!(ucp[2] & 0x1),
@@ -555,6 +583,7 @@ static void decode_feature(int feature, unsigned char * ucp, int len)
}
printf(" CD-RW media sub-type support (bitmask)=0x%x\n", ucp[5]);
break;
+ /* case 0x38: BD-R pseudo-overwrite (POW) -> see 0x1d entry */
case 0x3a: /* DVD+RW dual layer */
printf(" version=%d, persist=%d, current=%d [0x%x]\n",
((ucp[2] >> 2) & 0xf), !!(ucp[2] & 0x2), !!(ucp[2] & 0x1),
@@ -631,6 +660,7 @@ static void decode_feature(int feature, unsigned char * ucp, int len)
(ucp[28] << 8) + ucp[29],
(ucp[30] << 8) + ucp[31]);
break;
+ /* case 0x42: TSR (timely safe recording) -> see 0x1d entry */
case 0x50: /* HD DVD Read */
printf(" version=%d, persist=%d, current=%d [0x%x]\n",
((ucp[2] >> 2) & 0xf), !!(ucp[2] & 0x2), !!(ucp[2] & 0x1),
@@ -653,6 +683,16 @@ static void decode_feature(int feature, unsigned char * ucp, int len)
printf(" HD DVD-R=%d, HD DVD-RAM=%d\n", !!(ucp[4] & 0x1),
!!(ucp[6] & 0x1));
break;
+ case 0x52: /* HD DVD-RW fragment recording */
+ printf(" version=%d, persist=%d, current=%d [0x%x]\n",
+ ((ucp[2] >> 2) & 0xf), !!(ucp[2] & 0x2), !!(ucp[2] & 0x1),
+ feature);
+ if (len < 8) {
+ printf(" additional length [%d] too short\n", len - 4);
+ break;
+ }
+ printf(" BGP=%d\n", !!(ucp[4] & 0x1));
+ break;
case 0x80: /* Hybrid disc */
printf(" version=%d, persist=%d, current=%d [0x%x]\n",
((ucp[2] >> 2) & 0xf), !!(ucp[2] & 0x2), !!(ucp[2] & 0x1),
@@ -663,6 +703,7 @@ static void decode_feature(int feature, unsigned char * ucp, int len)
}
printf(" RI=%d\n", !!(ucp[4] & 0x1));
break;
+ /* case 0x100: Power management -> see 0x1d entry */
case 0x101: /* SMART */
printf(" version=%d, persist=%d, current=%d [0x%x]\n",
((ucp[2] >> 2) & 0xf), !!(ucp[2] & 0x2), !!(ucp[2] & 0x1),
@@ -684,7 +725,7 @@ static void decode_feature(int feature, unsigned char * ucp, int len)
printf(" SCC=%d, SDP=%d, highest slot number=%d\n",
!!(ucp[4] & 0x10), !!(ucp[4] & 0x4), (ucp[7] & 0x1f));
break;
- case 0x103: /* CD audio external play */
+ case 0x103: /* CD audio external play (obsolete) */
printf(" version=%d, persist=%d, current=%d [0x%x]\n",
((ucp[2] >> 2) & 0xf), !!(ucp[2] & 0x2), !!(ucp[2] & 0x1),
feature);
@@ -748,6 +789,7 @@ static void decode_feature(int feature, unsigned char * ucp, int len)
buff[n] = '\0';
printf(" Drive serial number: %s\n", buff);
break;
+ /* case 0x109: Media serial number -> see 0x1d entry */
case 0x10a: /* Disc control blocks */
printf(" version=%d, persist=%d, current=%d [0x%x]\n",
((ucp[2] >> 2) & 0xf), !!(ucp[2] & 0x2), !!(ucp[2] & 0x1),
@@ -792,6 +834,19 @@ static void decode_feature(int feature, unsigned char * ucp, int len)
printf(" Number of AGIDs=%d, AACS version=%d\n",
(ucp[6] & 0xf), ucp[7]);
break;
+ case 0x10e: /* DVD CSS managed recording */
+ printf(" version=%d, persist=%d, current=%d [0x%x]\n",
+ ((ucp[2] >> 2) & 0xf), !!(ucp[2] & 0x2), !!(ucp[2] & 0x1),
+ feature);
+ if (len < 8) {
+ printf(" additional length [%d] too short\n", len - 4);
+ break;
+ }
+ printf(" Maximum number of scrambled extent information "
+ "entries=%d\n", ucp[4]);
+ break;
+ /* case 0x110: VCPS -> see 0x1d entry */
+ /* case 0x113: SecurDisc -> see 0x1d entry */
case 0x120: /* BD CPS */
printf(" version=%d, persist=%d, current=%d [0x%x]\n",
((ucp[2] >> 2) & 0xf), !!(ucp[2] & 0x2), !!(ucp[2] & 0x1),
diff --git a/src/sg_verify.c b/src/sg_verify.c
index 58b93fcf..75afa1fd 100644
--- a/src/sg_verify.c
+++ b/src/sg_verify.c
@@ -48,7 +48,7 @@
* This program issues the SCSI VERIFY command to the given SCSI block device.
*/
-static char * version_str = "1.10 20070919";
+static char * version_str = "1.11 20071102";
#define ME "sg_verify: "
@@ -61,15 +61,18 @@ static struct option long_options[] = {
{"lba", 1, 0, 'l'},
{"verbose", 0, 0, 'v'},
{"version", 0, 0, 'V'},
+ {"vrprotect", 1, 0, 'P'},
{0, 0, 0, 0},
};
-static void usage()
+static void
+usage()
{
fprintf(stderr, "Usage: "
"sg_verify [--bpc=BPC] [--count=COUNT] [--dpo] [--help] "
"[--lba=LBA]\n"
- " [--verbose] [--version] DEVICE\n"
+ " [--verbose] [--version] [--vrprotect=VRP] "
+ "DEVICE\n"
" where:\n"
" --bpc=BPC|-b BPC max blocks per verify command "
"(def 128)\n"
@@ -81,17 +84,21 @@ static void usage()
" --lba=LBA|-l LBA logical block address to start "
"verify (def 0)\n"
" --verbose|-v increase verbosity\n"
- " --version|-V print version string and exit\n\n"
+ " --version|-V print version string and exit\n"
+ " --vrprotect=VRP|-P VRP set vrprotect field to VRP "
+ "(def 0)\n"
"Performs a SCSI VERIFY(10) command\n"
);
}
-int main(int argc, char * argv[])
+int
+main(int argc, char * argv[])
{
int sg_fd, res, c, num;
long long ll;
int dpo = 0;
int bytechk = 0;
+ int vrprotect = 0;
long long count = 1;
long long orig_count;
int bpc = 128;
@@ -105,7 +112,7 @@ int main(int argc, char * argv[])
while (1) {
int option_index = 0;
- c = getopt_long(argc, argv, "b:c:dhl:vV", long_options,
+ c = getopt_long(argc, argv, "b:c:dhl:P:vV", long_options,
&option_index);
if (c == -1)
break;
@@ -140,6 +147,18 @@ int main(int argc, char * argv[])
}
lba = (unsigned long long)ll;
break;
+ case 'P':
+ vrprotect = sg_get_num(optarg);
+ if (-1 == vrprotect) {
+ fprintf(stderr, "bad argument to '--vrprotect'\n");
+ return SG_LIB_SYNTAX_ERROR;
+ }
+ if ((vrprotect < 0) || (vrprotect > 7)) {
+ fprintf(stderr, "'--vrprotect' requires a value from 0 to "
+ "7 (inclusive)\n");
+ return SG_LIB_SYNTAX_ERROR;
+ }
+ break;
case 'v':
++verbose;
break;
@@ -192,8 +211,9 @@ int main(int argc, char * argv[])
for (; count > 0; count -= bpc, lba +=bpc) {
num = (count > bpc) ? bpc : count;
- res = sg_ll_verify10(sg_fd, dpo, bytechk, (unsigned long)lba, num,
- NULL, 0, &info, 1, verbose);
+ res = sg_ll_verify10(sg_fd, vrprotect, dpo, bytechk,
+ (unsigned long)lba, num, NULL, 0,
+ &info, 1, verbose);
if (0 != res) {
ret = res;
switch (res) {