Add a couple of "features".

freebsd_ioctl.c: hopefully less-erroneous MCN extraction.
This commit is contained in:
rocky
2004-08-10 02:29:46 +00:00
parent ac7276d325
commit 993ec7356f
4 changed files with 59 additions and 23 deletions

View File

@@ -1,5 +1,5 @@
/* /*
$Id: sample10.c,v 1.6 2004/08/08 03:11:11 rocky Exp $ $Id: sample10.c,v 1.7 2004/08/10 02:29:46 rocky Exp $
Copyright (C) 2004 Rocky Bernstein <rocky@panix.com> Copyright (C) 2004 Rocky Bernstein <rocky@panix.com>
@@ -232,9 +232,19 @@ main(int argc, const char *argv[])
case CDIO_MMC_FEATURE_FORMATABLE: case CDIO_MMC_FEATURE_FORMATABLE:
printf("Formattable Feature\n"); printf("Formattable Feature\n");
break; break;
case CDIO_MMC_FEATURE_DEFECT_MGMT:
printf("Management Ability of the Logical Unit/media system "
"to provide an apparently defect-free space.\n");
break;
case CDIO_MMC_FEATURE_WRITE_ONCE: case CDIO_MMC_FEATURE_WRITE_ONCE:
printf("Write Once Feature\n"); printf("Write Once Feature\n");
break; break;
case CDIO_MMC_FEATURE_RESTRICT_OVERW:
printf("Restricted Overwrite Feature\n");
break;
case CDIO_MMC_FEATURE_CD_RW_CAV:
printf("CD-RW CAV Write Feature\n");
break;
case CDIO_MMC_FEATURE_MRW: case CDIO_MMC_FEATURE_MRW:
printf("MRW Feature\n"); printf("MRW Feature\n");
break; break;
@@ -244,18 +254,15 @@ main(int argc, const char *argv[])
case CDIO_MMC_FEATURE_DVD_PR: case CDIO_MMC_FEATURE_DVD_PR:
printf("DVD+R Feature\n"); printf("DVD+R Feature\n");
break; break;
case CDIO_MMC_FEATURE_CD_RW_CAV:
printf("CD-RW CAV Write Feature\n");
break;
case CDIO_MMC_FEATURE_RESTRICT_OVERW:
printf("Restricted Overwrite Feature\n");
break;
case CDIO_MMC_FEATURE_CD_TAO: case CDIO_MMC_FEATURE_CD_TAO:
printf("CD Track at Once Feature\n"); printf("CD Track at Once Feature\n");
break; break;
case CDIO_MMC_FEATURE_CD_SAO: case CDIO_MMC_FEATURE_CD_SAO:
printf("CD Mastering (Session at Once) Feature\n"); printf("CD Mastering (Session at Once) Feature\n");
break; break;
case CDIO_MMC_FEATURE_POWER_MGMT:
printf("Initiator and device directed power management\n");
break;
case CDIO_MMC_FEATURE_CDDA_EXT_PLAY: case CDIO_MMC_FEATURE_CDDA_EXT_PLAY:
printf("CD Audio External Play Feature\n"); printf("CD Audio External Play Feature\n");
printf("\tSCAN command is %ssupported\n", printf("\tSCAN command is %ssupported\n",
@@ -271,9 +278,6 @@ main(int argc, const char *argv[])
} }
printf("\n"); printf("\n");
break; break;
case CDIO_MMC_FEATURE_POWER_MGMT:
printf("Initiator and device directed power management\n");
break;
case CDIO_MMC_FEATURE_MCODE_UPGRADE: case CDIO_MMC_FEATURE_MCODE_UPGRADE:
printf("Ability for the device to accept new microcode via " printf("Ability for the device to accept new microcode via "
"the interface\n"); "the interface\n");
@@ -286,6 +290,9 @@ main(int argc, const char *argv[])
printf("Ability to perform DVD CSS/CPPM authentication and" printf("Ability to perform DVD CSS/CPPM authentication and"
" RPC\n"); " RPC\n");
break; break;
case CDIO_MMC_FEATURE_RT_STREAMING:
printf("\tAbility to read and write using Initiator requested performance parameters\n");
break;
case CDIO_MMC_FEATURE_LU_SN: { case CDIO_MMC_FEATURE_LU_SN: {
uint8_t i_serial = *(p+3); uint8_t i_serial = *(p+3);
char serial[257] = { '\0', }; char serial[257] = { '\0', };
@@ -297,7 +304,11 @@ main(int argc, const char *argv[])
break; break;
} }
default: default:
printf("Unknown feature code %x\n", i_feature); if ( 0 != (i_feature & 0xFF00) ) {
printf("Vendor-specific feature code %x\n", i_feature);
} else {
printf("Unknown feature code %x\n", i_feature);
}
} }
p += i_feature_additional + 4; p += i_feature_additional + 4;
} }

View File

@@ -1,5 +1,5 @@
/* /*
$Id: scsi_mmc.h,v 1.30 2004/08/07 03:25:25 rocky Exp $ $Id: scsi_mmc.h,v 1.31 2004/08/10 02:29:46 rocky Exp $
Copyright (C) 2003, 2004 Rocky Bernstein <rocky@panix.com> Copyright (C) 2003, 2004 Rocky Bernstein <rocky@panix.com>
@@ -140,6 +140,13 @@
Feature */ Feature */
#define CDIO_MMC_FEATURE_FORMATABLE 0x023 /**< Formattable #define CDIO_MMC_FEATURE_FORMATABLE 0x023 /**< Formattable
Feature */ Feature */
#define CDIO_MMC_FEATURE_DEFECT_MGMT 0x024 /**< Management
Ability of the
Logical Unit/media
system to provide
an apparently
defect-free
space.*/
#define CDIO_MMC_FEATURE_WRITE_ONCE 0x025 /**< Write Once #define CDIO_MMC_FEATURE_WRITE_ONCE 0x025 /**< Write Once
Feature */ Feature */
#define CDIO_MMC_FEATURE_RESTRICT_OVERW 0x026 /**< Restricted #define CDIO_MMC_FEATURE_RESTRICT_OVERW 0x026 /**< Restricted
@@ -172,6 +179,12 @@
CSS/CPPM CSS/CPPM
authentication and authentication and
RPC */ RPC */
#define CDIO_MMC_FEATURE_RT_STREAMING 0x107 /**< Ability to read
and write using
Initiator requested
performance
parameters
*/
#define CDIO_MMC_FEATURE_LU_SN 0x108 /**< The Logical Unit #define CDIO_MMC_FEATURE_LU_SN 0x108 /**< The Logical Unit
has a unique has a unique
identifier. */ identifier. */

