[Top][All Lists]

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

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

From: Thomas Schmitt
Subject: [Libcdio-devel] Re: Submission of new mmc function for libcdio
Date: Wed, 27 Jan 2010 22:11:43 +0100


i am not in charge for submissions.
Nevertheless my two cents about MMC:


Consider to read at least up to MMC-3.
MMC-1 is ok for most CD things, but MMC-2 and
MMC-3 added more CD info.
MMC-5 is current, but it lacks some CD info
that was present in earlier versions.

>   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

One should examine the sense reply of the
command in order to determine whether its payload 
is valid or not.
See MMC-1 Annex A, Additional sense codei for CD.

In the git version of libcdio you can get
the sense bytes by mmc_last_cmd_sense().
This is implemented for Linux and FreeBSD,

  /** Obtain the SCSI sense reply of the most-recently-performed MMC command.
      These bytes give an indication of possible problems which occured in
      the drive while the command was performed. With some commands they tell
      about the current state of the drive (e.g. 00h TEST UNIT READY).
      @param sense       returns the sense bytes received from the drive.
                         This is allocated memory or NULL if no sense bytes are
                         available. Dispose non-NULL pointers by free() when
                         no longer needed.
                         See SPC-3 4.5.3 Fixed format sense data.
                         SCSI error codes as of SPC-3 Annex D, MMC-5 Annex F:
                         sense[2]&15 = Key , sense[12] = ASC , sense[13] = ASCQ
      @return            number of valid bytes in sense,
                         0 in case of no sense bytes available,
                         <0 in case of internal error.
  int mmc_last_cmd_sense ( const CdIo_t *p_cdio, unsigned char **sense);

A more general method for media type detection
is the Current Profile from 46h GET CONFIGURATION
which appears in MMC-2 (see also 5.4. Profile
It actually tells the drive capabilities with
the media, not the media capabilities themselves.
But a CD-ROM drive is allowed to report a CD-RW
as non-erasable, too.

Have a nice day :)


reply via email to

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