libcdio-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Libcdio-devel] Re: Submission of new mmc function for libcdio


From: Frank Endres
Subject: [Libcdio-devel] Re: Submission of new mmc function for libcdio
Date: Wed, 27 Jan 2010 17:10:28 -0100

Hi !

I use libcdio for only a short time, and found it easy to use (good examples
and documentation), except for mmc commands. Now, after long searches, I
have understood how it works, and I have a suggestion:
add a link to "http://www.13thmonkey.org/documentation/SCSI/mmc-r10a.pdf,";
on your doc (mmc.h - if not already done, maybe I haven't looked in the
right place).

I want to use libcdio as an alternate method for device and media detection
in my SimpleBurn project (http://simpleburn.tuxfamily.org - wait untill next
version to have that libcdio detection feature). I wanted a function to tell
me if a CD is rewritable or not, and didn't find it, so I wrote one (I have
seen no other solution than using a mmc command); if you find it usefull,
you can add it into libcdio:

/*!
   Detects if a disc (CD or DVD) is erasable or not.
   See http://www.13thmonkey.org/documentation/SCSI/mmc-r10a.pdf, tables
129-134.
   @return true if the disc is erasable (rewritable), false otherwise.
 */
bool
mmc_get_disc_erasable ( const CdIo_t *p_cdio) {
  mmc_cdb_t cdb = {{0, }};

  uint8_t buf[42] = { 0, };

  CDIO_MMC_SET_COMMAND (cdb.field, CDIO_MMC_GPCMD_READ_DISC_INFO);
  CDIO_MMC_SET_READ_LENGTH8 (cdb.field, sizeof(buf));

  mmc_run_cmd (p_cdio, 0, &cdb, SCSI_MMC_DATA_READ, sizeof(buf), &buf);

  if (buf[2] & 0x10) //works even if the 'mmc_run_cmd' command fails
    return true;
  else
    return false;
}

If I have understood the source, even cdw doesn't use libcdio to detect a
device type (it uses dvd+rw-tools or cdrtools output I guess). It could be
interesting to add a feature to get more information on discs: (add some
values to (mmc)discmode_t enumeration for example: CDIO_DISC_MODE_CD_R,
CDIO_DISC_MODE_CD_RW, CDIO_DISC_MODE_CD_ROM), and a new function like:
"mmcdiscmode_t mmc_get_discmode (CdIo *p_cdio)". Tell me if you are
interested in this feature.

Best regards !

Frank Endres


reply via email to

[Prev in Thread] Current Thread [Next in Thread]