From 212b701ef6cbf3f1d55f66f7dcb093fac37f0ffb Mon Sep 17 00:00:00 2001 From: rocky Date: Sun, 18 Jul 2004 03:35:07 +0000 Subject: [PATCH] MMC mode page capabilities gone over. Some more were added. --- example/sample2.c | 6 +++--- include/cdio/types.h | 27 +++++++++++++++------------ lib/_cdio_linux.c | 6 +++--- lib/_cdio_sunos.c | 13 +++++++------ lib/scsi_mmc.c | 10 +++++++--- src/util.c | 6 +++--- test/cdda.right | 2 +- test/check_opts0.right | 2 +- test/check_opts1.right | 2 +- test/check_opts2.right | 2 +- test/check_opts3.right | 2 +- test/check_opts4.right | 2 +- test/check_opts5.right | 2 +- test/check_opts6.right | 2 +- test/check_opts7.right | 2 +- test/isofs-m1.right | 2 +- test/vcd_demo.right | 35 ++++++++++++++++++----------------- test/videocd.right | 2 +- 18 files changed, 67 insertions(+), 58 deletions(-) diff --git a/example/sample2.c b/example/sample2.c index 4bbde3ba..b2466900 100644 --- a/example/sample2.c +++ b/example/sample2.c @@ -1,5 +1,5 @@ /* - $Id: sample2.c,v 1.10 2004/07/17 22:16:46 rocky Exp $ + $Id: sample2.c,v 1.11 2004/07/18 03:35:07 rocky Exp $ Copyright (C) 2003, 2004 Rocky Bernstein @@ -48,8 +48,8 @@ print_drive_capabilities(cdio_drive_read_cap_t i_read_cap, printf(_("Hardware : %s\n"), i_misc_cap & CDIO_DRIVE_CAP_MISC_FILE ? "Disk Image" : "CD-ROM or DVD"); - printf(_("Can open tray : %s\n"), - i_misc_cap & CDIO_DRIVE_CAP_MISC_OPEN_TRAY ? "Yes" : "No"); + printf(_("Can eject : %s\n"), + i_misc_cap & CDIO_DRIVE_CAP_MISC_EJECT ? "Yes" : "No"); printf(_("Can close tray : %s\n"), i_misc_cap & CDIO_DRIVE_CAP_MISC_CLOSE_TRAY ? "Yes" : "No"); printf(_("Can disable manual eject : %s\n"), diff --git a/include/cdio/types.h b/include/cdio/types.h index c32e6c17..8cd06d56 100644 --- a/include/cdio/types.h +++ b/include/cdio/types.h @@ -1,5 +1,5 @@ /* - $Id: types.h,v 1.19 2004/07/17 22:16:47 rocky Exp $ + $Id: types.h,v 1.20 2004/07/18 03:35:07 rocky Exp $ Copyright (C) 2000 Herbert Valerio Riedel Copyright (C) 2002, 2003, 2004 Rocky Bernstein @@ -290,7 +290,7 @@ extern "C" { #define CDIO_DRIVE_CAP_MISC_CLOSE_TRAY 0x00001 /**< caddy systems can't close... */ -#define CDIO_DRIVE_CAP_MISC_OPEN_TRAY 0x00002 /**< but can eject. */ +#define CDIO_DRIVE_CAP_MISC_EJECT 0x00002 /**< but can eject. */ #define CDIO_DRIVE_CAP_MISC_LOCK 0x00004 /**< disable manual eject */ #define CDIO_DRIVE_CAP_MISC_SELECT_SPEED 0x00008 /**< programmable speed */ #define CDIO_DRIVE_CAP_MISC_SELECT_DISC 0x00010 /**< select disc from @@ -298,21 +298,24 @@ extern "C" { #define CDIO_DRIVE_CAP_MISC_MULTI_SESSION 0x00020 /**< read sessions>1 */ #define CDIO_DRIVE_CAP_MISC_MEDIA_CHANGED 0x00080 /**< media changed */ #define CDIO_DRIVE_CAP_MISC_RESET 0x00100 /**< hard reset device */ +#define CDIO_DRIVE_CAP_MCN 0x00200 /**< can read MCN */ +#define CDIO_DRIVE_CAP_ISRC 0x00200 /**< can read ISRC */ #define CDIO_DRIVE_CAP_MISC_FILE 0x20000 /**< drive is really a file, i.e a CD file image */ /*! Reading masks.. */ #define CDIO_DRIVE_CAP_READ_AUDIO 0x00001 /**< drive can play CD audio */ -#define CDIO_DRIVE_CAP_READ_CD_G 0x00002 /**< drive can read CD G */ -#define CDIO_DRIVE_CAP_READ_CD_R 0x00004 /**< drive can read CD-R */ -#define CDIO_DRIVE_CAP_READ_CD_RW 0x00008 /**< drive can read CD-RW */ -#define CDIO_DRIVE_CAP_READ_DVD_R 0x00010 /**< drive can read DVD-R */ -#define CDIO_DRIVE_CAP_READ_DVD_PR 0x00020 /**< drive can read DVD+R */ -#define CDIO_DRIVE_CAP_READ_DVD_RAM 0x00040 /**< drive can read DVD-RAM */ -#define CDIO_DRIVE_CAP_READ_DVD_ROM 0x00080 /**< drive can read DVD-ROM */ -#define CDIO_DRIVE_CAP_READ_DVD_RW 0x00100 /**< drive can read DVD-RW */ -#define CDIO_DRIVE_CAP_READ_DVD_RPW 0x00200 /**< drive can read DVD+RW */ -#define CDIO_DRIVE_CAP_READ_C2_ERRS 0x00400 /**< has C2 error correction */ +#define CDIO_DRIVE_CAP_READ_CD_DA 0x00002 /**< drive can read CD-DA */ +#define CDIO_DRIVE_CAP_READ_CD_G 0x00004 /**< drive can read CD G */ +#define CDIO_DRIVE_CAP_READ_CD_R 0x00008 /**< drive can read CD-R */ +#define CDIO_DRIVE_CAP_READ_CD_RW 0x00010 /**< drive can read CD-RW */ +#define CDIO_DRIVE_CAP_READ_DVD_R 0x00020 /**< drive can read DVD-R */ +#define CDIO_DRIVE_CAP_READ_DVD_PR 0x00040 /**< drive can read DVD+R */ +#define CDIO_DRIVE_CAP_READ_DVD_RAM 0x00080 /**< drive can read DVD-RAM */ +#define CDIO_DRIVE_CAP_READ_DVD_ROM 0x00100 /**< drive can read DVD-ROM */ +#define CDIO_DRIVE_CAP_READ_DVD_RW 0x00200 /**< drive can read DVD-RW */ +#define CDIO_DRIVE_CAP_READ_DVD_RPW 0x00400 /**< drive can read DVD+RW */ +#define CDIO_DRIVE_CAP_READ_C2_ERRS 0x00800 /**< has C2 error correction */ /*! Writing masks.. */ #define CDIO_DRIVE_CAP_WRITE_CD_R 0x00001 /**< drive can write CD-R */ diff --git a/lib/_cdio_linux.c b/lib/_cdio_linux.c index 0b99d503..ba4d66b3 100644 --- a/lib/_cdio_linux.c +++ b/lib/_cdio_linux.c @@ -1,5 +1,5 @@ /* - $Id: _cdio_linux.c,v 1.68 2004/07/17 22:16:47 rocky Exp $ + $Id: _cdio_linux.c,v 1.69 2004/07/18 03:35:07 rocky Exp $ Copyright (C) 2001 Herbert Valerio Riedel Copyright (C) 2002, 2003, 2004 Rocky Bernstein @@ -27,7 +27,7 @@ # include "config.h" #endif -static const char _rcsid[] = "$Id: _cdio_linux.c,v 1.68 2004/07/17 22:16:47 rocky Exp $"; +static const char _rcsid[] = "$Id: _cdio_linux.c,v 1.69 2004/07/18 03:35:07 rocky Exp $"; #include @@ -974,7 +974,7 @@ _get_drive_cap_linux (const void *env, if (i_drivetype & CDC_CLOSE_TRAY) *p_misc_cap |= CDIO_DRIVE_CAP_MISC_CLOSE_TRAY; if (i_drivetype & CDC_OPEN_TRAY) - *p_misc_cap |= CDIO_DRIVE_CAP_MISC_OPEN_TRAY; + *p_misc_cap |= CDIO_DRIVE_CAP_MISC_EJECT; if (i_drivetype & CDC_LOCK) *p_misc_cap |= CDIO_DRIVE_CAP_MISC_LOCK; if (i_drivetype & CDC_SELECT_SPEED) diff --git a/lib/_cdio_sunos.c b/lib/_cdio_sunos.c index c5670db5..3e8b5d65 100644 --- a/lib/_cdio_sunos.c +++ b/lib/_cdio_sunos.c @@ -1,5 +1,5 @@ /* - $Id: _cdio_sunos.c,v 1.53 2004/07/17 22:16:47 rocky Exp $ + $Id: _cdio_sunos.c,v 1.54 2004/07/18 03:35:07 rocky Exp $ Copyright (C) 2001 Herbert Valerio Riedel Copyright (C) 2002, 2003, 2004 Rocky Bernstein @@ -38,7 +38,7 @@ #ifdef HAVE_SOLARIS_CDROM -static const char _rcsid[] = "$Id: _cdio_sunos.c,v 1.53 2004/07/17 22:16:47 rocky Exp $"; +static const char _rcsid[] = "$Id: _cdio_sunos.c,v 1.54 2004/07/18 03:35:07 rocky Exp $"; #ifdef HAVE_GLOB_H #include @@ -630,7 +630,6 @@ _get_drive_cap_solaris (const void *user_data, int lenData = ((unsigned int)buf[0] << 8) + buf[1]; uint8_t *pMax = buf + 256; - i_drivetype = 0; /* set to first sense mask, and then walk through the masks */ p = buf + 8; while( (p < &(buf[2+lenData])) && (p < pMax) ) { @@ -654,9 +653,11 @@ _get_drive_cap_solaris (const void *user_data, } else { cdio_info("%s: %s\n", "error in ioctl USCSICMD MODE_SELECT", strerror(errno)); - i_drivetype = CDIO_DRIVE_CAP_CD_AUDIO | CDIO_DRIVE_CAP_UNKNOWN; + *p_read_cap = CDIO_DRIVE_CAP_ERROR; + *p_write_cap = CDIO_DRIVE_CAP_ERROR; + *p_misc_cap = CDIO_DRIVE_CAP_ERROR; } - return i_drivetype; + return; } /*! @@ -920,7 +921,7 @@ cdio_open_am_solaris (const char *psz_orig_source, const char *access_mode) _data->b_cdtext_init = false; if (NULL == psz_orig_source) { - psz_source=_get_default_device_solaris(); + psz_source = cdio_get_default_device_solaris(); if (NULL == psz_source) return NULL; _set_arg_solaris(_data, "source", psz_source); free(psz_source); diff --git a/lib/scsi_mmc.c b/lib/scsi_mmc.c index 4f865908..d3928b0f 100644 --- a/lib/scsi_mmc.c +++ b/lib/scsi_mmc.c @@ -1,6 +1,6 @@ /* Common MMC routines. - $Id: scsi_mmc.c,v 1.4 2004/07/17 22:16:47 rocky Exp $ + $Id: scsi_mmc.c,v 1.5 2004/07/18 03:35:07 rocky Exp $ Copyright (C) 2004 Rocky Bernstein @@ -38,12 +38,16 @@ cdio_get_drive_cap_mmc(const uint8_t *p, cdio_drive_misc_cap_t *p_misc_cap) { /* Reader */ + if (p[2] & 0x01) *p_read_cap |= CDIO_DRIVE_CAP_READ_CD_R; if (p[2] & 0x02) *p_read_cap |= CDIO_DRIVE_CAP_READ_CD_RW; if (p[2] & 0x08) *p_read_cap |= CDIO_DRIVE_CAP_READ_DVD_ROM; - if (p[5] & 0x01) *p_read_cap |= CDIO_DRIVE_CAP_READ_AUDIO; + if (p[4] & 0x01) *p_read_cap |= CDIO_DRIVE_CAP_READ_AUDIO; + if (p[5] & 0x01) *p_read_cap |= CDIO_DRIVE_CAP_READ_CD_DA; + if (p[5] & 0x10) *p_read_cap |= CDIO_DRIVE_CAP_READ_C2_ERRS; /* Writer */ if (p[3] & 0x01) *p_write_cap |= CDIO_DRIVE_CAP_WRITE_CD_R; + if (p[3] & 0x02) *p_write_cap |= CDIO_DRIVE_CAP_WRITE_CD_RW; if (p[3] & 0x10) *p_write_cap |= CDIO_DRIVE_CAP_WRITE_DVD_R; if (p[3] & 0x20) *p_write_cap |= CDIO_DRIVE_CAP_WRITE_DVD_RAM; @@ -51,7 +55,7 @@ cdio_get_drive_cap_mmc(const uint8_t *p, if (p[4] & 0x40) *p_misc_cap |= CDIO_DRIVE_CAP_MISC_MULTI_SESSION; if (p[6] & 0x01) *p_misc_cap |= CDIO_DRIVE_CAP_MISC_LOCK; - if (p[6] & 0x08) *p_misc_cap |= CDIO_DRIVE_CAP_MISC_OPEN_TRAY; + if (p[6] & 0x08) *p_misc_cap |= CDIO_DRIVE_CAP_MISC_EJECT; if (p[6] >> 5 != 0) *p_misc_cap |= CDIO_DRIVE_CAP_MISC_CLOSE_TRAY; } diff --git a/src/util.c b/src/util.c index 4d094fe6..0abbf257 100644 --- a/src/util.c +++ b/src/util.c @@ -1,5 +1,5 @@ /* - $Id: util.c,v 1.10 2004/07/17 22:16:48 rocky Exp $ + $Id: util.c,v 1.11 2004/07/18 03:35:07 rocky Exp $ Copyright (C) 2003, 2004 Rocky Bernstein @@ -97,8 +97,8 @@ void print_drive_capabilities(cdio_drive_read_cap_t i_read_cap, printf(_("Hardware : %s\n"), i_misc_cap & CDIO_DRIVE_CAP_MISC_FILE ? "Disk Image" : "CD-ROM or DVD"); - printf(_("Can open tray : %s\n"), - i_misc_cap & CDIO_DRIVE_CAP_MISC_OPEN_TRAY ? "Yes" : "No"); + printf(_("Can eject : %s\n"), + i_misc_cap & CDIO_DRIVE_CAP_MISC_EJECT ? "Yes" : "No"); printf(_("Can close tray : %s\n"), i_misc_cap & CDIO_DRIVE_CAP_MISC_CLOSE_TRAY ? "Yes" : "No"); printf(_("Can disable manual eject : %s\n"), diff --git a/test/cdda.right b/test/cdda.right index fc06ee90..946d4f72 100644 --- a/test/cdda.right +++ b/test/cdda.right @@ -2,7 +2,7 @@ This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. Hardware : Disk Image -Can open tray : No +Can eject : No Can close tray : No Can disable manual eject : No Can select juke-box disc : No diff --git a/test/check_opts0.right b/test/check_opts0.right index 3450b7d6..0031de49 100644 --- a/test/check_opts0.right +++ b/test/check_opts0.right @@ -2,7 +2,7 @@ This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. Hardware : Disk Image -Can open tray : No +Can eject : No Can close tray : No Can disable manual eject : No Can select juke-box disc : No diff --git a/test/check_opts1.right b/test/check_opts1.right index 3450b7d6..0031de49 100644 --- a/test/check_opts1.right +++ b/test/check_opts1.right @@ -2,7 +2,7 @@ This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. Hardware : Disk Image -Can open tray : No +Can eject : No Can close tray : No Can disable manual eject : No Can select juke-box disc : No diff --git a/test/check_opts2.right b/test/check_opts2.right index a168a1e7..b52037cd 100644 --- a/test/check_opts2.right +++ b/test/check_opts2.right @@ -2,7 +2,7 @@ This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. Hardware : Disk Image -Can open tray : No +Can eject : No Can close tray : No Can disable manual eject : No Can select juke-box disc : No diff --git a/test/check_opts3.right b/test/check_opts3.right index a168a1e7..b52037cd 100644 --- a/test/check_opts3.right +++ b/test/check_opts3.right @@ -2,7 +2,7 @@ This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. Hardware : Disk Image -Can open tray : No +Can eject : No Can close tray : No Can disable manual eject : No Can select juke-box disc : No diff --git a/test/check_opts4.right b/test/check_opts4.right index 1137b0f1..42db33e5 100644 --- a/test/check_opts4.right +++ b/test/check_opts4.right @@ -2,7 +2,7 @@ This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. Hardware : Disk Image -Can open tray : No +Can eject : No Can close tray : No Can disable manual eject : No Can select juke-box disc : No diff --git a/test/check_opts5.right b/test/check_opts5.right index 1137b0f1..42db33e5 100644 --- a/test/check_opts5.right +++ b/test/check_opts5.right @@ -2,7 +2,7 @@ This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. Hardware : Disk Image -Can open tray : No +Can eject : No Can close tray : No Can disable manual eject : No Can select juke-box disc : No diff --git a/test/check_opts6.right b/test/check_opts6.right index 1137b0f1..42db33e5 100644 --- a/test/check_opts6.right +++ b/test/check_opts6.right @@ -2,7 +2,7 @@ This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. Hardware : Disk Image -Can open tray : No +Can eject : No Can close tray : No Can disable manual eject : No Can select juke-box disc : No diff --git a/test/check_opts7.right b/test/check_opts7.right index 1137b0f1..42db33e5 100644 --- a/test/check_opts7.right +++ b/test/check_opts7.right @@ -2,7 +2,7 @@ This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. Hardware : Disk Image -Can open tray : No +Can eject : No Can close tray : No Can disable manual eject : No Can select juke-box disc : No diff --git a/test/isofs-m1.right b/test/isofs-m1.right index bfe79b3f..55d2d5f3 100644 --- a/test/isofs-m1.right +++ b/test/isofs-m1.right @@ -2,7 +2,7 @@ This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. Hardware : Disk Image -Can open tray : No +Can eject : No Can close tray : No Can disable manual eject : No Can select juke-box disc : No diff --git a/test/vcd_demo.right b/test/vcd_demo.right index f86c5d01..718c7664 100644 --- a/test/vcd_demo.right +++ b/test/vcd_demo.right @@ -1,26 +1,27 @@ This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. -Hardware : Disk Image -Can open tray : No -Can close tray : No -Can disable manual eject: No -Can select juke-box disc: No +Hardware : Disk Image +Can eject : No +Can close tray : No +Can disable manual eject : No +Can select juke-box disc : No -Can set drive speed : No -Can detect if CD changed: No -Can read Media Cat. No. : Yes -Can read sessions > 1 . : No -Can hard reset device : No +Can set drive speed : No +Can detect if CD changed : No +Can read multiple sessions : No +Can hard reset device : No -Compact Disc : Yes - Can play audio : Yes - Can read CD-RW : No - Can write CD-R : No +Reading.... + Can play audio : Yes + Can read CD-R : Yes + Can read CD-RW : Yes + Can read DVD-ROM : No -Digital Versital Disc : No - Can write DVD-R : No - Can write DVD-RAM : No +Writing.... + Can write CD-RW : Yes + Can write DVD-R : No + Can write DVD-RAM : No __________________________________ CD-ROM Track List (1 - 3) #: MSF LSN Type Green? diff --git a/test/videocd.right b/test/videocd.right index b188a703..bb00c71a 100644 --- a/test/videocd.right +++ b/test/videocd.right @@ -2,7 +2,7 @@ This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. Hardware : Disk Image -Can open tray : No +Can eject : No Can close tray : No Can disable manual eject : No Can select juke-box disc : No