libcdio-devel
[Top][All Lists]
Advanced

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

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


From: Rocky Bernstein
Subject: Re: [Libcdio-devel] Re: Submission of new mmc function for libcdio
Date: Thu, 28 Jan 2010 04:32:33 -0500

It sounds like there is no disagreement about whether there *should* be a
function to tell
me if a CD is rewritable or not, just *how*. In fact, given the discussion
so far and the complexity of the answers, it seems to scream to me that it *
needs* be a library routine, because it seems to be more complex than I
think most programmers should have to know.

Frank kindly offers a possible implementation that works without needing
SCSI sense data which isn't universal in all the libcdio drivers yet. And it
sounds like Thomas may have thoughts on how (in some cases?) one might do
better when one has SCSI sense data.

Since the routine that reports SCSI sense data reports success or failure in
its ability to get the sense data, perhaps we could get the best both
worlds?

So Thomas, would you suggest an implementation of mmc_get_disc_erasable()
that works whether SCSI sense data is available and falls back to what Frank
suggests if not?

Any other thoughts or comments?


On Wed, Jan 27, 2010 at 4:11 PM, Thomas Schmitt <address@hidden> wrote:

> Hi,
>
> i am not in charge for submissions.
> Nevertheless my two cents about MMC:
>
> > http://www.13thmonkey.org/documentation/SCSI/
>
> 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,
> currently.
> <cdio/mmc.h>:
>
>  /** 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
> Definitions).
> 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 :)
>
> Thomas
>
>
>
>


reply via email to

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