Add interface for retrieval of last SCSI sense command.

This commit is contained in:
R. Bernstein
2009-12-25 08:36:02 -05:00
parent 507beb23a1
commit c498cec5e1
8 changed files with 216 additions and 156 deletions

7
NEWS
View File

@@ -1,4 +1,9 @@
$Id: NEWS,v 1.124 2008/10/20 01:10:19 rocky Exp $ version 0.83 (git)
- Add Recording and retrieval of SCSI sense reply.
- Add Write/burning interface.
- Tolerance for OS's without timezone in their struct tm (e.g. Solaris)
added iso9660_set_{d,l}time_with_timezone
version 0.82 version 0.82
2009-10-27 2009-10-27

3
THANKS
View File

@@ -62,6 +62,9 @@ Svend S. Sorensen <ssorensen at fastmail.fm>
xboxmediacenter team (www.xboxmediacenter.de) xboxmediacenter team (www.xboxmediacenter.de)
X-Box detection and XDF filesystem things X-Box detection and XDF filesystem things
Thomas Schmitt
Recording and retrieval of SCSI sense reply. Write/burning interface.
Daniel Schwarz Daniel Schwarz
log-summary option in cd-paranoia. log-summary option in cd-paranoia.

View File

@@ -1,7 +1,5 @@
/* /*
$Id: mmc.h,v 1.32 2008/05/09 06:13:32 edsdead Exp $ Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008, 2009
Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008
Rocky Bernstein <rocky@gnu.org> Rocky Bernstein <rocky@gnu.org>
This program is free software: you can redistribute it and/or modify This program is free software: you can redistribute it and/or modify
@@ -63,100 +61,100 @@ extern "C" {
*/ */
typedef enum { typedef enum {
CDIO_MMC_GPCMD_INQUIRY = 0x12, /**< Request drive CDIO_MMC_GPCMD_INQUIRY = 0x12, /**< Request drive
information. */ information. */
CDIO_MMC_GPCMD_MODE_SELECT_6 = 0x15, /**< Select medium CDIO_MMC_GPCMD_MODE_SELECT_6 = 0x15, /**< Select medium
(6 bytes). */ (6 bytes). */
CDIO_MMC_GPCMD_MODE_SENSE_6 = 0x1a, /**< Get medium or device CDIO_MMC_GPCMD_MODE_SENSE_6 = 0x1a, /**< Get medium or device
information. Should be issued information. Should be issued
before MODE SELECT to get before MODE SELECT to get
mode support or save current mode support or save current
settings. (6 bytes). */ settings. (6 bytes). */
CDIO_MMC_GPCMD_START_STOP = 0x1b, /**< Enable/disable Disc CDIO_MMC_GPCMD_START_STOP = 0x1b, /**< Enable/disable Disc
operations. (6 bytes). */ operations. (6 bytes). */
CDIO_MMC_GPCMD_ALLOW_MEDIUM_REMOVAL = 0x1e, /**< Enable/disable Disc CDIO_MMC_GPCMD_ALLOW_MEDIUM_REMOVAL = 0x1e, /**< Enable/disable Disc
removal. (6 bytes). */ removal. (6 bytes). */
/** Group 2 Commands (CDB's here are 10-bytes) /** Group 2 Commands (CDB's here are 10-bytes)
*/ */
CDIO_MMC_GPCMD_READ_10 = 0x28, /**< Read data from drive CDIO_MMC_GPCMD_READ_10 = 0x28, /**< Read data from drive
(10 bytes). */ (10 bytes). */
CDIO_MMC_GPCMD_READ_SUBCHANNEL = 0x42, /**< Read Sub-Channel data. CDIO_MMC_GPCMD_READ_SUBCHANNEL = 0x42, /**< Read Sub-Channel data.
(10 bytes). */ (10 bytes). */
CDIO_MMC_GPCMD_READ_TOC = 0x43, /**< READ TOC/PMA/ATIP. CDIO_MMC_GPCMD_READ_TOC = 0x43, /**< READ TOC/PMA/ATIP.
(10 bytes). */ (10 bytes). */
CDIO_MMC_GPCMD_READ_HEADER = 0x44, CDIO_MMC_GPCMD_READ_HEADER = 0x44,
CDIO_MMC_GPCMD_PLAY_AUDIO_10 = 0x45, /**< Begin audio playing at CDIO_MMC_GPCMD_PLAY_AUDIO_10 = 0x45, /**< Begin audio playing at
current position current position
(10 bytes). */ (10 bytes). */
CDIO_MMC_GPCMD_GET_CONFIGURATION = 0x46, /**< Get drive Capabilities CDIO_MMC_GPCMD_GET_CONFIGURATION = 0x46, /**< Get drive Capabilities
(10 bytes) */ (10 bytes) */
CDIO_MMC_GPCMD_PLAY_AUDIO_MSF = 0x47, /**< Begin audio playing at CDIO_MMC_GPCMD_PLAY_AUDIO_MSF = 0x47, /**< Begin audio playing at
specified MSF (10 specified MSF (10
bytes). */ bytes). */
CDIO_MMC_GPCMD_PLAY_AUDIO_TI = 0x48, CDIO_MMC_GPCMD_PLAY_AUDIO_TI = 0x48,
CDIO_MMC_GPCMD_PLAY_TRACK_REL_10 = 0x49, /**< Play audio at the track CDIO_MMC_GPCMD_PLAY_TRACK_REL_10 = 0x49, /**< Play audio at the track
relative LBA. (10 bytes). relative LBA. (10 bytes).
Doesn't seem to be part Doesn't seem to be part
of MMC standards but is of MMC standards but is
handled by Plextor drives. handled by Plextor drives.
*/ */
CDIO_MMC_GPCMD_GET_EVENT_STATUS = 0x4a, /**< Report events and CDIO_MMC_GPCMD_GET_EVENT_STATUS = 0x4a, /**< Report events and
Status. */ Status. */
CDIO_MMC_GPCMD_PAUSE_RESUME = 0x4b, /**< Stop or restart audio CDIO_MMC_GPCMD_PAUSE_RESUME = 0x4b, /**< Stop or restart audio
playback. (10 bytes). playback. (10 bytes).
Used with a PLAY command. */ Used with a PLAY command. */
CDIO_MMC_GPCMD_READ_DISC_INFO = 0x51, /**< Get CD information. CDIO_MMC_GPCMD_READ_DISC_INFO = 0x51, /**< Get CD information.
(10 bytes). */ (10 bytes). */
CDIO_MMC_GPCMD_MODE_SELECT_10 = 0x55, /**< Select medium CDIO_MMC_GPCMD_MODE_SELECT_10 = 0x55, /**< Select medium
(10-bytes). */ (10-bytes). */
CDIO_MMC_GPCMD_MODE_SENSE_10 = 0x5a, /**< Get medium or device CDIO_MMC_GPCMD_MODE_SENSE_10 = 0x5a, /**< Get medium or device
information. Should be issued information. Should be issued
before MODE SELECT to get before MODE SELECT to get
mode support or save current mode support or save current
settings. (6 bytes). */ settings. (6 bytes). */
/** Group 5 Commands (CDB's here are 12-bytes) /** Group 5 Commands (CDB's here are 12-bytes)
*/ */
CDIO_MMC_GPCMD_PLAY_AUDIO_12 = 0xa5, /**< Begin audio playing at CDIO_MMC_GPCMD_PLAY_AUDIO_12 = 0xa5, /**< Begin audio playing at
current position current position
(12 bytes) */ (12 bytes) */
CDIO_MMC_GPCMD_LOAD_UNLOAD = 0xa6, /**< Load/unload a Disc CDIO_MMC_GPCMD_LOAD_UNLOAD = 0xa6, /**< Load/unload a Disc
(12 bytes) */ (12 bytes) */
CDIO_MMC_GPCMD_READ_12 = 0xa8, /**< Read data from drive CDIO_MMC_GPCMD_READ_12 = 0xa8, /**< Read data from drive
(12 bytes). */ (12 bytes). */
CDIO_MMC_GPCMD_PLAY_TRACK_REL_12 = 0xa9, /**< Play audio at the track CDIO_MMC_GPCMD_PLAY_TRACK_REL_12 = 0xa9, /**< Play audio at the track
relative LBA. (12 bytes). relative LBA. (12 bytes).
Doesn't seem to be part Doesn't seem to be part
of MMC standards but is of MMC standards but is
handled by Plextor drives. handled by Plextor drives.
*/ */
CDIO_MMC_GPCMD_READ_DVD_STRUCTURE = 0xad, /**< Get DVD structure info CDIO_MMC_GPCMD_READ_DVD_STRUCTURE = 0xad, /**< Get DVD structure info
from media (12 bytes). */ from media (12 bytes). */
CDIO_MMC_GPCMD_READ_MSF = 0xb9, /**< Read almost any field CDIO_MMC_GPCMD_READ_MSF = 0xb9, /**< Read almost any field
of a CD sector at specified of a CD sector at specified
MSF. (12 bytes). */ MSF. (12 bytes). */
CDIO_MMC_GPCMD_SET_SPEED = 0xbb, /**< Set drive speed CDIO_MMC_GPCMD_SET_SPEED = 0xbb, /**< Set drive speed
(12 bytes). This is listed (12 bytes). This is listed
as optional in ATAPI 2.6, as optional in ATAPI 2.6,
but is (curiously) but is (curiously)
missing from Mt. Fuji, missing from Mt. Fuji,
Table 57. It is mentioned Table 57. It is mentioned
in Mt. Fuji Table 377 as an in Mt. Fuji Table 377 as an
MMC command for SCSI MMC command for SCSI
devices though... Most devices though... Most
ATAPI drives support it. */ ATAPI drives support it. */
CDIO_MMC_GPCMD_READ_CD = 0xbe, /**< Read almost any field CDIO_MMC_GPCMD_READ_CD = 0xbe, /**< Read almost any field
of a CD sector at current of a CD sector at current
location. (12 bytes). */ location. (12 bytes). */
/** Vendor-unique Commands /** Vendor-unique Commands
*/ */
CDIO_MMC_GPCMD_CD_PLAYBACK_STATUS = 0xc4 /**< SONY unique = command */, CDIO_MMC_GPCMD_CD_PLAYBACK_STATUS = 0xc4 /**< SONY unique = command */,
CDIO_MMC_GPCMD_PLAYBACK_CONTROL = 0xc9 /**< SONY unique = command */, CDIO_MMC_GPCMD_PLAYBACK_CONTROL = 0xc9 /**< SONY unique = command */,
CDIO_MMC_GPCMD_READ_CDDA = 0xd8 /**< Vendor unique = command */, CDIO_MMC_GPCMD_READ_CDDA = 0xd8 /**< Vendor unique = command */,
CDIO_MMC_GPCMD_READ_CDXA = 0xdb /**< Vendor unique = command */, CDIO_MMC_GPCMD_READ_CDXA = 0xdb /**< Vendor unique = command */,
CDIO_MMC_GPCMD_READ_ALL_SUBCODES = 0xdf /**< Vendor unique = command */ CDIO_MMC_GPCMD_READ_ALL_SUBCODES = 0xdf /**< Vendor unique = command */
} cdio_mmc_gpcmd_t; } cdio_mmc_gpcmd_t;
@@ -197,15 +195,15 @@ extern "C" {
/** Page codes for MODE SENSE and MODE SET. */ /** Page codes for MODE SENSE and MODE SET. */
typedef enum { typedef enum {
CDIO_MMC_R_W_ERROR_PAGE = 0x01, CDIO_MMC_R_W_ERROR_PAGE = 0x01,
CDIO_MMC_WRITE_PARMS_PAGE = 0x05, CDIO_MMC_WRITE_PARMS_PAGE = 0x05,
CDIO_MMC_CDR_PARMS_PAGE = 0x0d, CDIO_MMC_CDR_PARMS_PAGE = 0x0d,
CDIO_MMC_AUDIO_CTL_PAGE = 0x0e, CDIO_MMC_AUDIO_CTL_PAGE = 0x0e,
CDIO_MMC_POWER_PAGE = 0x1a, CDIO_MMC_POWER_PAGE = 0x1a,
CDIO_MMC_FAULT_FAIL_PAGE = 0x1c, CDIO_MMC_FAULT_FAIL_PAGE = 0x1c,
CDIO_MMC_TO_PROTECT_PAGE = 0x1d, CDIO_MMC_TO_PROTECT_PAGE = 0x1d,
CDIO_MMC_CAPABILITIES_PAGE = 0x2a, CDIO_MMC_CAPABILITIES_PAGE = 0x2a,
CDIO_MMC_ALL_PAGES = 0x3f, CDIO_MMC_ALL_PAGES = 0x3f,
} cdio_mmc_mode_page_t; } cdio_mmc_mode_page_t;
@@ -256,17 +254,17 @@ typedef enum {
CDIO_MMC_FEATURE_DVD_READ = 0x01F, /**< DVD Read Feature */ CDIO_MMC_FEATURE_DVD_READ = 0x01F, /**< DVD Read Feature */
CDIO_MMC_FEATURE_RANDOM_WRITABLE = 0x020, /**< Random Writable Feature */ CDIO_MMC_FEATURE_RANDOM_WRITABLE = 0x020, /**< Random Writable Feature */
CDIO_MMC_FEATURE_INCR_WRITE = 0x021, /**< Incremental Streaming CDIO_MMC_FEATURE_INCR_WRITE = 0x021, /**< Incremental Streaming
Writable Feature */ Writable Feature */
CDIO_MMC_FEATURE_SECTOR_ERASE = 0x022, /**< Sector Erasable Feature */ CDIO_MMC_FEATURE_SECTOR_ERASE = 0x022, /**< Sector Erasable Feature */
CDIO_MMC_FEATURE_FORMATABLE = 0x023, /**< Formattable Feature */ CDIO_MMC_FEATURE_FORMATABLE = 0x023, /**< Formattable Feature */
CDIO_MMC_FEATURE_DEFECT_MGMT = 0x024, /**< Management Ability of the CDIO_MMC_FEATURE_DEFECT_MGMT = 0x024, /**< Management Ability of the
Logical Unit/media system to Logical Unit/media system to
provide an apparently provide an apparently
defect-free space.*/ defect-free space.*/
CDIO_MMC_FEATURE_WRITE_ONCE = 0x025, /**< Write Once CDIO_MMC_FEATURE_WRITE_ONCE = 0x025, /**< Write Once
Feature */ Feature */
CDIO_MMC_FEATURE_RESTRICT_OVERW = 0x026, /**< Restricted Overwrite CDIO_MMC_FEATURE_RESTRICT_OVERW = 0x026, /**< Restricted Overwrite
Feature */ Feature */
CDIO_MMC_FEATURE_CD_RW_CAV = 0x027, /**< CD-RW CAV Write Feature */ CDIO_MMC_FEATURE_CD_RW_CAV = 0x027, /**< CD-RW CAV Write Feature */
CDIO_MMC_FEATURE_MRW = 0x028, /**< MRW Feature */ CDIO_MMC_FEATURE_MRW = 0x028, /**< MRW Feature */
CDIO_MMC_FEATURE_ENHANCED_DEFECT = 0x029, /**< Enhanced Defect Reporting */ CDIO_MMC_FEATURE_ENHANCED_DEFECT = 0x029, /**< Enhanced Defect Reporting */
@@ -275,60 +273,60 @@ typedef enum {
CDIO_MMC_FEATURE_RIGID_RES_OVERW = 0x02C, /**< Rigid Restricted Overwrite */ CDIO_MMC_FEATURE_RIGID_RES_OVERW = 0x02C, /**< Rigid Restricted Overwrite */
CDIO_MMC_FEATURE_CD_TAO = 0x02D, /**< CD Track at Once */ CDIO_MMC_FEATURE_CD_TAO = 0x02D, /**< CD Track at Once */
CDIO_MMC_FEATURE_CD_SAO = 0x02E, /**< CD Mastering (Session at CDIO_MMC_FEATURE_CD_SAO = 0x02E, /**< CD Mastering (Session at
Once) */ Once) */
CDIO_MMC_FEATURE_DVD_R_RW_WRITE = 0x02F, /**< DVD-R/RW Write */ CDIO_MMC_FEATURE_DVD_R_RW_WRITE = 0x02F, /**< DVD-R/RW Write */
CDIO_MMC_FEATURE_CD_RW_MEDIA_WRITE= 0x037, /**< CD-RW Media Write Support */ CDIO_MMC_FEATURE_CD_RW_MEDIA_WRITE= 0x037, /**< CD-RW Media Write Support */
CDIO_MMC_FEATURE_DVD_PR_2_LAYER = 0x03B, /**< DVD+R Double Layer */ CDIO_MMC_FEATURE_DVD_PR_2_LAYER = 0x03B, /**< DVD+R Double Layer */
CDIO_MMC_FEATURE_POWER_MGMT = 0x100, /**< Initiator and device directed CDIO_MMC_FEATURE_POWER_MGMT = 0x100, /**< Initiator and device directed
power management */ power management */
CDIO_MMC_FEATURE_CDDA_EXT_PLAY = 0x103, /**< Ability to play audio CDs CDIO_MMC_FEATURE_CDDA_EXT_PLAY = 0x103, /**< Ability to play audio CDs
via the Logical Unit's own via the Logical Unit's own
analog output */ analog output */
CDIO_MMC_FEATURE_MCODE_UPGRADE = 0x104, /* Ability for the device to CDIO_MMC_FEATURE_MCODE_UPGRADE = 0x104, /* Ability for the device to
accept new microcode via accept new microcode via
the interface */ the interface */
CDIO_MMC_FEATURE_TIME_OUT = 0x105, /**< Ability to respond to all CDIO_MMC_FEATURE_TIME_OUT = 0x105, /**< Ability to respond to all
commands within a specific commands within a specific
time */ time */
CDIO_MMC_FEATURE_DVD_CSS = 0x106, /**< Ability to perform DVD CDIO_MMC_FEATURE_DVD_CSS = 0x106, /**< Ability to perform DVD
CSS/CPPM authentication and CSS/CPPM authentication and
RPC */ RPC */
CDIO_MMC_FEATURE_RT_STREAMING = 0x107, /**< Ability to read and write CDIO_MMC_FEATURE_RT_STREAMING = 0x107, /**< Ability to read and write
using Initiator requested using Initiator requested
performance parameters */ performance parameters */
CDIO_MMC_FEATURE_LU_SN = 0x108, /**< The Logical Unit has a unique CDIO_MMC_FEATURE_LU_SN = 0x108, /**< The Logical Unit has a unique
identifier. */ identifier. */
CDIO_MMC_FEATURE_FIRMWARE_DATE = 0x1FF, /**< Firmware creation date CDIO_MMC_FEATURE_FIRMWARE_DATE = 0x1FF, /**< Firmware creation date
report */ report */
} cdio_mmc_feature_t; } cdio_mmc_feature_t;
/** Profile profile codes used in GET_CONFIGURATION - PROFILE LIST. */ /** Profile profile codes used in GET_CONFIGURATION - PROFILE LIST. */
typedef enum { 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
removable media */ removable media */
CDIO_MMC_FEATURE_PROF_MO_ERASABLE = 0x0003, /**< Erasable Magneto-Optical CDIO_MMC_FEATURE_PROF_MO_ERASABLE = 0x0003, /**< Erasable Magneto-Optical
disk with sector erase disk with sector erase
capability */ capability */
CDIO_MMC_FEATURE_PROF_MO_WRITE_ONCE = 0x0004, /**< Write Once Magneto-Optical CDIO_MMC_FEATURE_PROF_MO_WRITE_ONCE = 0x0004, /**< Write Once Magneto-Optical
write once */ write once */
CDIO_MMC_FEATURE_PROF_AS_MO = 0x0005, /**< Advance Storage CDIO_MMC_FEATURE_PROF_AS_MO = 0x0005, /**< Advance Storage
Magneto-Optical */ Magneto-Optical */
CDIO_MMC_FEATURE_PROF_CD_ROM = 0x0008, /**< Read only Compact Disc CDIO_MMC_FEATURE_PROF_CD_ROM = 0x0008, /**< Read only Compact Disc
capable */ capable */
CDIO_MMC_FEATURE_PROF_CD_R = 0x0009, /**< Write once Compact Disc CDIO_MMC_FEATURE_PROF_CD_R = 0x0009, /**< Write once Compact Disc
capable */ capable */
CDIO_MMC_FEATURE_PROF_CD_RW = 0x000A, /**< CD-RW Re-writable CDIO_MMC_FEATURE_PROF_CD_RW = 0x000A, /**< CD-RW Re-writable
Compact Disc capable */ Compact Disc capable */
CDIO_MMC_FEATURE_PROF_DVD_ROM = 0x0010, /**< Read only DVD */ CDIO_MMC_FEATURE_PROF_DVD_ROM = 0x0010, /**< Read only DVD */
CDIO_MMC_FEATURE_PROF_DVD_R_SEQ = 0x0011, /**< Re-recordable DVD using CDIO_MMC_FEATURE_PROF_DVD_R_SEQ = 0x0011, /**< Re-recordable DVD using
Sequential recording */ Sequential recording */
CDIO_MMC_FEATURE_PROF_DVD_RAM = 0x0012, /**< Re-writable DVD */ CDIO_MMC_FEATURE_PROF_DVD_RAM = 0x0012, /**< Re-writable DVD */
CDIO_MMC_FEATURE_PROF_DVD_RW_RO = 0x0013, /**< Re-recordable DVD using CDIO_MMC_FEATURE_PROF_DVD_RW_RO = 0x0013, /**< Re-recordable DVD using
Restricted Overwrite */ Restricted Overwrite */
CDIO_MMC_FEATURE_PROF_DVD_RW_SEQ = 0x0014, /**< Re-recordable DVD using CDIO_MMC_FEATURE_PROF_DVD_RW_SEQ = 0x0014, /**< Re-recordable DVD using
Sequential recording */ Sequential recording */
CDIO_MMC_FEATURE_PROF_DVD_PRW = 0x001A, /**< DVD+RW - DVD ReWritable */ CDIO_MMC_FEATURE_PROF_DVD_PRW = 0x001A, /**< DVD+RW - DVD ReWritable */
CDIO_MMC_FEATURE_PROF_DVD_PR = 0x001B, /**< DVD+R - DVD Recordable */ CDIO_MMC_FEATURE_PROF_DVD_PR = 0x001B, /**< DVD+R - DVD Recordable */
CDIO_MMC_FEATURE_PROF_DDCD_ROM = 0x0020, /**< Read only DDCD */ CDIO_MMC_FEATURE_PROF_DDCD_ROM = 0x0020, /**< Read only DDCD */
@@ -337,7 +335,7 @@ typedef enum {
CDIO_MMC_FEATURE_PROF_DVD_PR2 = 0x002B, /**< DVD+R - DVD Recordable CDIO_MMC_FEATURE_PROF_DVD_PR2 = 0x002B, /**< DVD+R - DVD Recordable
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. */
} cdio_mmc_feature_profile_t; } cdio_mmc_feature_profile_t;
typedef enum { typedef enum {
@@ -374,28 +372,33 @@ typedef struct mmc_cdb_s {
unsigned char reserved2; unsigned char reserved2;
unsigned char profile_msb; unsigned char profile_msb;
unsigned char profile_lsb; unsigned char profile_lsb;
} cdio_mmc_feature_list_header_t; } cdio_mmc_feature_list_header_t;
/** An enumeration indicating whether an MMC command is sending /** An enumeration indicating whether an MMC command is sending
data, or getting data, or does none of both. data, or getting data, or does none of both.
*/ */
typedef enum mmc_direction_s { typedef enum mmc_direction_s {
SCSI_MMC_DATA_READ, SCSI_MMC_DATA_READ,
SCSI_MMC_DATA_WRITE, SCSI_MMC_DATA_WRITE,
SCSI_MMC_DATA_NONE SCSI_MMC_DATA_NONE
} cdio_mmc_direction_t; } cdio_mmc_direction_t;
/** Indicate to applications that SCSI_MMC_DATA_NONE is available /** Indicate to applications that SCSI_MMC_DATA_NONE is available.
It has been added after version 0.82 and should be used with commands
that neither read nor write payload bytes. (At least on Linux such
commands did work with SCSI_MMC_DATA_READ or SCSI_MMC_DATA_WRITE, too.)
*/ */
#define SCSI_MMC_HAS_DIR_NONE 1 #define SCSI_MMC_HAS_DIR_NONE 1
typedef struct mmc_subchannel_s typedef struct mmc_subchannel_s
{ {
uint8_t reserved; uint8_t reserved;
uint8_t audio_status; uint8_t audio_status;
uint16_t data_length; /**< Really ISO 9660 7.2.2 */ uint16_t data_length; /**< Really ISO 9660 7.2.2 */
uint8_t format; uint8_t format;
uint8_t address: 4; uint8_t address: 4;
uint8_t control: 4; uint8_t control: 4;
uint8_t track; uint8_t track;
uint8_t index; uint8_t index;
uint8_t abs_addr[4]; uint8_t abs_addr[4];
uint8_t rel_addr[4]; uint8_t rel_addr[4];
} cdio_mmc_subchannel_t; } cdio_mmc_subchannel_t;
@@ -771,15 +774,15 @@ mmc_audio_read_subchannel (CdIo_t *p_cdio,
/** /**
Run a Multimedia command (MMC). Run a Multimedia command (MMC).
@param p_cdio CD structure set by cdio_open(). @param p_cdio CD structure set by cdio_open().
@param i_timeout_ms time in milliseconds we will wait for the command @param i_timeout_ms time in milliseconds we will wait for the command
to complete. to complete.
@param p_cdb CDB bytes. All values that are needed should be set @param p_cdb CDB bytes. All values that are needed should be set
on input. We'll figure out what the right CDB length on input. We'll figure out what the right CDB length
should be. should be.
@param e_direction direction the transfer is to go. @param e_direction direction the transfer is to go.
@param i_buf Size of buffer @param i_buf Size of buffer
@param p_buf Buffer for data, both sending and receiving. @param p_buf Buffer for data, both sending and receiving.
@return 0 if command completed successfully. @return 0 if command completed successfully.
*/ */
@@ -796,15 +799,15 @@ mmc_audio_read_subchannel (CdIo_t *p_cdio,
miscalculated by mmc_get_cmd_len(); it doesn't follow the usual miscalculated by mmc_get_cmd_len(); it doesn't follow the usual
code number to length conventions. Patch supplied by SukkoPera. code number to length conventions. Patch supplied by SukkoPera.
@param p_cdio CD structure set by cdio_open(). @param p_cdio CD structure set by cdio_open().
@param i_timeout_ms time in milliseconds we will wait for the command @param i_timeout_ms time in milliseconds we will wait for the command
to complete. to complete.
@param p_cdb CDB bytes. All values that are needed should be set @param p_cdb CDB bytes. All values that are needed should be set
on input. on input.
@param i_cdb number of CDB bytes. @param i_cdb number of CDB bytes.
@param e_direction direction the transfer is to go. @param e_direction direction the transfer is to go.
@param i_buf Size of buffer @param i_buf Size of buffer
@param p_buf Buffer for data, both sending and receiving. @param p_buf Buffer for data, both sending and receiving.
@return 0 if command completed successfully. @return 0 if command completed successfully.
*/ */
@@ -814,6 +817,23 @@ mmc_audio_read_subchannel (CdIo_t *p_cdio,
cdio_mmc_direction_t e_direction, unsigned int i_buf, cdio_mmc_direction_t e_direction, unsigned int i_buf,
/*in/out*/ void *p_buf ); /*in/out*/ void *p_buf );
/** 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);
/** /**
Set the block size for subsequest read requests, via MMC. Set the block size for subsequest read requests, via MMC.
*/ */
@@ -823,14 +843,14 @@ mmc_audio_read_subchannel (CdIo_t *p_cdio,
/** /**
Set the drive speed in CD-ROM speed units. Set the drive speed in CD-ROM speed units.
@param p_cdio CD structure set by cdio_open(). @param p_cdio CD structure set by cdio_open().
@param i_drive_speed speed in CD-ROM speed units. Note this @param i_drive_speed speed in CD-ROM speed units. Note this
not Kbs as would be used in the MMC spec or not Kbs as would be used in the MMC spec or
in mmc_set_speed(). To convert CD-ROM speed units in mmc_set_speed(). To convert CD-ROM speed units
to Kbs, multiply the number by 176 (for raw data) to Kbs, multiply the number by 176 (for raw data)
and by 150 (for filesystem data). On many CD-ROM and by 150 (for filesystem data). On many CD-ROM
drives, specifying a value too large will result drives, specifying a value too large will result
in using the fastest speed. in using the fastest speed.
@return the drive speed if greater than 0. -1 if we had an error. is -2 @return the drive speed if greater than 0. -1 if we had an error. is -2
returned if this is not implemented for the current driver. returned if this is not implemented for the current driver.
@@ -843,7 +863,7 @@ mmc_audio_read_subchannel (CdIo_t *p_cdio,
/** /**
Set the drive speed in K bytes per second. Set the drive speed in K bytes per second.
@param p_cdio CD structure set by cdio_open(). @param p_cdio CD structure set by cdio_open().
@param i_Kbs_speed speed in K bytes per second. Note this is @param i_Kbs_speed speed in K bytes per second. Note this is
not in standard CD-ROM speed units, e.g. not in standard CD-ROM speed units, e.g.
1x, 4x, 16x as it is in cdio_set_speed. 1x, 4x, 16x as it is in cdio_set_speed.

View File

@@ -1,7 +1,5 @@
/* /*
$Id: generic.h,v 1.16 2008/04/22 15:29:12 karl Exp $ Copyright (C) 2004, 2005, 2006, 2008, 2009 Rocky Bernstein <rocky@gnu.org>
Copyright (C) 2004, 2005, 2006, 2008 Rocky Bernstein <rocky@gnu.org>
This program is free software: you can redistribute it and/or modify This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by it under the terms of the GNU General Public License as published by
@@ -67,6 +65,15 @@ extern "C" {
cdtext_t cdtext; /**< CD-Text for disc. */ cdtext_t cdtext; /**< CD-Text for disc. */
cdtext_t cdtext_track[CDIO_CD_MAX_TRACKS+1]; /**< CD-TEXT for each track*/ cdtext_t cdtext_track[CDIO_CD_MAX_TRACKS+1]; /**< CD-TEXT for each track*/
track_flags_t track_flags[CDIO_CD_MAX_TRACKS+1]; track_flags_t track_flags[CDIO_CD_MAX_TRACKS+1];
/* Memorized sense reply of the most recent SCSI command.
Recorded by driver implementations of cdio_funcs_t.run_mmc_cmd().
Read by API function mmc_get_cmd_scsi_sense().
*/
unsigned char scsi_mmc_sense[263]; /* See SPC-3 4.5.3 : 252 bytes legal
but 263 bytes possible */
int scsi_mmc_sense_valid; /* Number of valid sense bytes */
} generic_img_private_t; } generic_img_private_t;
/*! /*!
@@ -82,7 +89,7 @@ extern "C" {
*/ */
driver_return_code_t driver_return_code_t
cdio_generic_unimplemented_set_blocksize (void *p_user_data, cdio_generic_unimplemented_set_blocksize (void *p_user_data,
uint16_t i_blocksize); uint16_t i_blocksize);
/*! /*!
Set the drive speed. Set the drive speed.
@@ -90,7 +97,7 @@ extern "C" {
@return -2 since it's not implemented. @return -2 since it's not implemented.
*/ */
driver_return_code_t cdio_generic_unimplemented_set_speed (void *p_user_data, driver_return_code_t cdio_generic_unimplemented_set_speed (void *p_user_data,
int i_speed); int i_speed);
/*! /*!
Release and free resources associated with cd. Release and free resources associated with cd.
@@ -121,7 +128,7 @@ extern "C" {
from lsn. Returns 0 if no error. from lsn. Returns 0 if no error.
*/ */
int cdio_generic_read_form1_sector (void * user_data, void *data, int cdio_generic_read_form1_sector (void * user_data, void *data,
lsn_t lsn); lsn_t lsn);
/*! /*!
Release and free resources associated with stream or disk image. Release and free resources associated with stream or disk image.
@@ -226,3 +233,12 @@ extern "C" {
#endif /* __cplusplus */ #endif /* __cplusplus */
#endif /* __CDIO_GENERIC_H__ */ #endif /* __CDIO_GENERIC_H__ */
/*
* Local variables:
* c-file-style: "gnu"
* tab-width: 8
* indent-tabs-mode: nil
* End:
*/

View File

@@ -1236,7 +1236,7 @@ run_mmc_cmd_linux( void *p_user_data,
cgc.data_direction = (SCSI_MMC_DATA_READ == e_direction) cgc.data_direction = (SCSI_MMC_DATA_READ == e_direction)
? CGC_DATA_READ : CGC_DATA_WRITE; ? CGC_DATA_READ : CGC_DATA_WRITE;
#ifdef HAVE_LINUX_CDROM_TIMEOUT #ifdef HAVE_LINUX_CDROM_TIMEOUT
cgc.timeout = i_timeout_ms; cgc.timeout = i_timeout_ms;
#endif #endif
{ {

View File

@@ -201,6 +201,7 @@ mmc_get_mcn
mmc_get_media_changed mmc_get_media_changed
mmc_get_tray_status mmc_get_tray_status
mmc_have_interface mmc_have_interface
mmc_last_cmd_sense
mmc_mode_sense mmc_mode_sense
mmc_mode_sense_10 mmc_mode_sense_10
mmc_mode_sense_6 mmc_mode_sense_6

View File

@@ -963,6 +963,23 @@ mmc_run_cmd_len( const CdIo_t *p_cdio, unsigned int i_timeout_ms,
p_cdb, e_direction, i_buf, p_buf); p_cdb, e_direction, i_buf, p_buf);
} }
/* Added in version 0.83 by scdbackup */
int
mmc_last_cmd_sense( const CdIo_t *p_cdio, unsigned char **sense)
{
generic_img_private_t *gen = p_cdio->env;
if (!p_cdio) return DRIVER_OP_UNINIT;
*sense = NULL;
if (gen->scsi_mmc_sense_valid <= 0)
return 0;
*sense = calloc(1, gen->scsi_mmc_sense_valid);
if (*sense == NULL)
return DRIVER_OP_ERROR;
memcpy(*sense, gen->scsi_mmc_sense, gen->scsi_mmc_sense_valid);
return gen->scsi_mmc_sense_valid;
}
/*! Return the byte size returned on a MMC READ command (e.g. READ_10, /*! Return the byte size returned on a MMC READ command (e.g. READ_10,
READ_MSF, ..) READ_MSF, ..)

View File

@@ -1,6 +1,4 @@
/* /*
$Id: iso9660.c,v 1.41 2008/06/25 08:01:54 rocky Exp $
Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008, 2009 Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008, 2009
Rocky Bernstein <rocky@gnu.org> Rocky Bernstein <rocky@gnu.org>
Copyright (C) 2000 Herbert Valerio Riedel <hvr@gnu.org> Copyright (C) 2000 Herbert Valerio Riedel <hvr@gnu.org>