View File

@@ -1,5 +1,5 @@
/* /*
$Id: freebsd_ioctl.c,v 1.11 2004/07/28 11:45:21 rocky Exp $ $Id: freebsd_ioctl.c,v 1.12 2004/08/10 02:29:46 rocky Exp $
Copyright (C) 2003, 2004 Rocky Bernstein <rocky@panix.com> Copyright (C) 2003, 2004 Rocky Bernstein <rocky@panix.com>
@@ -27,7 +27,7 @@
# include "config.h" # include "config.h"
#endif #endif
static const char _rcsid[] = "$Id: freebsd_ioctl.c,v 1.11 2004/07/28 11:45:21 rocky Exp $"; static const char _rcsid[] = "$Id: freebsd_ioctl.c,v 1.12 2004/08/10 02:29:46 rocky Exp $";
#ifdef HAVE_FREEBSD_CDROM #ifdef HAVE_FREEBSD_CDROM
@@ -182,7 +182,7 @@ get_mcn_freebsd_ioctl (const _img_private_t *env) {
subchannel.address_format = CDIO_CDROM_MSF; subchannel.address_format = CDIO_CDROM_MSF;
subchannel.data_format = CDIO_SUBCHANNEL_MEDIA_CATALOG; subchannel.data_format = CDIO_SUBCHANNEL_MEDIA_CATALOG;
subchannel.track = 0; subchannel.track = 0;
subchannel.data_len = 28; subchannel.data_len = sizeof(subchannel_info);
subchannel.data = &subchannel_info; subchannel.data = &subchannel_info;
if(ioctl(env->gen.fd, CDIOCREADSUBCHANNEL, &subchannel) < 0) { if(ioctl(env->gen.fd, CDIOCREADSUBCHANNEL, &subchannel) < 0) {

View File

@@ -1,5 +1,5 @@
/* /*
$Id: util.c,v 1.19 2004/08/08 03:11:11 rocky Exp $ $Id: util.c,v 1.20 2004/08/10 02:29:46 rocky Exp $
Copyright (C) 2003, 2004 Rocky Bernstein <rocky@panix.com> Copyright (C) 2003, 2004 Rocky Bernstein <rocky@panix.com>
@@ -283,9 +283,19 @@ print_mmc_drive_features(CdIo *p_cdio)
case CDIO_MMC_FEATURE_FORMATABLE: case CDIO_MMC_FEATURE_FORMATABLE:
printf("Formattable Feature\n"); printf("Formattable Feature\n");
break; break;
case CDIO_MMC_FEATURE_DEFECT_MGMT:
printf("Management Ability of the Logical Unit/media system "
"to provide an apparently defect-free space.\n");
break;
case CDIO_MMC_FEATURE_WRITE_ONCE: case CDIO_MMC_FEATURE_WRITE_ONCE:
printf("Write Once Feature\n"); printf("Write Once Feature\n");
break; break;
case CDIO_MMC_FEATURE_RESTRICT_OVERW:
printf("Restricted Overwrite Feature\n");
break;
case CDIO_MMC_FEATURE_CD_RW_CAV:
printf("CD-RW CAV Write Feature\n");
break;
case CDIO_MMC_FEATURE_MRW: case CDIO_MMC_FEATURE_MRW:
printf("MRW Feature\n"); printf("MRW Feature\n");
break; break;
@@ -295,12 +305,6 @@ print_mmc_drive_features(CdIo *p_cdio)
case CDIO_MMC_FEATURE_DVD_PR: case CDIO_MMC_FEATURE_DVD_PR:
printf("DVD+R Feature\n"); printf("DVD+R Feature\n");
break; break;
case CDIO_MMC_FEATURE_CD_RW_CAV:
printf("CD-RW CAV Write Feature\n");
break;
case CDIO_MMC_FEATURE_RESTRICT_OVERW:
printf("Restricted Overwrite Feature\n");
break;
case CDIO_MMC_FEATURE_CD_TAO: case CDIO_MMC_FEATURE_CD_TAO:
printf("CD Track at Once Feature\n"); printf("CD Track at Once Feature\n");
break; break;
@@ -343,6 +347,9 @@ print_mmc_drive_features(CdIo *p_cdio)
printf("\tCSS version %d\n", p[7]); printf("\tCSS version %d\n", p[7]);
printf("\t\n"); printf("\t\n");
break; break;
case CDIO_MMC_FEATURE_RT_STREAMING:
printf("\tAbility to read and write using Initiator requested performance parameters\n");
break;
case CDIO_MMC_FEATURE_LU_SN: { case CDIO_MMC_FEATURE_LU_SN: {
uint8_t i_serial = *(p+3); uint8_t i_serial = *(p+3);
char serial[257] = { '\0', }; char serial[257] = { '\0', };
@@ -354,7 +361,12 @@ print_mmc_drive_features(CdIo *p_cdio)
break; break;
} }
default: default:
printf("Unknown feature code %x\n", i_feature); if ( 0 != (i_feature & 0xFF00) ) {
printf("Vendor-specific feature code %x\n", i_feature);
} else {
printf("Unknown feature code %x\n", i_feature);
}
} }
p += i_feature_additional + 4; p += i_feature_additional + 4;
} }