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
@@ -375,6 +373,7 @@ typedef struct mmc_cdb_s {
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.
*/ */
@@ -383,9 +382,13 @@ typedef struct mmc_cdb_s {
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;
@@ -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.
*/ */

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;
/*! /*!
@@ -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

@@ -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>