Add enum for feature profiles. Add feature to string conversion routines.

This commit is contained in:
rocky
2005-02-08 04:14:28 +00:00
parent b80ab25c6f
commit a1c206fe3b
5 changed files with 404 additions and 537 deletions

View File

@@ -1,5 +1,5 @@
/* /*
$Id: mmc2.c,v 1.3 2005/02/07 03:36:02 rocky Exp $ $Id: mmc2.c,v 1.4 2005/02/08 04:14:28 rocky Exp $
Copyright (C) 2004, 2005 Rocky Bernstein <rocky@panix.com> Copyright (C) 2004, 2005 Rocky Bernstein <rocky@panix.com>
@@ -67,250 +67,115 @@ main(int argc, const char *argv[])
uint8_t i_feature_additional = p[3]; uint8_t i_feature_additional = p[3];
i_feature = CDIO_MMC_GET_LEN16(p); i_feature = CDIO_MMC_GET_LEN16(p);
switch( i_feature ) {
{ uint8_t *q;
uint8_t *q; const char *feature_str = mmc_feature2str(i_feature);
case CDIO_MMC_FEATURE_PROFILE_LIST: printf("%s Feature\n", feature_str);
printf("Profile List Feature\n"); switch( i_feature )
for ( q = p+4 ; q < p + i_feature_additional ; q += 4 ) { {
int i_profile=CDIO_MMC_GET_LEN16(q); case CDIO_MMC_FEATURE_PROFILE_LIST:
switch (i_profile) { for ( q = p+4 ; q < p + i_feature_additional ; q += 4 ) {
case CDIO_MMC_FEATURE_PROF_NON_REMOVABLE: int i_profile=CDIO_MMC_GET_LEN16(q);
printf("\tRe-writable disk, capable of changing behavior"); const char *feature_profile_str =
break; mmc_feature_profile2str(i_profile);
case CDIO_MMC_FEATURE_PROF_REMOVABLE: printf( "\t%s", feature_profile_str );
printf("\tdisk Re-writable; with removable media"); if (q[2] & 1) {
break; printf(" - on");
case CDIO_MMC_FEATURE_PROF_MO_ERASABLE: }
printf("\tErasable Magneto-Optical disk with sector erase capability"); printf("\n");
break;
case CDIO_MMC_FEATURE_PROF_MO_WRITE_ONCE:
printf("\tWrite Once Magneto-Optical write once");
break;
case CDIO_MMC_FEATURE_PROF_AS_MO:
printf("\tAdvance Storage Magneto-Optical");
break;
case CDIO_MMC_FEATURE_PROF_CD_ROM:
printf("\tRead only Compact Disc capable");
break;
case CDIO_MMC_FEATURE_PROF_CD_R:
printf("\tWrite once Compact Disc capable");
break;
case CDIO_MMC_FEATURE_PROF_CD_RW:
printf("\tCD-RW Re-writable Compact Disc capable");
break;
case CDIO_MMC_FEATURE_PROF_DVD_ROM:
printf("\tRead only DVD");
break;
case CDIO_MMC_FEATURE_PROF_DVD_R_SEQ:
printf("\tRe-recordable DVD using Sequential recording");
break;
case CDIO_MMC_FEATURE_PROF_DVD_RAM:
printf("\tRe-writable DVD");
break;
case CDIO_MMC_FEATURE_PROF_DVD_RW_RO:
printf("\tRe-recordable DVD using Restricted Overwrite");
break;
case CDIO_MMC_FEATURE_PROF_DVD_RW_SEQ:
printf("\tRe-recordable DVD using Sequential recording");
break;
case CDIO_MMC_FEATURE_PROF_DVD_PRW:
printf("\tDVD+RW - DVD ReWritable");
break;
case CDIO_MMC_FEATURE_PROF_DVD_PR:
printf("\tDVD+R - DVD Recordable");
break;
case CDIO_MMC_FEATURE_PROF_DDCD_ROM:
printf("\tRead only DDCD");
break;
case CDIO_MMC_FEATURE_PROF_DDCD_R:
printf("\tDDCD-R Write only DDCD");
break;
case CDIO_MMC_FEATURE_PROF_DDCD_RW:
printf("\tRe-Write only DDCD");
break;
case CDIO_MMC_FEATURE_PROF_NON_CONFORM:
printf("\tThe Logical Unit does not conform to any Profile.");
break;
default:
printf("\tUnknown Profile %x", i_profile);
break;
}
if (q[2] & 1) {
printf(" - on");
} }
printf("\n"); printf("\n");
}
printf("\n");
break; break;
case CDIO_MMC_FEATURE_CORE: case CDIO_MMC_FEATURE_CORE:
{ {
uint8_t *q = p+4; uint8_t *q = p+4;
uint32_t i_interface_standard = CDIO_MMC_GET_LEN32(q); uint32_t i_interface_standard = CDIO_MMC_GET_LEN32(q);
printf("Core Feature\n"); switch(i_interface_standard) {
switch(i_interface_standard) { case 0:
case 0: printf("\tunspecified interface\n");
printf("\tunspecified interface\n"); break;
case 1:
printf("\tSCSI interface\n");
break;
case 2:
printf("\tATAPI interface\n");
break;
case 3:
printf("\tIEEE 1394 interface\n");
break;
case 4:
printf("\tIEEE 1394A interface\n");
break;
case 5:
printf("\tFibre Channel interface\n");
}
printf("\n");
break; break;
case 1: }
printf("\tSCSI interface\n"); case CDIO_MMC_FEATURE_REMOVABLE_MEDIUM:
switch(p[4] >> 5) {
case 0:
printf("\tCaddy/Slot type loading mechanism\n");
break; break;
case 2: case 1:
printf("\tATAPI interface\n"); printf("\tTray type loading mechanism\n");
break; break;
case 3: case 2:
printf("\tIEEE 1394 interface\n"); printf("\tPop-up type loading mechanism\n");
break; break;
case 4: case 4:
printf("\tIEEE 1394A interface\n"); printf("\tEmbedded changer with individually changeable discs\n");
break; break;
case 5: case 5:
printf("\tFibre Channel interface\n"); printf("\tEmbedded changer using a magazine mechanism\n");
break;
default:
printf("\tUnknown changer mechanism\n");
}
printf("\tcan%s eject the medium or magazine via the normal "
"START/STOP command\n",
(p[4] & 8) ? "": "not");
printf("\tcan%s be locked into the Logical Unit\n",
(p[4] & 1) ? "": "not");
printf("\n");
break;
case CDIO_MMC_FEATURE_CD_READ:
printf("CD Read Feature\n");
printf("\tC2 Error pointers are %ssupported\n",
(p[4] & 2) ? "": "not ");
printf("\tCD-Text is %ssupported\n",
(p[4] & 1) ? "": "not ");
printf("\n");
break;
case CDIO_MMC_FEATURE_CDDA_EXT_PLAY:
printf("\tSCAN command is %ssupported\n",
(p[4] & 4) ? "": "not ");
printf("\taudio channels can %sbe muted separately\n",
(p[4] & 2) ? "": "not ");
printf("\taudio channels can %shave separate volume levels\n",
(p[4] & 1) ? "": "not ");
{
uint8_t *q = p+6;
uint16_t i_vol_levels = CDIO_MMC_GET_LEN16(q);
printf("\t%d volume levels can be set\n", i_vol_levels);
} }
printf("\n"); printf("\n");
break; break;
case CDIO_MMC_FEATURE_LU_SN: {
uint8_t i_serial = *(p+3);
char serial[257] = { '\0', };
memcpy(serial, p+4, i_serial);
printf("\t%s\n\n", serial);
break;
} }
case CDIO_MMC_FEATURE_REMOVABLE_MEDIUM: default:
printf("Removable Medium Feature\n"); printf("\n");
switch(p[4] >> 5) {
case 0:
printf("\tCaddy/Slot type loading mechanism\n");
break; break;
case 1:
printf("\tTray type loading mechanism\n");
break;
case 2:
printf("\tPop-up type loading mechanism\n");
break;
case 4:
printf("\tEmbedded changer with individually changeable discs\n");
break;
case 5:
printf("\tEmbedded changer using a magazine mechanism\n");
break;
default:
printf("\tUnknown changer mechanism\n");
} }
p += i_feature_additional + 4;
printf("\tcan%s eject the medium or magazine via the normal " }
"START/STOP command\n",
(p[4] & 8) ? "": "not");
printf("\tcan%s be locked into the Logical Unit\n",
(p[4] & 1) ? "": "not");
printf("\n");
break;
case CDIO_MMC_FEATURE_WRITE_PROTECT:
printf("Write Protect Feature\n");
break;
case CDIO_MMC_FEATURE_RANDOM_READABLE:
printf("Random Readable Feature\n");
break;
case CDIO_MMC_FEATURE_MULTI_READ:
printf("Multi-Read Feature\n");
break;
case CDIO_MMC_FEATURE_CD_READ:
printf("CD Read Feature\n");
printf("\tC2 Error pointers are %ssupported\n",
(p[4] & 2) ? "": "not ");
printf("\tCD-Text is %ssupported\n",
(p[4] & 1) ? "": "not ");
printf("\n");
break;
case CDIO_MMC_FEATURE_DVD_READ:
printf("DVD Read Feature\n");
break;
case CDIO_MMC_FEATURE_RANDOM_WRITABLE:
printf("Random Writable Feature\n");
break;
case CDIO_MMC_FEATURE_INCR_WRITE:
printf("Incremental Streaming Writable Feature\n");
break;
case CDIO_MMC_FEATURE_SECTOR_ERASE:
printf("Sector Erasable Feature\n");
break;
case CDIO_MMC_FEATURE_FORMATABLE:
printf("Formattable Feature\n");
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:
printf("Write Once Feature\n");
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:
printf("MRW Feature\n");
break;
case CDIO_MMC_FEATURE_DVD_PRW:
printf("DVD+RW Feature\n");
break;
case CDIO_MMC_FEATURE_DVD_PR:
printf("DVD+R Feature\n");
break;
case CDIO_MMC_FEATURE_CD_TAO:
printf("CD Track at Once Feature\n");
break;
case CDIO_MMC_FEATURE_CD_SAO:
printf("CD Mastering (Session at Once) Feature\n");
break;
case CDIO_MMC_FEATURE_POWER_MGMT:
printf("Initiator and device directed power management\n");
break;
case CDIO_MMC_FEATURE_CDDA_EXT_PLAY:
printf("CD Audio External Play Feature\n");
printf("\tSCAN command is %ssupported\n",
(p[4] & 4) ? "": "not ");
printf("\taudio channels can %sbe muted separately\n",
(p[4] & 2) ? "": "not ");
printf("\taudio channels can %shave separate volume levels\n",
(p[4] & 1) ? "": "not ");
{
uint8_t *q = p+6;
uint16_t i_vol_levels = CDIO_MMC_GET_LEN16(q);
printf("\t%d volume levels can be set\n", i_vol_levels);
}
printf("\n");
break;
case CDIO_MMC_FEATURE_MCODE_UPGRADE:
printf("Ability for the device to accept new microcode via "
"the interface\n");
break;
case CDIO_MMC_FEATURE_TIME_OUT:
printf("Ability to respond to all commands within a "
"specific time\n");
break;
case CDIO_MMC_FEATURE_DVD_CSS:
printf("Ability to perform DVD CSS/CPPM authentication and"
" RPC\n");
break;
case CDIO_MMC_FEATURE_RT_STREAMING:
printf("Ability to read and write using Initiator requested performance parameters\n");
break;
case CDIO_MMC_FEATURE_LU_SN: {
uint8_t i_serial = *(p+3);
char serial[257] = { '\0', };
printf("The Logical Unit has a unique identifier:\n");
memcpy(serial, p+4, i_serial);
printf("\t%s\n\n", serial);
break;
}
default:
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;
} }
} else { } else {
printf("Didn't get all feature codes\n"); printf("Didn't get all feature codes\n");

View File

@@ -1,5 +1,5 @@
/* /*
$Id: mmc.h,v 1.3 2005/02/07 17:09:31 rocky Exp $ $Id: mmc.h,v 1.4 2005/02/08 04:14:28 rocky Exp $
Copyright (C) 2003, 2004, 2005 Rocky Bernstein <rocky@panix.com> Copyright (C) 2003, 2004, 2005 Rocky Bernstein <rocky@panix.com>
@@ -238,8 +238,10 @@ typedef enum {
identifier. */ identifier. */
CDIO_MMC_FEATURE_FIRMWARE_DATE = 0x1FF, /**< Firmware creation date CDIO_MMC_FEATURE_FIRMWARE_DATE = 0x1FF, /**< Firmware creation date
report */ report */
} mmc_feature_t;
/*! Profile codes used in GET_CONFIGURATION - PROFILE LIST. */ /*! Profile profile codes used in GET_CONFIGURATION - PROFILE LIST. */
typedef enum {
CDIO_MMC_FEATURE_PROF_NON_REMOVABLE = 0x0001, /**< Re-writable disk, capable CDIO_MMC_FEATURE_PROF_NON_REMOVABLE = 0x0001, /**< Re-writable disk, capable
of changing behavior */ of changing behavior */
CDIO_MMC_FEATURE_PROF_REMOVABLE = 0x0002, /**< disk Re-writable; with CDIO_MMC_FEATURE_PROF_REMOVABLE = 0x0002, /**< disk Re-writable; with
@@ -274,7 +276,7 @@ typedef enum {
double layer */ double layer */
CDIO_MMC_FEATURE_PROF_NON_CONFORM = 0xFFFF, /**< The Logical Unit does not CDIO_MMC_FEATURE_PROF_NON_CONFORM = 0xFFFF, /**< The Logical Unit does not
conform to any Profile. */ conform to any Profile. */
} mmc_feature_t; } mmc_feature_profile_t;
typedef enum { typedef enum {
CDIO_MMC_FEATURE_INTERFACE_UNSPECIFIED = 0, CDIO_MMC_FEATURE_INTERFACE_UNSPECIFIED = 0,
@@ -368,6 +370,16 @@ typedef enum scsi_mmc_direction {
*/ */
int mmc_eject_media( const CdIo_t *p_cdio ); int mmc_eject_media( const CdIo_t *p_cdio );
/*!
Return a string containing the name of the given feature
*/
const char *mmc_feature2str( int i_feature );
/*!
Return a string containing the name of the given feature
*/
const char *mmc_feature_profile2str( int i_feature_profile );
/*! /*!
Return the length in bytes of the Command Descriptor Return the length in bytes of the Command Descriptor
Buffer (CDB) for a given MMC command. The length will be Buffer (CDB) for a given MMC command. The length will be

View File

@@ -147,8 +147,21 @@ cdtext_init
cdtext_is_keyword cdtext_is_keyword
cdtext_set cdtext_set
discmode2str discmode2str
mmc_eject_media
mmc_get_blocksize
mmc_get_discmode
mmc_get_dvd_struct_physical
mmc_get_cmd_len
mmc_get_media_changed
mmc_get_mcn
mmc_get_hwinfo mmc_get_hwinfo
mmc_get_last_lsn
mmc_feature2str
mmc_feature_profile2str
mmc_have_interface mmc_have_interface
mmc_read_sectors
mmc_run_cmd mmc_run_cmd
mmc_set_blocksize
mmc_set_speed
track_format2str track_format2str
CDIO_SECTOR_SYNC_HEADER CDIO_SECTOR_SYNC_HEADER

View File

@@ -1,6 +1,6 @@
/* Common Multimedia Command (MMC) routines. /* Common Multimedia Command (MMC) routines.
$Id: mmc.c,v 1.3 2005/02/07 03:36:02 rocky Exp $ $Id: mmc.c,v 1.4 2005/02/08 04:14:28 rocky Exp $
Copyright (C) 2004, 2005 Rocky Bernstein <rocky@panix.com> Copyright (C) 2004, 2005 Rocky Bernstein <rocky@panix.com>
@@ -36,6 +36,10 @@
#include <stdlib.h> #include <stdlib.h>
#endif #endif
#ifdef HAVE_STDIO_H
#include <stdio.h>
#endif
#ifdef HAVE_ERRNO_H #ifdef HAVE_ERRNO_H
#include <errno.h> #include <errno.h>
#endif #endif
@@ -767,6 +771,154 @@ mmc_eject_media( const CdIo_t *p_cdio )
} }
/*!
Return a string containing the name of the given feature
*/
const char *mmc_feature2str( int i_feature )
{
switch(i_feature) {
case CDIO_MMC_FEATURE_PROFILE_LIST:
return "Profile List";
case CDIO_MMC_FEATURE_CORE:
return "Core";
case CDIO_MMC_FEATURE_MORPHING:
return "Morphing" ;
case CDIO_MMC_FEATURE_REMOVABLE_MEDIUM:
return "Removable Medium";
case CDIO_MMC_FEATURE_WRITE_PROTECT:
return "Write Protect";
case CDIO_MMC_FEATURE_RANDOM_READABLE:
return "Random Readable";
case CDIO_MMC_FEATURE_MULTI_READ:
return "Multi-Read";
case CDIO_MMC_FEATURE_CD_READ:
return "CD Read";
case CDIO_MMC_FEATURE_DVD_READ:
return "DVD Read";
case CDIO_MMC_FEATURE_RANDOM_WRITABLE:
return "Random Writable";
case CDIO_MMC_FEATURE_INCR_WRITE:
return "Incremental Streaming Writable";
case CDIO_MMC_FEATURE_SECTOR_ERASE:
return "Sector Erasable";
case CDIO_MMC_FEATURE_FORMATABLE:
return "Formattable";
case CDIO_MMC_FEATURE_DEFECT_MGMT:
return "Management Ability of the Logical Unit/media system "
"to provide an apparently defect-free space.";
case CDIO_MMC_FEATURE_WRITE_ONCE:
return "Write Once";
case CDIO_MMC_FEATURE_RESTRICT_OVERW:
return "Restricted Overwrite";
case CDIO_MMC_FEATURE_CD_RW_CAV:
return "CD-RW CAV Write";
case CDIO_MMC_FEATURE_MRW:
return "MRW";
case CDIO_MMC_FEATURE_ENHANCED_DEFECT:
return "Enhanced Defect Reporting";
case CDIO_MMC_FEATURE_DVD_PRW:
return "DVD+RW";
case CDIO_MMC_FEATURE_DVD_PR:
return "DVD+R";
case CDIO_MMC_FEATURE_CD_TAO:
return "CD Track at Once";
case CDIO_MMC_FEATURE_CD_SAO:
return "CD Mastering (Session at Once)";
case CDIO_MMC_FEATURE_DVD_R_RW_WRITE:
return "DVD-R/RW Write";
case CDIO_MMC_FEATURE_CD_RW_MEDIA_WRITE:
return "CD-RW Media Write Support";
case CDIO_MMC_FEATURE_DVD_PR_2_LAYER:
return "DVD+R Double Layer";
case CDIO_MMC_FEATURE_POWER_MGMT:
return "Initiator- and Device-directed Power Management";
case CDIO_MMC_FEATURE_CDDA_EXT_PLAY:
return "CD Audio External Play";
case CDIO_MMC_FEATURE_MCODE_UPGRADE:
return "Ability for the device to accept new microcode via the interface";
case CDIO_MMC_FEATURE_TIME_OUT:
return "Ability to respond to all commands within a specific time";
case CDIO_MMC_FEATURE_DVD_CSS:
return "Ability to perform DVD CSS/CPPM authentication via RPC";
case CDIO_MMC_FEATURE_RT_STREAMING:
return "Ability to read and write using Initiator requested performance"
" parameters";
case CDIO_MMC_FEATURE_LU_SN:
return "The Logical Unit Unique Identifier";
default:
{
static char buf[100];
if ( 0 != (i_feature & 0xFF00) ) {
snprintf( buf, sizeof(buf),
"Vendor-specific code %x", i_feature );
} else {
snprintf( buf, sizeof(buf),
"Unknown code %x", i_feature );
}
return buf;
}
}
}
/*!
Return a string containing the name of the given feature profile.
*/
const char *mmc_feature_profile2str( int i_feature_profile )
{
switch(i_feature_profile) {
case CDIO_MMC_FEATURE_PROF_NON_REMOVABLE:
return "Non-removable";
case CDIO_MMC_FEATURE_PROF_REMOVABLE:
return "disk Re-writable; with removable media";
case CDIO_MMC_FEATURE_PROF_MO_ERASABLE:
return "Erasable Magneto-Optical disk with sector erase capability";
case CDIO_MMC_FEATURE_PROF_MO_WRITE_ONCE:
return "Write Once Magneto-Optical write once";
case CDIO_MMC_FEATURE_PROF_AS_MO:
return "Advance Storage Magneto-Optical";
case CDIO_MMC_FEATURE_PROF_CD_ROM:
return "Read only Compact Disc capable";
case CDIO_MMC_FEATURE_PROF_CD_R:
return "Write once Compact Disc capable";
case CDIO_MMC_FEATURE_PROF_CD_RW:
return "CD-RW Re-writable Compact Disc capable";
case CDIO_MMC_FEATURE_PROF_DVD_ROM:
return "Read only DVD";
case CDIO_MMC_FEATURE_PROF_DVD_R_SEQ:
return "Re-recordable DVD using Sequential recording";
case CDIO_MMC_FEATURE_PROF_DVD_RAM:
return "Re-writable DVD";
case CDIO_MMC_FEATURE_PROF_DVD_RW_RO:
return "Re-recordable DVD using Restricted Overwrite";
case CDIO_MMC_FEATURE_PROF_DVD_RW_SEQ:
return "Re-recordable DVD using Sequential recording";
case CDIO_MMC_FEATURE_PROF_DVD_PRW:
return "DVD+RW - DVD ReWritable";
case CDIO_MMC_FEATURE_RIGID_RES_OVERW:
return "Rigid Restricted Overwrite";
case CDIO_MMC_FEATURE_PROF_DVD_PR:
return "DVD+R - DVD Recordable";
case CDIO_MMC_FEATURE_PROF_DDCD_ROM:
return "Read only DDCD";
case CDIO_MMC_FEATURE_PROF_DVD_PR2:
return "DVD+R Double Layer - DVD Recordable Double Layer";
case CDIO_MMC_FEATURE_PROF_DDCD_R:
return "DDCD-R Write only DDCD";
case CDIO_MMC_FEATURE_PROF_DDCD_RW:
return "Re-Write only DDCD";
case CDIO_MMC_FEATURE_PROF_NON_CONFORM:
return "The Logical Unit does not conform to any Profile";
default:
{
static char buf[100];
snprintf(buf, sizeof(buf), "Unknown Profile %x", i_feature_profile);
return buf;
}
}
}
/*! /*!
* See if CD-ROM has feature with value value * See if CD-ROM has feature with value value
* @return true if we have the feature and false if not. * @return true if we have the feature and false if not.

View File

@@ -1,5 +1,5 @@
/* /*
$Id: util.c,v 1.34 2005/02/07 12:12:14 rocky Exp $ $Id: util.c,v 1.35 2005/02/08 04:14:28 rocky Exp $
Copyright (C) 2003, 2004, 2005 Rocky Bernstein <rocky@panix.com> Copyright (C) 2003, 2004, 2005 Rocky Bernstein <rocky@panix.com>
@@ -21,7 +21,7 @@
/* Miscellaneous things common to standalone programs. */ /* Miscellaneous things common to standalone programs. */
#include "util.h" #include "util.h"
#include <cdio/scsi_mmc.h> #include <cdio/mmc.h>
cdio_log_handler_t gl_default_cdio_log_handler = NULL; cdio_log_handler_t gl_default_cdio_log_handler = NULL;
char *source_name = NULL; char *source_name = NULL;
@@ -202,321 +202,146 @@ print_mmc_drive_features(CdIo_t *p_cdio)
uint8_t i_feature_additional = p[3]; uint8_t i_feature_additional = p[3];
i_feature = CDIO_MMC_GET_LEN16(p); i_feature = CDIO_MMC_GET_LEN16(p);
switch( i_feature ) {
{ uint8_t *q;
uint8_t *q; const char *feature_str = mmc_feature2str(i_feature);
case CDIO_MMC_FEATURE_PROFILE_LIST: report( stdout, "%s Feature\n", feature_str);
report( stdout, "Profile List Feature\n"); switch( i_feature )
for ( q = p+4 ; q < p + i_feature_additional ; q += 4 ) { {
int i_profile=CDIO_MMC_GET_LEN16(q); case CDIO_MMC_FEATURE_PROFILE_LIST:
switch (i_profile) { for ( q = p+4 ; q < p + i_feature_additional ; q += 4 ) {
case CDIO_MMC_FEATURE_PROF_NON_REMOVABLE: int i_profile=CDIO_MMC_GET_LEN16(q);
report( stdout, const char *feature_profile_str =
"\tRe-writable disk, capable of changing behavior"); mmc_feature_profile2str(i_profile);
break; report( stdout, "\t%s", feature_profile_str );
case CDIO_MMC_FEATURE_PROF_REMOVABLE: if (q[2] & 1) {
report( stdout, report( stdout, " - on");
"\tdisk Re-writable; with removable media"); }
break; report( stdout, "\n");
case CDIO_MMC_FEATURE_PROF_MO_ERASABLE:
report( stdout,
"\tErasable Magneto-Optical disk with sector erase capability");
break;
case CDIO_MMC_FEATURE_PROF_MO_WRITE_ONCE:
report( stdout,
"\tWrite Once Magneto-Optical write once");
break;
case CDIO_MMC_FEATURE_PROF_AS_MO:
report( stdout,
"\tAdvance Storage Magneto-Optical");
break;
case CDIO_MMC_FEATURE_PROF_CD_ROM:
report( stdout,
"\tRead only Compact Disc capable");
break;
case CDIO_MMC_FEATURE_PROF_CD_R:
report( stdout,
"\tWrite once Compact Disc capable");
break;
case CDIO_MMC_FEATURE_PROF_CD_RW:
report( stdout,
"\tCD-RW Re-writable Compact Disc capable");
break;
case CDIO_MMC_FEATURE_PROF_DVD_ROM:
report( stdout,
"\tRead only DVD");
break;
case CDIO_MMC_FEATURE_PROF_DVD_R_SEQ:
report( stdout,
"\tRe-recordable DVD using Sequential recording");
break;
case CDIO_MMC_FEATURE_PROF_DVD_RAM:
report( stdout,
"\tRe-writable DVD");
break;
case CDIO_MMC_FEATURE_PROF_DVD_RW_RO:
report( stdout,
"\tRe-recordable DVD using Restricted Overwrite");
break;
case CDIO_MMC_FEATURE_PROF_DVD_RW_SEQ:
report( stdout,
"\tRe-recordable DVD using Sequential recording");
break;
case CDIO_MMC_FEATURE_PROF_DVD_PRW:
report( stdout,
"\tDVD+RW - DVD ReWritable");
break;
case CDIO_MMC_FEATURE_RIGID_RES_OVERW:
report( stdout,
"\tRigid Restricted Overwrite");
break;
case CDIO_MMC_FEATURE_PROF_DVD_PR:
report( stdout,
"\tDVD+R - DVD Recordable");
break;
case CDIO_MMC_FEATURE_PROF_DDCD_ROM:
report( stdout,
"\tRead only DDCD");
break;
case CDIO_MMC_FEATURE_PROF_DVD_PR2:
report( stdout,
"\tDVD+R Double Layer - DVD Recordable Double Layer");
break;
case CDIO_MMC_FEATURE_PROF_DDCD_R:
report( stdout,
"\tDDCD-R Write only DDCD");
break;
case CDIO_MMC_FEATURE_PROF_DDCD_RW:
report( stdout,
"\tRe-Write only DDCD");
break;
case CDIO_MMC_FEATURE_PROF_NON_CONFORM:
report( stdout,
"\tThe Logical Unit does not conform to any Profile.");
break;
default:
report( stdout,
"\tUnknown Profile %x", i_profile);
break;
}
if (q[2] & 1) {
report( stdout, " - on");
} }
report( stdout, "\n"); report( stdout, "\n");
}
report( stdout, "\n"); break;
case CDIO_MMC_FEATURE_CORE:
break; {
case CDIO_MMC_FEATURE_CORE: uint8_t *q = p+4;
{ uint32_t i_interface_standard = CDIO_MMC_GET_LEN32(q);
uint8_t *q = p+4; switch(i_interface_standard) {
uint32_t i_interface_standard = CDIO_MMC_GET_LEN32(q); case CDIO_MMC_FEATURE_INTERFACE_UNSPECIFIED:
report( stdout, "Core Feature\n"); report( stdout, "\tunspecified interface\n");
switch(i_interface_standard) { break;
case CDIO_MMC_FEATURE_INTERFACE_UNSPECIFIED: case CDIO_MMC_FEATURE_INTERFACE_SCSI:
report( stdout, "\tunspecified interface\n"); report( stdout, "\tSCSI interface\n");
break;
case CDIO_MMC_FEATURE_INTERFACE_ATAPI:
report( stdout, "\tATAPI interface\n");
break;
case CDIO_MMC_FEATURE_INTERFACE_IEEE_1394:
report( stdout, "\tIEEE 1394 interface\n");
break;
case CDIO_MMC_FEATURE_INTERFACE_IEEE_1394A:
report( stdout, "\tIEEE 1394A interface\n");
break;
case CDIO_MMC_FEATURE_INTERFACE_FIBRE_CH:
report( stdout, "\tFibre Channel interface\n");
}
report( stdout, "\n");
break; break;
case CDIO_MMC_FEATURE_INTERFACE_SCSI: }
report( stdout, "\tSCSI interface\n"); case CDIO_MMC_FEATURE_MORPHING:
report( stdout,
"\tOperational Change Request/Notification %ssupported\n",
(p[4] & 2) ? "": "not " );
report( stdout, "\t%synchronous GET EVENT/STATUS NOTIFICATION "
"supported\n",
(p[4] & 1) ? "As": "S" );
report( stdout, "\n");
break;
;
case CDIO_MMC_FEATURE_REMOVABLE_MEDIUM:
switch(p[4] >> 5) {
case 0:
report( stdout,
"\tCaddy/Slot type loading mechanism\n" );
break; break;
case CDIO_MMC_FEATURE_INTERFACE_ATAPI: case 1:
report( stdout, "\tATAPI interface\n"); report( stdout,
"\tTray type loading mechanism\n" );
break; break;
case CDIO_MMC_FEATURE_INTERFACE_IEEE_1394: case 2:
report( stdout, "\tIEEE 1394 interface\n"); report( stdout, "\tPop-up type loading mechanism\n");
break; break;
case CDIO_MMC_FEATURE_INTERFACE_IEEE_1394A: case 4:
report( stdout, "\tIEEE 1394A interface\n"); report( stdout,
"\tEmbedded changer with individually changeable discs\n");
break; break;
case CDIO_MMC_FEATURE_INTERFACE_FIBRE_CH: case 5:
report( stdout, "\tFibre Channel interface\n"); report( stdout,
"\tEmbedded changer using a magazine mechanism\n" );
break;
default:
report( stdout,
"\tUnknown changer mechanism\n" );
}
report( stdout,
"\tcan%s eject the medium or magazine via the normal "
"START/STOP command\n",
(p[4] & 8) ? "": "not" );
report( stdout, "\tcan%s be locked into the Logical Unit\n",
(p[4] & 1) ? "": "not" );
report( stdout, "\n" );
break;
case CDIO_MMC_FEATURE_CD_READ:
report( stdout, "\tC2 Error pointers are %ssupported\n",
(p[4] & 2) ? "": "not " );
report( stdout, "\tCD-Text is %ssupported\n",
(p[4] & 1) ? "": "not " );
report( stdout, "\n" );
break;
case CDIO_MMC_FEATURE_ENHANCED_DEFECT:
report( stdout, "\t%s-DRM mode is supported\n",
(p[4] & 1) ? "DRT": "Persistent" );
break;
case CDIO_MMC_FEATURE_CDDA_EXT_PLAY:
report( stdout, "\tSCAN command is %ssupported\n",
(p[4] & 4) ? "": "not ");
report( stdout,
"\taudio channels can %sbe muted separately\n",
(p[4] & 2) ? "": "not ");
report( stdout,
"\taudio channels can %shave separate volume levels\n",
(p[4] & 1) ? "": "not ");
{
uint8_t *q = p+6;
uint16_t i_vol_levels = CDIO_MMC_GET_LEN16(q);
report( stdout, "\t%d volume levels can be set\n", i_vol_levels );
} }
report( stdout, "\n"); report( stdout, "\n");
break; break;
} case CDIO_MMC_FEATURE_DVD_CSS:
case CDIO_MMC_FEATURE_MORPHING:
report( stdout, "Morphing Feature\n" );
report( stdout,
"\tOperational Change Request/Notification %ssupported\n",
(p[4] & 2) ? "": "not " );
report( stdout, "\t%synchronous GET EVENT/STATUS NOTIFICATION "
"supported\n",
(p[4] & 1) ? "As": "S" );
report( stdout, "\n");
break;
;
case CDIO_MMC_FEATURE_REMOVABLE_MEDIUM:
report( stdout, "Removable Medium Feature\n" );
switch(p[4] >> 5) {
case 0:
report( stdout,
"\tCaddy/Slot type loading mechanism\n" );
break;
case 1:
report( stdout,
"\tTray type loading mechanism\n" );
break;
case 2:
report( stdout, "\tPop-up type loading mechanism\n");
break;
case 4:
report( stdout,
"\tEmbedded changer with individually changeable discs\n");
break;
case 5:
report( stdout,
"\tEmbedded changer using a magazine mechanism\n" );
break;
default:
report( stdout,
"\tUnknown changer mechanism\n" );
}
report( stdout,
"\tcan%s eject the medium or magazine via the normal "
"START/STOP command\n",
(p[4] & 8) ? "": "not" );
report( stdout, "\tcan%s be locked into the Logical Unit\n",
(p[4] & 1) ? "": "not" );
report( stdout, "\n" );
break;
case CDIO_MMC_FEATURE_WRITE_PROTECT:
report( stdout, "Write Protect Feature\n" );
break;
case CDIO_MMC_FEATURE_RANDOM_READABLE:
report( stdout, "Random Readable Feature\n" );
break;
case CDIO_MMC_FEATURE_MULTI_READ:
report( stdout, "Multi-Read Feature\n" );
break;
case CDIO_MMC_FEATURE_CD_READ:
report( stdout, "CD Read Feature\n" );
report( stdout, "\tC2 Error pointers are %ssupported\n",
(p[4] & 2) ? "": "not " );
report( stdout, "\tCD-Text is %ssupported\n",
(p[4] & 1) ? "": "not " );
report( stdout, "\n" );
break;
case CDIO_MMC_FEATURE_DVD_READ:
report( stdout, "DVD Read Feature\n" );
break;
case CDIO_MMC_FEATURE_RANDOM_WRITABLE:
report( stdout, "Random Writable Feature\n" );
break;
case CDIO_MMC_FEATURE_INCR_WRITE:
report( stdout, "Incremental Streaming Writable Feature\n" );
break;
case CDIO_MMC_FEATURE_SECTOR_ERASE:
report( stdout, "Sector Erasable Feature\n" );
break;
case CDIO_MMC_FEATURE_FORMATABLE:
report( stdout, "Formattable Feature\n" );
break;
case CDIO_MMC_FEATURE_DEFECT_MGMT:
report( stdout,
"Management Ability of the Logical Unit/media system "
"to provide an apparently defect-free space.\n" );
break;
case CDIO_MMC_FEATURE_WRITE_ONCE:
report( stdout, "Write Once Feature\n" );
break;
case CDIO_MMC_FEATURE_RESTRICT_OVERW:
report( stdout, "Restricted Overwrite Feature\n" );
break;
case CDIO_MMC_FEATURE_CD_RW_CAV:
report( stdout, "CD-RW CAV Write Feature\n" );
break;
case CDIO_MMC_FEATURE_MRW:
report( stdout, "MRW Feature\n" );
break;
case CDIO_MMC_FEATURE_ENHANCED_DEFECT:
report( stdout, "Enhanced Defect Reporting\n" );
report( stdout, "\t%s-DRM mode is supported\n",
(p[4] & 1) ? "DRT": "Persistent" );
break;
case CDIO_MMC_FEATURE_DVD_PRW:
report( stdout, "DVD+RW Feature\n" );
break;
case CDIO_MMC_FEATURE_DVD_PR:
report( stdout, "DVD+R Feature\n" );
break;
case CDIO_MMC_FEATURE_CD_TAO:
report( stdout, "CD Track at Once Feature\n" );
break;
case CDIO_MMC_FEATURE_CD_SAO:
report( stdout, "CD Mastering (Session at Once) Feature\n" );
break;
case CDIO_MMC_FEATURE_DVD_R_RW_WRITE:
report( stdout, "DVD-R/RW Write Feature\n" );
break;
case CDIO_MMC_FEATURE_CD_RW_MEDIA_WRITE:
report( stdout, "CD-RW Media Write Support\n" );
break;
case CDIO_MMC_FEATURE_DVD_PR_2_LAYER:
report( stdout, "DVD+R Double Layer\n" );
break;
case CDIO_MMC_FEATURE_POWER_MGMT:
report( stdout,
"Initiator and device directed power management\n" );
break;
case CDIO_MMC_FEATURE_CDDA_EXT_PLAY:
report( stdout, "CD Audio External Play Feature\n" );
report( stdout, "\tSCAN command is %ssupported\n",
(p[4] & 4) ? "": "not ");
report( stdout,
"\taudio channels can %sbe muted separately\n",
(p[4] & 2) ? "": "not ");
report( stdout,
"\taudio channels can %shave separate volume levels\n",
(p[4] & 1) ? "": "not ");
{
uint8_t *q = p+6;
uint16_t i_vol_levels = CDIO_MMC_GET_LEN16(q);
report( stdout, "\t%d volume levels can be set\n", i_vol_levels );
}
report( stdout, "\n");
break;
case CDIO_MMC_FEATURE_MCODE_UPGRADE:
report( stdout, "Ability for the device to accept new microcode via "
"the interface\n" );
break;
case CDIO_MMC_FEATURE_TIME_OUT:
report( stdout, "Ability to respond to all commands within a "
"specific time\n" );
break;
case CDIO_MMC_FEATURE_DVD_CSS:
report( stdout, "Ability to perform DVD CSS/CPPM authentication and"
" RPC\n" );
#if 0 #if 0
report( stdout, "\tMedium does%s have Content Scrambling (CSS/CPPM)\n", report( stdout, "\tMedium does%s have Content Scrambling (CSS/CPPM)\n",
(p[2] & 1) ? "": "not " ); (p[2] & 1) ? "": "not " );
#endif #endif
report( stdout, "\tCSS version %d\n", p[7] ); report( stdout, "\tCSS version %d\n", p[7] );
report( stdout, "\t\n"); report( stdout, "\t\n");
break; break;
case CDIO_MMC_FEATURE_RT_STREAMING: case CDIO_MMC_FEATURE_LU_SN: {
report( stdout, uint8_t i_serial = *(p+3);
"Ability to read and write using Initiator requested performance parameters\n"); char serial[257] = { '\0', };
break;
case CDIO_MMC_FEATURE_LU_SN: { memcpy(serial, p+4, i_serial );
uint8_t i_serial = *(p+3); report( stdout, "\t%s\n\n", serial );
char serial[257] = { '\0', };
break;
report( stdout, "The Logical Unit has a unique identifier:\n" );
memcpy(serial, p+4, i_serial );
report( stdout, "\t%s\n\n", serial );
break;
}
default:
if ( 0 != (i_feature & 0xFF00) ) {
report( stdout, "Vendor-specific feature code %x\n", i_feature );
} else {
report( stdout, "Unknown feature code %x\n", i_feature );
} }
default:
} report( stdout, "\n");
break;
}
}
p += i_feature_additional + 4; p += i_feature_additional + 4;
} }
} else { } else {