Start to implement ability to a detect media change.

scsi_mmc -> mmc. Warning: some breakage may occur.
This commit is contained in:
rocky
2005-02-06 11:13:37 +00:00
parent fc60baec9c
commit 71a71d7f56
24 changed files with 404 additions and 694 deletions

View File

@@ -1,5 +1,5 @@
/*
$Id: mmc1.c,v 1.1 2005/02/04 23:12:16 rocky Exp $
$Id: mmc1.c,v 1.2 2005/02/06 11:13:37 rocky Exp $
Copyright (C) 2004 Rocky Bernstein <rocky@panix.com>
@@ -51,9 +51,8 @@ main(int argc, const char *argv[])
CDIO_MMC_SET_COMMAND(cdb.field, CDIO_MMC_GPCMD_INQUIRY);
cdb.field[4] = sizeof(buf);
i_status = scsi_mmc_run_cmd(p_cdio, DEFAULT_TIMEOUT_MS,
&cdb, SCSI_MMC_DATA_READ,
sizeof(buf), &buf);
i_status = mmc_run_cmd(p_cdio, DEFAULT_TIMEOUT_MS, &cdb,
SCSI_MMC_DATA_READ, sizeof(buf), &buf);
if (i_status == 0) {
char psz_vendor[CDIO_MMC_HW_VENDOR_LEN+1];
char psz_model[CDIO_MMC_HW_MODEL_LEN+1];

View File

@@ -1,5 +1,5 @@
/*
$Id: mmc2.c,v 1.1 2005/02/04 23:12:16 rocky Exp $
$Id: mmc2.c,v 1.2 2005/02/06 11:13:37 rocky Exp $
Copyright (C) 2004 Rocky Bernstein <rocky@panix.com>
@@ -52,9 +52,8 @@ main(int argc, const char *argv[])
cdb.field[1] = CDIO_MMC_GET_CONF_ALL_FEATURES;
cdb.field[3] = 0x0;
i_status = scsi_mmc_run_cmd(p_cdio, 0,
&cdb, SCSI_MMC_DATA_READ,
sizeof(buf), &buf);
i_status = mmc_run_cmd(p_cdio, 0, &cdb, SCSI_MMC_DATA_READ, sizeof(buf),
&buf);
if (i_status == 0) {
uint8_t *p;
uint32_t i_data;

View File

@@ -1,83 +0,0 @@
/*
$Id: scsi-mmc1.c,v 1.4 2005/01/29 20:54:20 rocky Exp $
Copyright (C) 2004 Rocky Bernstein <rocky@panix.com>
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
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
/* Simple program to show use of SCSI MMC interface. Is basically the
the libdio scsi_mmc_get_hwinfo() routine.
*/
#ifdef HAVE_CONFIG_H
# include "config.h"
#endif
#include <stdio.h>
#include <sys/types.h>
#include <cdio/cdio.h>
#include <cdio/scsi_mmc.h>
#include <string.h>
/* Set how long to wait for MMC commands to complete */
#define DEFAULT_TIMEOUT_MS 10000
int
main(int argc, const char *argv[])
{
CdIo_t *p_cdio;
p_cdio = cdio_open (NULL, DRIVER_UNKNOWN);
if (NULL == p_cdio) {
printf("Couldn't find CD\n");
return 1;
} else {
int i_status; /* Result of MMC command */
char buf[36] = { 0, }; /* Place to hold returned data */
scsi_mmc_cdb_t cdb = {{0, }}; /* Command Descriptor Buffer */
CDIO_MMC_SET_COMMAND(cdb.field, CDIO_MMC_GPCMD_INQUIRY);
cdb.field[4] = sizeof(buf);
i_status = scsi_mmc_run_cmd(p_cdio, DEFAULT_TIMEOUT_MS,
&cdb, SCSI_MMC_DATA_READ,
sizeof(buf), &buf);
if (i_status == 0) {
char psz_vendor[CDIO_MMC_HW_VENDOR_LEN+1];
char psz_model[CDIO_MMC_HW_MODEL_LEN+1];
char psz_rev[CDIO_MMC_HW_REVISION_LEN+1];
memcpy(psz_vendor, buf + 8, sizeof(psz_vendor)-1);
psz_vendor[sizeof(psz_vendor)-1] = '\0';
memcpy(psz_model,
buf + 8 + CDIO_MMC_HW_VENDOR_LEN,
sizeof(psz_model)-1);
psz_model[sizeof(psz_model)-1] = '\0';
memcpy(psz_rev,
buf + 8 + CDIO_MMC_HW_VENDOR_LEN +CDIO_MMC_HW_MODEL_LEN,
sizeof(psz_rev)-1);
psz_rev[sizeof(psz_rev)-1] = '\0';
printf("Vendor: %s\nModel: %s\nRevision: %s\n",
psz_vendor, psz_model, psz_rev);
} else {
printf("Couldn't get INQUIRY data (vendor, model, and revision).\n");
}
}
cdio_destroy(p_cdio);
return 0;
}

View File

@@ -1,324 +0,0 @@
/*
$Id: scsi-mmc2.c,v 1.3 2005/01/29 20:54:20 rocky Exp $
Copyright (C) 2004 Rocky Bernstein <rocky@panix.com>
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
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
/* A program to using the MMC interface to list CD and drive features
from the MMC GET_CONFIGURATION command . */
#ifdef HAVE_CONFIG_H
# include "config.h"
#endif
#include <stdio.h>
#include <sys/types.h>
#include <cdio/cdio.h>
#include <cdio/scsi_mmc.h>
#include <string.h>
/* Set how long do wto wait for SCSI-MMC commands to complete */
#define DEFAULT_TIMEOUT_MS 10000
int
main(int argc, const char *argv[])
{
CdIo_t *p_cdio;
p_cdio = cdio_open (NULL, DRIVER_UNKNOWN);
if (NULL == p_cdio) {
printf("Couldn't find CD\n");
return 1;
} else {
int i_status; /* Result of MMC command */
uint8_t buf[500] = { 0, }; /* Place to hold returned data */
scsi_mmc_cdb_t cdb = {{0, }}; /* Command Descriptor Buffer */
CDIO_MMC_SET_COMMAND(cdb.field, CDIO_MMC_GPCMD_GET_CONFIGURATION);
CDIO_MMC_SET_READ_LENGTH8(cdb.field, sizeof(buf));
cdb.field[1] = CDIO_MMC_GET_CONF_ALL_FEATURES;
cdb.field[3] = 0x0;
i_status = scsi_mmc_run_cmd(p_cdio, 0,
&cdb, SCSI_MMC_DATA_READ,
sizeof(buf), &buf);
if (i_status == 0) {
uint8_t *p;
uint32_t i_data;
uint8_t *p_max = buf + 65530;
i_data = (unsigned int) CDIO_MMC_GET_LEN32(buf);
/* set to first sense feature code, and then walk through the masks */
p = buf + 8;
while( (p < &(buf[i_data])) && (p < p_max) ) {
uint16_t i_feature;
uint8_t i_feature_additional = p[3];
i_feature = CDIO_MMC_GET_LEN16(p);
switch( i_feature )
{
uint8_t *q;
case CDIO_MMC_FEATURE_PROFILE_LIST:
printf("Profile List Feature\n");
for ( q = p+4 ; q < p + i_feature_additional ; q += 4 ) {
int i_profile=CDIO_MMC_GET_LEN16(q);
switch (i_profile) {
case CDIO_MMC_FEATURE_PROF_NON_REMOVABLE:
printf("\tRe-writable disk, capable of changing behavior");
break;
case CDIO_MMC_FEATURE_PROF_REMOVABLE:
printf("\tdisk Re-writable; with removable media");
break;
case CDIO_MMC_FEATURE_PROF_MO_ERASABLE:
printf("\tErasable Magneto-Optical disk with sector erase capability");
break;
case CDIO_MMC_FEATURE_PROF_MO_WRITE_ONCE:
printf("\tWrite Once Magneto-Optical write once");
break;
case CDIO_MMC_FEATURE_PROF_AS_MO:
printf("\tAdvance Storage Magneto-Optical");
break;
case CDIO_MMC_FEATURE_PROF_CD_ROM:
printf("\tRead only Compact Disc capable");
break;
case CDIO_MMC_FEATURE_PROF_CD_R:
printf("\tWrite once Compact Disc capable");
break;
case CDIO_MMC_FEATURE_PROF_CD_RW:
printf("\tCD-RW Re-writable Compact Disc capable");
break;
case CDIO_MMC_FEATURE_PROF_DVD_ROM:
printf("\tRead only DVD");
break;
case CDIO_MMC_FEATURE_PROF_DVD_R_SEQ:
printf("\tRe-recordable DVD using Sequential recording");
break;
case CDIO_MMC_FEATURE_PROF_DVD_RAM:
printf("\tRe-writable DVD");
break;
case CDIO_MMC_FEATURE_PROF_DVD_RW_RO:
printf("\tRe-recordable DVD using Restricted Overwrite");
break;
case CDIO_MMC_FEATURE_PROF_DVD_RW_SEQ:
printf("\tRe-recordable DVD using Sequential recording");
break;
case CDIO_MMC_FEATURE_PROF_DVD_PRW:
printf("\tDVD+RW - DVD ReWritable");
break;
case CDIO_MMC_FEATURE_PROF_DVD_PR:
printf("\tDVD+R - DVD Recordable");
break;
case CDIO_MMC_FEATURE_PROF_DDCD_ROM:
printf("\tRead only DDCD");
break;
case CDIO_MMC_FEATURE_PROF_DDCD_R:
printf("\tDDCD-R Write only DDCD");
break;
case CDIO_MMC_FEATURE_PROF_DDCD_RW:
printf("\tRe-Write only DDCD");
break;
case CDIO_MMC_FEATURE_PROF_NON_CONFORM:
printf("\tThe Logical Unit does not conform to any Profile.");
break;
default:
printf("\tUnknown Profile %x", i_profile);
break;
}
if (q[2] & 1) {
printf(" - on");
}
printf("\n");
}
printf("\n");
break;
case CDIO_MMC_FEATURE_CORE:
{
uint8_t *q = p+4;
uint32_t i_interface_standard = CDIO_MMC_GET_LEN32(q);
printf("Core Feature\n");
switch(i_interface_standard) {
case 0:
printf("\tunspecified interface\n");
break;
case 1:
printf("\tSCSI interface\n");
break;
case 2:
printf("\tATAPI interface\n");
break;
case 3:
printf("\tIEEE 1394 interface\n");
break;
case 4:
printf("\tIEEE 1394A interface\n");
break;
case 5:
printf("\tFibre Channel interface\n");
}
printf("\n");
break;
}
case CDIO_MMC_FEATURE_REMOVABLE_MEDIUM:
printf("Removable Medium Feature\n");
switch(p[4] >> 5) {
case 0:
printf("\tCaddy/Slot type loading mechanism\n");
break;
case 1:
printf("\tTray type loading mechanism\n");
break;
case 2:
printf("\tPop-up type loading mechanism\n");
break;
case 4:
printf("\tEmbedded changer with individually changeable discs\n");
break;
case 5:
printf("\tEmbedded changer using a magazine mechanism\n");
break;
default:
printf("\tUnknown changer mechanism\n");
}
printf("\tcan%s eject the medium or magazine via the normal "
"START/STOP command\n",
(p[4] & 8) ? "": "not");
printf("\tcan%s be locked into the Logical Unit\n",
(p[4] & 1) ? "": "not");
printf("\n");
break;
case CDIO_MMC_FEATURE_WRITE_PROTECT:
printf("Write Protect Feature\n");
break;
case CDIO_MMC_FEATURE_RANDOM_READABLE:
printf("Random Readable Feature\n");
break;
case CDIO_MMC_FEATURE_MULTI_READ:
printf("Multi-Read Feature\n");
break;
case CDIO_MMC_FEATURE_CD_READ:
printf("CD Read Feature\n");
printf("\tC2 Error pointers are %ssupported\n",
(p[4] & 2) ? "": "not ");
printf("\tCD-Text is %ssupported\n",
(p[4] & 1) ? "": "not ");
printf("\n");
break;
case CDIO_MMC_FEATURE_DVD_READ:
printf("DVD Read Feature\n");
break;
case CDIO_MMC_FEATURE_RANDOM_WRITABLE:
printf("Random Writable Feature\n");
break;
case CDIO_MMC_FEATURE_INCR_WRITE:
printf("Incremental Streaming Writable Feature\n");
break;
case CDIO_MMC_FEATURE_SECTOR_ERASE:
printf("Sector Erasable Feature\n");
break;
case CDIO_MMC_FEATURE_FORMATABLE:
printf("Formattable Feature\n");
break;
case CDIO_MMC_FEATURE_DEFECT_MGMT:
printf("Management Ability of the Logical Unit/media system "
"to provide an apparently defect-free space.\n");
break;
case CDIO_MMC_FEATURE_WRITE_ONCE:
printf("Write Once Feature\n");
break;
case CDIO_MMC_FEATURE_RESTRICT_OVERW:
printf("Restricted Overwrite Feature\n");
break;
case CDIO_MMC_FEATURE_CD_RW_CAV:
printf("CD-RW CAV Write Feature\n");
break;
case CDIO_MMC_FEATURE_MRW:
printf("MRW Feature\n");
break;
case CDIO_MMC_FEATURE_DVD_PRW:
printf("DVD+RW Feature\n");
break;
case CDIO_MMC_FEATURE_DVD_PR:
printf("DVD+R Feature\n");
break;
case CDIO_MMC_FEATURE_CD_TAO:
printf("CD Track at Once Feature\n");
break;
case CDIO_MMC_FEATURE_CD_SAO:
printf("CD Mastering (Session at Once) Feature\n");
break;
case CDIO_MMC_FEATURE_POWER_MGMT:
printf("Initiator and device directed power management\n");
break;
case CDIO_MMC_FEATURE_CDDA_EXT_PLAY:
printf("CD Audio External Play Feature\n");
printf("\tSCAN command is %ssupported\n",
(p[4] & 4) ? "": "not ");
printf("\taudio channels can %sbe muted separately\n",
(p[4] & 2) ? "": "not ");
printf("\taudio channels can %shave separate volume levels\n",
(p[4] & 1) ? "": "not ");
{
uint8_t *q = p+6;
uint16_t i_vol_levels = CDIO_MMC_GET_LEN16(q);
printf("\t%d volume levels can be set\n", i_vol_levels);
}
printf("\n");
break;
case CDIO_MMC_FEATURE_MCODE_UPGRADE:
printf("Ability for the device to accept new microcode via "
"the interface\n");
break;
case CDIO_MMC_FEATURE_TIME_OUT:
printf("Ability to respond to all commands within a "
"specific time\n");
break;
case CDIO_MMC_FEATURE_DVD_CSS:
printf("Ability to perform DVD CSS/CPPM authentication and"
" RPC\n");
break;
case CDIO_MMC_FEATURE_RT_STREAMING:
printf("Ability to read and write using Initiator requested performance parameters\n");
break;
case CDIO_MMC_FEATURE_LU_SN: {
uint8_t i_serial = *(p+3);
char serial[257] = { '\0', };
printf("The Logical Unit has a unique identifier:\n");
memcpy(serial, p+4, i_serial);
printf("\t%s\n\n", serial);
break;
}
default:
if ( 0 != (i_feature & 0xFF00) ) {
printf("Vendor-specific feature code %x\n", i_feature);
} else {
printf("Unknown feature code %x\n", i_feature);
}
}
p += i_feature_additional + 4;
}
} else {
printf("Didn't get all feature codes\n");
}
}
cdio_destroy(p_cdio);
return 0;
}

View File

@@ -1,5 +1,5 @@
/* -*- c -*-
$Id: device.h,v 1.11 2005/02/06 04:20:25 rocky Exp $
$Id: device.h,v 1.12 2005/02/06 11:13:37 rocky Exp $
Copyright (C) 2005 Rocky Bernstein <rocky@panix.com>
@@ -275,15 +275,12 @@ extern "C" {
/*!
Get the drive speed.
@return the drive speed if greater than 0. DRIVER_OP_ERROR if we
had an error, DRIVER_OP_UNSUPPORTED if this is not implemented for
the current driver.
@see cdio_set_speed
*/
int cdio_get_speed ( const CdIo_t *p_cdio, int i_speed );
Find out if media has changed since the last call.
@param p_cdio the CD object to be acted upon.
@return 1 if media has changed since last call, 0 if not. Error
return codes are the same as driver_return_code_t
*/
int cdio_get_media_changed(CdIo_t *p_cdio);
/*! True if AIX driver is available. */
bool cdio_have_aix (void);
@@ -392,10 +389,9 @@ extern "C" {
char **cdio_get_devices_bincue(void);
/*! Return a string containing the default CUE file that would
be used when none is specified.
NULL is returned on error or there is no device.
/*! @return string containing the default CUE file that would be
used when none is specified. NULL is returned on error or there
is no device.
*/
char * cdio_get_default_device_cdrdao(void);

View File

@@ -1,5 +1,5 @@
/*
$Id: scsi_mmc.h,v 1.43 2005/02/05 14:42:28 rocky Exp $
$Id: scsi_mmc.h,v 1.44 2005/02/06 11:13:37 rocky Exp $
Copyright (C) 2003, 2004, 2005 Rocky Bernstein <rocky@panix.com>
@@ -83,6 +83,8 @@ typedef enum {
handled by Plextor drives.
*/
CDIO_MMC_GPCMD_GET_EVENT_STATUS = 0x4a, /**< Report events and
Status. */
CDIO_MMC_GPCMD_PAUSE_RESUME = 0x4b, /**< Stop or restart audio
playback. (10 bytes).
Used with a PLAY command. */
@@ -394,7 +396,7 @@ typedef enum scsi_mmc_direction {
Buffer (CDB) for a given MMC command. The length will be
either 6, 10, or 12.
*/
uint8_t scsi_mmc_get_cmd_len(uint8_t scsi_cmd);
uint8_t mmc_get_cmd_len(uint8_t scsi_cmd);
/*!
@@ -412,7 +414,7 @@ uint8_t scsi_mmc_get_cmd_len(uint8_t scsi_cmd);
@return 0 if command completed successfully.
*/
int scsi_mmc_run_cmd( const CdIo_t *p_cdio, unsigned int i_timeout_ms,
int mmc_run_cmd( const CdIo_t *p_cdio, unsigned int i_timeout_ms,
const scsi_mmc_cdb_t *p_cdb,
scsi_mmc_direction_t e_direction, unsigned int i_buf,
/*in/out*/ void *p_buf );
@@ -421,14 +423,14 @@ int scsi_mmc_run_cmd( const CdIo_t *p_cdio, unsigned int i_timeout_ms,
@return 0 if successful.
*/
int scsi_mmc_eject_media( const CdIo_t *p_cdio );
int mmc_eject_media( const CdIo_t *p_cdio );
/*!
Get the lsn of the end of the CD
@return the lsn. On error return CDIO_INVALID_LSN.
*/
lsn_t scsi_mmc_get_disc_last_lsn( const CdIo_t *p_cdio );
lsn_t mmc_get_disc_last_lsn( const CdIo_t *p_cdio );
/*!
Return the discmode as reported by the MMC Read (FULL) TOC
@@ -439,14 +441,14 @@ lsn_t scsi_mmc_get_disc_last_lsn( const CdIo_t *p_cdio );
at http://www.t10.org/ftp/t10/drafts/mmc/mmc-r10a.pdf See
especially tables 72, 73 and 75.
*/
discmode_t scsi_mmc_get_discmode( const CdIo_t *p_cdio );
discmode_t mmc_get_discmode( const CdIo_t *p_cdio );
/*!
Get drive capabilities for a device.
@return the drive capabilities.
*/
void scsi_mmc_get_drive_cap (const CdIo_t *p_cdio,
void mmc_get_drive_cap (const CdIo_t *p_cdio,
/*out*/ cdio_drive_read_cap_t *p_read_cap,
/*out*/ cdio_drive_write_cap_t *p_write_cap,
/*out*/ cdio_drive_misc_cap_t *p_misc_cap);
@@ -456,7 +458,7 @@ void scsi_mmc_get_drive_cap (const CdIo_t *p_cdio,
@return the DVD discmode.
*/
discmode_t scsi_mmc_get_dvd_struct_physical ( const CdIo_t *p_cdio,
discmode_t mmc_get_dvd_struct_physical ( const CdIo_t *p_cdio,
cdio_dvd_struct_t *s);
/*!
@@ -465,10 +467,18 @@ discmode_t scsi_mmc_get_dvd_struct_physical ( const CdIo_t *p_cdio,
@return true if we were able to get hardware info, false if we had
an error.
*/
bool scsi_mmc_get_hwinfo ( const CdIo_t *p_cdio,
bool mmc_get_hwinfo ( const CdIo_t *p_cdio,
/* out*/ cdio_hwinfo_t *p_hw_info );
/*!
Find out if media has changed since the last call.
@param p_cdio the CD object to be acted upon.
@return 1 if media has changed since last call, 0 if not. Error
return codes are the same as driver_return_code_t
*/
int mmc_get_media_changed(const CdIo_t *p_cdio);
/*!
Get the media catalog number (MCN) from the CD via MMC.
@@ -479,25 +489,25 @@ bool scsi_mmc_get_hwinfo ( const CdIo_t *p_cdio,
string when done with it.
*/
char *scsi_mmc_get_mcn ( const CdIo_t *p_cdio );
char * mmc_get_mcn ( const CdIo_t *p_cdio );
/*! Packet driver to read mode2 sectors.
Can read only up to 25 blocks.
*/
int scsi_mmc_read_sectors ( const CdIo_t *p_cdio, void *p_buf, lba_t lba,
int mmc_read_sectors ( const CdIo_t *p_cdio, void *p_buf, lba_t lba,
int sector_type, unsigned int i_blocks);
/*!
Set the block size for subsequest read requests, via an MMC
MODE_SELECT 6 command.
*/
int scsi_mmc_set_blocksize ( const CdIo_t *p_cdio, unsigned int i_bsize);
int mmc_set_blocksize ( const CdIo_t *p_cdio, unsigned int i_bsize);
/*!
Set the block size for subsequest read requests, via an MMC
MODE_SENSE 6 command.
*/
int scsi_mmc_get_blocksize ( const CdIo_t *p_cdio );
int mmc_get_blocksize ( const CdIo_t *p_cdio );
/*!
Set the drive speed.
@@ -507,8 +517,21 @@ int scsi_mmc_get_blocksize ( const CdIo_t *p_cdio );
@see scsi_mmc_get_speed
*/
int
scsi_mmc_set_speed( const CdIo_t *p_cdio, int i_speed );
int mmc_set_speed( const CdIo_t *p_cdio, int i_speed );
/** For backward compatibility. */
#define scsi_mmc_get_cmd_len mmc_get_cmd_len
#define scsi_mmc_run_cmd mmc_run_cmd
#define scsi_mmc_eject_media mmc_eject_media
#define scsi_mmc_get_disc_last_lsn mmc_get_disc_last_lsn
#define scsi_mmc_get_discmode mmc_get_discmode
#define scsi_mmc_get_drive_cap mmc_get_drive_cap
#define scsi_mmc_get_dvd_struct_physical mmc_get_dvd_struct_physical
#define scsi_mmc_get_hwinfo mmc_get_hwinfo
#define scsi_mmc_get_mcn mmc_get_mcn
#define scsi_mmc_read_sectors mmc_read_sectors
#define scsi_mmc_set_blocksize mmc_set_blocksize
#define scsi_mmc_get_blocksize mmc_get_blocksize
#define scsi_mmc_set_speed mmc_set_speed
#endif /* __SCSI_MMC_H__ */

View File

@@ -1,5 +1,5 @@
/*
$Id: freebsd.c,v 1.15 2005/02/03 07:35:15 rocky Exp $
$Id: freebsd.c,v 1.16 2005/02/06 11:13:37 rocky Exp $
Copyright (C) 2003, 2004, 2005 Rocky Bernstein <rocky@panix.com>
@@ -27,7 +27,7 @@
# include "config.h"
#endif
static const char _rcsid[] = "$Id: freebsd.c,v 1.15 2005/02/03 07:35:15 rocky Exp $";
static const char _rcsid[] = "$Id: freebsd.c,v 1.16 2005/02/06 11:13:37 rocky Exp $";
#include "freebsd.h"
@@ -92,7 +92,7 @@ _read_audio_sectors_freebsd (void *p_user_data, void *p_buf, lsn_t i_lsn,
{
_img_private_t *p_env = p_user_data;
if ( p_env->access_mode == _AM_CAM ) {
return scsi_mmc_read_sectors( p_env->gen.cdio, p_buf, i_lsn,
return mmc_read_sectors( p_env->gen.cdio, p_buf, i_lsn,
CDIO_MMC_READ_TYPE_CDDA, i_blocks);
} else
return read_audio_sectors_freebsd_ioctl(p_user_data, p_buf, i_lsn,
@@ -312,7 +312,7 @@ _get_mcn_freebsd (const void *p_user_data) {
return (p_env->access_mode == _AM_IOCTL)
? get_mcn_freebsd_ioctl(p_env)
: scsi_mmc_get_mcn(p_env->gen.cdio);
: mmc_get_mcn(p_env->gen.cdio);
}
@@ -343,10 +343,10 @@ get_drive_cap_freebsd (const void *p_user_data,
p_buf Buffer for data, both sending and receiving
*/
static driver_return_code_t
run_scsi_cmd_freebsd( void *p_user_data, unsigned int i_timeout_ms,
unsigned int i_cdb, const scsi_mmc_cdb_t *p_cdb,
scsi_mmc_direction_t e_direction,
unsigned int i_buf, /*in/out*/ void *p_buf )
run_mmc_cmd_freebsd( void *p_user_data, unsigned int i_timeout_ms,
unsigned int i_cdb, const mmc_cdb_t *p_cdb,
mmc_direction_t e_direction,
unsigned int i_buf, /*in/out*/ void *p_buf )
{
const _img_private_t *p_env = p_user_data;
@@ -606,9 +606,9 @@ cdio_open_am_freebsd (const char *psz_orig_source_name,
.read_mode2_sector = _read_mode2_sector_freebsd,
.read_mode2_sectors = _read_mode2_sectors_freebsd,
.read_toc = read_toc_freebsd,
.run_scsi_mmc_cmd = run_scsi_cmd_freebsd,
.run_mmc_cmd = run_mmc_cmd_freebsd,
.set_arg = _set_arg_freebsd,
.set_blocksize = set_blocksize_mmc,
.set_blocksize = set_blocksize_mmc,
.set_speed = set_speed_freebsd,
};

View File

@@ -1,5 +1,5 @@
/*
$Id: freebsd_cam.c,v 1.4 2005/01/27 04:00:48 rocky Exp $
$Id: freebsd_cam.c,v 1.5 2005/02/06 11:13:37 rocky Exp $
Copyright (C) 2004, 2005 Rocky Bernstein <rocky@panix.com>
@@ -26,7 +26,7 @@
# include "config.h"
#endif
static const char _rcsid[] = "$Id: freebsd_cam.c,v 1.4 2005/01/27 04:00:48 rocky Exp $";
static const char _rcsid[] = "$Id: freebsd_cam.c,v 1.5 2005/02/06 11:13:37 rocky Exp $";
#ifdef HAVE_FREEBSD_CDROM
@@ -53,10 +53,10 @@ static const char _rcsid[] = "$Id: freebsd_cam.c,v 1.4 2005/01/27 04:00:48 rocky
Return 0 if no error.
*/
int
run_scsi_cmd_freebsd_cam( const void *p_user_data, unsigned int i_timeout_ms,
unsigned int i_cdb, const scsi_mmc_cdb_t *p_cdb,
scsi_mmc_direction_t e_direction,
unsigned int i_buf, /*in/out*/ void *p_buf )
run_mmc_cmd_freebsd_cam( const void *p_user_data, unsigned int i_timeout_ms,
unsigned int i_cdb, const scsi_mmc_cdb_t *p_cdb,
scsi_mmc_direction_t e_direction,
unsigned int i_buf, /*in/out*/ void *p_buf )
{
const _img_private_t *p_env = p_user_data;
int i_status;
@@ -83,7 +83,7 @@ run_scsi_cmd_freebsd_cam( const void *p_user_data, unsigned int i_timeout_ms,
memcpy(ccb.csio.cdb_io.cdb_bytes, p_cdb, i_cdb);
ccb.csio.cdb_len =
scsi_mmc_get_cmd_len(ccb.csio.cdb_io.cdb_bytes[0]);
mmc_get_cmd_len(ccb.csio.cdb_io.cdb_bytes[0]);
if ((i_status = cam_send_ccb(p_env->cam, &ccb)) < 0)
{
@@ -191,31 +191,31 @@ read_mode2_sectors_freebsd_cam (_img_private_t *p_env, void *p_buf,
CDIO_MMC_SET_COMMAND(cdb.field, CDIO_MMC_GPCMD_READ_10);
CDIO_MMC_SET_READ_LENGTH16(cdb.field, nblocks);
if ((retval = scsi_mmc_set_blocksize (p_env->gen.cdio, M2RAW_SECTOR_SIZE)))
if ((retval = mmc_set_blocksize (p_env->gen.cdio, M2RAW_SECTOR_SIZE)))
return retval;
if ((retval = run_scsi_cmd_freebsd_cam (p_env, 0,
scsi_mmc_get_cmd_len(cdb.field[0]),
&cdb,
SCSI_MMC_DATA_READ,
M2RAW_SECTOR_SIZE * nblocks,
p_buf)))
if ((retval = run_mmc_cmd_freebsd_cam (p_env, 0,
mmc_get_cmd_len(cdb.field[0]),
&cdb,
SCSI_MMC_DATA_READ,
M2RAW_SECTOR_SIZE * nblocks,
p_buf)))
{
scsi_mmc_set_blocksize (p_env->gen.cdio, CDIO_CD_FRAMESIZE);
mmc_set_blocksize (p_env->gen.cdio, CDIO_CD_FRAMESIZE);
return retval;
}
return scsi_mmc_set_blocksize (p_env->gen.cdio, CDIO_CD_FRAMESIZE);
return mmc_set_blocksize (p_env->gen.cdio, CDIO_CD_FRAMESIZE);
} else {
CDIO_MMC_SET_COMMAND(cdb.field, CDIO_MMC_GPCMD_READ_CD);
CDIO_MMC_SET_READ_LENGTH24(cdb.field, nblocks);
cdb.field[1] = 0; /* sector size mode2 */
cdb.field[9] = 0x58; /* 2336 mode2 */
return run_scsi_cmd_freebsd_cam (p_env, 0,
scsi_mmc_get_cmd_len(cdb.field[0]),
&cdb,
SCSI_MMC_DATA_READ,
M2RAW_SECTOR_SIZE * nblocks, p_buf);
return run_mmc_cmd_freebsd_cam (p_env, 0,
mmc_get_cmd_len(cdb.field[0]),
&cdb,
SCSI_MMC_DATA_READ,
M2RAW_SECTOR_SIZE * nblocks, p_buf);
}
}
@@ -227,29 +227,29 @@ int
eject_media_freebsd_cam (_img_private_t *p_env)
{
int i_status;
scsi_mmc_cdb_t cdb = {{0, }};
mmc_cdb_t cdb = {{0, }};
uint8_t buf[1];
CDIO_MMC_SET_COMMAND(cdb.field, CDIO_MMC_GPCMD_ALLOW_MEDIUM_REMOVAL);
i_status = run_scsi_cmd_freebsd_cam (p_env, DEFAULT_TIMEOUT_MSECS,
scsi_mmc_get_cmd_len(cdb.field[0]),
&cdb, SCSI_MMC_DATA_WRITE, 0, &buf);
i_status = run_mmc_cmd_freebsd_cam (p_env, DEFAULT_TIMEOUT_MSECS,
mmc_get_cmd_len(cdb.field[0]),
&cdb, SCSI_MMC_DATA_WRITE, 0, &buf);
if (i_status) return i_status;
cdb.field[4] = 1;
i_status = run_scsi_cmd_freebsd_cam (p_env, DEFAULT_TIMEOUT_MSECS,
scsi_mmc_get_cmd_len(cdb.field[0]), &cdb,
i_status = run_mmc_cmd_freebsd_cam (p_env, DEFAULT_TIMEOUT_MSECS,
mmc_get_cmd_len(cdb.field[0]), &cdb,
SCSI_MMC_DATA_WRITE, 0, &buf);
if (i_status) return i_status;
CDIO_MMC_SET_COMMAND(cdb.field, CDIO_MMC_GPCMD_START_STOP);
cdb.field[4] = 2; /* eject */
return run_scsi_cmd_freebsd_cam (p_env, DEFAULT_TIMEOUT_MSECS,
scsi_mmc_get_cmd_len(cdb.field[0]),
&cdb,
SCSI_MMC_DATA_WRITE, 0, &buf);
return run_mmc_cmd_freebsd_cam (p_env, DEFAULT_TIMEOUT_MSECS,
mmc_get_cmd_len(cdb.field[0]),
&cdb,
SCSI_MMC_DATA_WRITE, 0, &buf);
}
#endif /* HAVE_FREEBSD_CDROM */

View File

@@ -1,5 +1,5 @@
/*
$Id: win32_ioctl.c,v 1.10 2005/02/05 13:13:31 rocky Exp $
$Id: win32_ioctl.c,v 1.11 2005/02/06 11:13:37 rocky Exp $
Copyright (C) 2004, 2005 Rocky Bernstein <rocky@panix.com>
@@ -26,7 +26,7 @@
# include "config.h"
#endif
static const char _rcsid[] = "$Id: win32_ioctl.c,v 1.10 2005/02/05 13:13:31 rocky Exp $";
static const char _rcsid[] = "$Id: win32_ioctl.c,v 1.11 2005/02/06 11:13:37 rocky Exp $";
#ifdef HAVE_WIN32_CDROM
@@ -184,11 +184,11 @@ typedef struct _SUB_Q_MEDIA_CATALOG_NUMBER {
Return 0 if command completed successfully.
*/
int
run_scsi_cmd_win32ioctl( void *p_user_data,
unsigned int i_timeout_ms,
unsigned int i_cdb, const scsi_mmc_cdb_t * p_cdb,
scsi_mmc_direction_t e_direction,
unsigned int i_buf, /*in/out*/ void *p_buf )
run_mmc_cmd_win32ioctl( void *p_user_data,
unsigned int i_timeout_ms,
unsigned int i_cdb, const scsi_mmc_cdb_t * p_cdb,
scsi_mmc_direction_t e_direction,
unsigned int i_buf, /*in/out*/ void *p_buf )
{
const _img_private_t *p_env = p_user_data;
SCSI_PASS_THROUGH_DIRECT sptd;
@@ -245,7 +245,7 @@ get_discmode_win32ioctl (_img_private_t *p_env)
dvd.physical.type = CDIO_DVD_STRUCT_PHYSICAL;
dvd.physical.layer_num = 0;
if (0 == mmc_get_dvd_struct_physical_private (p_env,
&run_scsi_cmd_win32ioctl,
&run_mmc_cmd_win32ioctl,
&dvd)) {
switch(dvd.physical.layer[0].book_type) {
case CDIO_DVD_BOOK_DVD_ROM: return CDIO_DISC_MODE_DVD_ROM;
@@ -409,10 +409,10 @@ read_raw_sector (_img_private_t *p_env, void *p_buf, lsn_t lsn)
cdb.field[9]=0xF8; /* Raw read, 2352 bytes per sector */
return run_scsi_cmd_win32ioctl(p_env, OP_TIMEOUT_MS,
scsi_mmc_get_cmd_len(cdb.field[0]),
&cdb, SCSI_MMC_DATA_READ,
CDIO_CD_FRAMESIZE_RAW, p_buf);
return run_mmc_cmd_win32ioctl(p_env, OP_TIMEOUT_MS,
mmc_get_cmd_len(cdb.field[0]),
&cdb, SCSI_MMC_DATA_READ,
CDIO_CD_FRAMESIZE_RAW, p_buf);
}
/*!
@@ -574,10 +574,10 @@ read_fulltoc_win32mmc (_img_private_t *p_env)
/* Setup to read header, to get length of data */
CDIO_MMC_SET_READ_LENGTH16(cdb.field, sizeof(cdrom_toc_full));
i_status = run_scsi_cmd_win32ioctl (p_env, 1000*60*3,
scsi_mmc_get_cmd_len(cdb.field[0]),
&cdb, SCSI_MMC_DATA_READ,
sizeof(cdrom_toc_full), &cdrom_toc_full);
i_status = run_mmc_cmd_win32ioctl (p_env, 1000*60*3,
mmc_get_cmd_len(cdb.field[0]),
&cdb, SCSI_MMC_DATA_READ,
sizeof(cdrom_toc_full), &cdrom_toc_full);
if ( 0 != i_status ) {
cdio_debug ("SCSI MMC READ_TOC failed\n");

View File

@@ -1,5 +1,5 @@
/*
$Id: _cdio_aix.c,v 1.9 2005/02/03 07:35:14 rocky Exp $
$Id: _cdio_aix.c,v 1.10 2005/02/06 11:13:37 rocky Exp $
Copyright (C) 2004, 2005 Rocky Bernstein <rocky@panix.com>
@@ -37,7 +37,7 @@
#ifdef HAVE_AIX_CDROM
static const char _rcsid[] = "$Id: _cdio_aix.c,v 1.9 2005/02/03 07:35:14 rocky Exp $";
static const char _rcsid[] = "$Id: _cdio_aix.c,v 1.10 2005/02/06 11:13:37 rocky Exp $";
#ifdef HAVE_GLOB_H
#include <glob.h>
@@ -195,17 +195,17 @@ init_aix (_img_private_t *p_env)
p_buf Buffer for data, both sending and receiving
*/
static driver_return_code_t
run_scsi_cmd_aix( void *p_user_data, unsigned int i_timeout_ms,
unsigned int i_cdb, const scsi_mmc_cdb_t *p_cdb,
scsi_mmc_direction_t e_direction,
unsigned int i_buf, /*in/out*/ void *p_buf )
run_mmc_cmd_aix( void *p_user_data, unsigned int i_timeout_ms,
unsigned int i_cdb, const mmc_cdb_t *p_cdb,
mmc_direction_t e_direction,
unsigned int i_buf, /*in/out*/ void *p_buf )
{
const _img_private_t *p_env = p_user_data;
struct sc_passthru cgc;
int i_rc;
memset (&cgc, 0, sizeof (cgc));
memcpy(cgc.scsi_cdb, p_cdb, sizeof(scsi_mmc_cdb_t));
memcpy(cgc.scsi_cdb, p_cdb, sizeof(mmc_cdb_t));
#ifdef AIX_DISABLE_ASYNC
/* This enables synchronous negotiation mode. Some CD-ROM drives
@@ -217,7 +217,7 @@ run_scsi_cmd_aix( void *p_user_data, unsigned int i_timeout_ms,
#endif
if (0 != i_buf)
cgc.flags |= SCSI_MMC_DATA_READ == e_direction ? B_READ : B_WRITE;
cgc.flags |= MMC_DATA_READ == e_direction ? B_READ : B_WRITE;
cgc.timeout_value = msecs2secs(i_timeout_ms);
cgc.buffer = p_buf;
@@ -554,7 +554,7 @@ static bool
read_toc_aix (void *p_user_data)
{
_img_private_t *p_env = p_user_data;
scsi_mmc_cdb_t cdb = {{0, }};
mmc_cdb_t cdb = {{0, }};
CDROM_TOC_FULL cdrom_toc_full;
int i_status, i, i_seen_flag;
int i_track_format = 0;
@@ -573,8 +573,8 @@ read_toc_aix (void *p_user_data)
CDIO_MMC_SET_READ_LENGTH16(cdb.field, sizeof(cdrom_toc_full));
i_status = run_scsi_cmd_aix (p_env, 1000*60*3,
scsi_mmc_get_cmd_len(cdb.field[0]),
&cdb, SCSI_MMC_DATA_READ,
mmc_get_cmd_len(cdb.field[0]),
&cdb, MMC_DATA_READ,
sizeof(cdrom_toc_full), &cdrom_toc_full);
if ( 0 != i_status ) {
@@ -960,7 +960,7 @@ cdio_open_am_aix (const char *psz_orig_source, const char *access_mode)
_funcs.read_mode2_sector = _read_mode2_sector_aix;
_funcs.read_mode2_sectors = _read_mode2_sectors_aix;
_funcs.read_toc = read_toc_aix;
_funcs.run_scsi_mmc_cmd = run_scsi_cmd_aix;
_funcs.run_mmc_cmd = run_mmc_cmd_aix;
_funcs.set_arg = _set_arg_aix;
_data = calloc (1, sizeof (_img_private_t));

View File

@@ -1,5 +1,5 @@
/*
$Id: _cdio_bsdi.c,v 1.11 2005/02/03 07:35:15 rocky Exp $
$Id: _cdio_bsdi.c,v 1.12 2005/02/06 11:13:37 rocky Exp $
Copyright (C) 2001 Herbert Valerio Riedel <hvr@gnu.org>
Copyright (C) 2002, 2003, 2004, 2005 Rocky Bernstein <rocky@panix.com>
@@ -27,7 +27,7 @@
# include "config.h"
#endif
static const char _rcsid[] = "$Id: _cdio_bsdi.c,v 1.11 2005/02/03 07:35:15 rocky Exp $";
static const char _rcsid[] = "$Id: _cdio_bsdi.c,v 1.12 2005/02/06 11:13:37 rocky Exp $";
#include <cdio/logging.h>
#include <cdio/sector.h>
@@ -81,7 +81,7 @@ typedef struct {
/* Define the Cdrom Generic Command structure */
typedef struct cgc
{
scsi_mmc_cdb_t cdb;
mmc_cdb_t cdb;
u_char *buf;
int buflen;
int rw;
@@ -94,10 +94,10 @@ typedef struct cgc
This code adapted from Steven M. Schultz's libdvd
*/
static driver_return_code_t
run_scsi_cmd_bsdi(void *p_user_data, unsigned int i_timeout_ms,
unsigned int i_cdb, const scsi_mmc_cdb_t *p_cdb,
scsi_mmc_direction_t e_direction,
unsigned int i_buf, /*in/out*/ void *p_buf )
run_mmc_cmd_bsdi(void *p_user_data, unsigned int i_timeout_ms,
unsigned int i_cdb, const mmc_cdb_t *p_cdb,
mmc_direction_t e_direction,
unsigned int i_buf, /*in/out*/ void *p_buf )
{
const _img_private_t *p_env = p_user_data;
int i_status, i_asc;
@@ -105,7 +105,7 @@ run_scsi_cmd_bsdi(void *p_user_data, unsigned int i_timeout_ms,
struct scsi_sense *sp;
again:
suc.suc_flags = SCSI_MMC_DATA_READ == e_direction ?
suc.suc_flags = MMC_DATA_READ == e_direction ?
SUC_READ : SUC_WRITE;
suc.suc_cdblen = i_cdb;
memcpy(suc.suc_cdb, p_cdb, i_cdb);
@@ -784,7 +784,7 @@ cdio_open_bsdi (const char *psz_orig_source)
.read_mode2_sector = _read_mode2_sector_bsdi,
.read_mode2_sectors = _read_mode2_sectors_bsdi,
.read_toc = &read_toc_bsdi,
.run_scsi_mmc_cmd = &run_scsi_cmd_bsdi,
.run_mmc_cmd = &run_mmc_cmd_bsdi,
.set_arg = _set_arg_bsdi,
};

View File

@@ -1,5 +1,5 @@
/*
$Id: _cdio_generic.c,v 1.14 2005/02/05 13:07:02 rocky Exp $
$Id: _cdio_generic.c,v 1.15 2005/02/06 11:13:37 rocky Exp $
Copyright (C) 2004, 2005 Rocky Bernstein <rocky@panix.com>
@@ -25,7 +25,7 @@
# include "config.h"
#endif
static const char _rcsid[] = "$Id: _cdio_generic.c,v 1.14 2005/02/05 13:07:02 rocky Exp $";
static const char _rcsid[] = "$Id: _cdio_generic.c,v 1.15 2005/02/06 11:13:37 rocky Exp $";
#include <stdio.h>
#include <stdlib.h>
@@ -290,7 +290,7 @@ get_discmode_generic (void *p_user_data )
dvd.physical.type = CDIO_DVD_STRUCT_PHYSICAL;
dvd.physical.layer_num = 0;
if (0 == scsi_mmc_get_dvd_struct_physical (p_env->cdio, &dvd)) {
if (0 == mmc_get_dvd_struct_physical (p_env->cdio, &dvd)) {
switch(dvd.physical.layer[0].book_type) {
case CDIO_DVD_BOOK_DVD_ROM: return CDIO_DISC_MODE_DVD_ROM;
case CDIO_DVD_BOOK_DVD_RAM: return CDIO_DISC_MODE_DVD_RAM;
@@ -436,7 +436,7 @@ bool
init_cdtext_generic (generic_img_private_t *p_env)
{
return mmc_init_cdtext_private( p_env,
p_env->cdio->op.run_scsi_mmc_cmd,
p_env->cdio->op.run_mmc_cmd,
set_cdtext_field_generic
);
}

View File

@@ -1,5 +1,5 @@
/*
$Id: _cdio_linux.c,v 1.20 2005/02/03 07:35:15 rocky Exp $
$Id: _cdio_linux.c,v 1.21 2005/02/06 11:13:37 rocky Exp $
Copyright (C) 2001 Herbert Valerio Riedel <hvr@gnu.org>
Copyright (C) 2002, 2003, 2004, 2005 Rocky Bernstein <rocky@panix.com>
@@ -27,7 +27,7 @@
# include "config.h"
#endif
static const char _rcsid[] = "$Id: _cdio_linux.c,v 1.20 2005/02/03 07:35:15 rocky Exp $";
static const char _rcsid[] = "$Id: _cdio_linux.c,v 1.21 2005/02/06 11:13:37 rocky Exp $";
#include <string.h>
@@ -99,13 +99,13 @@ typedef struct {
/**** prototypes for static functions ****/
static bool is_cdrom_linux(const char *drive, char *mnttype);
static bool read_toc_linux (void *p_user_data);
static driver_return_code_t run_scsi_cmd_linux( void *p_user_data,
unsigned int i_timeout,
unsigned int i_cdb,
const scsi_mmc_cdb_t *p_cdb,
scsi_mmc_direction_t e_direction,
unsigned int i_buf,
/*in/out*/ void *p_buf );
static driver_return_code_t run_mmc_cmd_linux( void *p_user_data,
unsigned int i_timeout,
unsigned int i_cdb,
const scsi_mmc_cdb_t *p_cdb,
scsi_mmc_direction_t e_direction,
unsigned int i_buf,
/*in/out*/ void *p_buf );
static access_mode_t
str_to_access_mode_linux(const char *psz_access_mode)
@@ -287,6 +287,18 @@ get_drive_cap_linux (const void *p_user_data,
}
#endif
/*!
Find out if media has changed since the last call.
@param p_user_data the environment object to be acted upon.
@return 1 if media has changed since last call, 0 if not. Error
return codes are the same as driver_return_code_t
*/
static int
get_media_changed_linux (void *p_user_data) {
const _img_private_t *p_env = p_user_data;
return ioctl(p_env->gen.fd, CDROM_MEDIA_CHANGED, 0);
}
/*!
Return the media catalog number MCN.
@@ -423,7 +435,7 @@ eject_media_linux (void *p_user_data) {
if((ret = ioctl(fd, CDROMEJECT)) != 0) {
int eject_error = errno;
/* Try ejecting the MMC way... */
ret = scsi_mmc_eject_media(p_env->gen.cdio);
ret = mmc_eject_media(p_env->gen.cdio);
if (0 != ret) {
cdio_warn("ioctl CDROMEJECT failed: %s\n",
strerror(eject_error));
@@ -483,7 +495,7 @@ get_discmode_linux (void *p_user_data)
issue a SCSI MMC-2 FULL TOC command first to try get more
accurate information.
*/
discmode = scsi_mmc_get_discmode(p_env->gen.cdio);
discmode = mmc_get_discmode(p_env->gen.cdio);
if (CDIO_DISC_MODE_NO_INFO != discmode)
return discmode;
else {
@@ -551,8 +563,8 @@ _read_audio_sectors_linux (void *p_user_data, void *buf, lsn_t lsn,
unsigned int nblocks)
{
_img_private_t *p_env = p_user_data;
return scsi_mmc_read_sectors( p_env->gen.cdio, buf, lsn,
CDIO_MMC_READ_TYPE_CDDA, nblocks);
return mmc_read_sectors( p_env->gen.cdio, buf, lsn, CDIO_MMC_READ_TYPE_CDDA,
nblocks);
}
/* Packet driver to read mode2 sectors.
@@ -572,22 +584,22 @@ _read_mode2_sectors_mmc (_img_private_t *p_env, void *p_buf, lba_t lba,
CDIO_MMC_SET_COMMAND(cdb.field, CDIO_MMC_GPCMD_READ_10);
CDIO_MMC_SET_READ_LENGTH16(cdb.field, nblocks);
if ((retval = scsi_mmc_set_blocksize (p_env->gen.cdio, M2RAW_SECTOR_SIZE)))
if ((retval = mmc_set_blocksize (p_env->gen.cdio, M2RAW_SECTOR_SIZE)))
return retval;
if ((retval = run_scsi_cmd_linux (p_env, 0,
scsi_mmc_get_cmd_len(cdb.field[0]),
&cdb,
SCSI_MMC_DATA_READ,
M2RAW_SECTOR_SIZE * nblocks,
p_buf)))
if ((retval = run_mmc_cmd_linux (p_env, 0,
mmc_get_cmd_len(cdb.field[0]),
&cdb,
SCSI_MMC_DATA_READ,
M2RAW_SECTOR_SIZE * nblocks,
p_buf)))
{
scsi_mmc_set_blocksize (p_env->gen.cdio, CDIO_CD_FRAMESIZE);
mmc_set_blocksize (p_env->gen.cdio, CDIO_CD_FRAMESIZE);
return retval;
}
/* Restore blocksize. */
retval = scsi_mmc_set_blocksize (p_env->gen.cdio, CDIO_CD_FRAMESIZE);
retval = mmc_set_blocksize (p_env->gen.cdio, CDIO_CD_FRAMESIZE);
return retval;
} else {
@@ -597,10 +609,10 @@ _read_mode2_sectors_mmc (_img_private_t *p_env, void *p_buf, lba_t lba,
CDIO_MMC_SET_COMMAND(cdb.field, CDIO_MMC_GPCMD_READ_CD);
CDIO_MMC_SET_READ_LENGTH24(cdb.field, nblocks);
return run_scsi_cmd_linux (p_env, 0,
scsi_mmc_get_cmd_len(cdb.field[0]), &cdb,
SCSI_MMC_DATA_READ,
M2RAW_SECTOR_SIZE * nblocks, p_buf);
return run_mmc_cmd_linux (p_env, 0,
mmc_get_cmd_len(cdb.field[0]), &cdb,
SCSI_MMC_DATA_READ,
M2RAW_SECTOR_SIZE * nblocks, p_buf);
}
}
@@ -897,7 +909,7 @@ read_toc_linux (void *p_user_data)
We return true if command completed successfully and false if not.
*/
static driver_return_code_t
run_scsi_cmd_linux( void *p_user_data,
run_mmc_cmd_linux( void *p_user_data,
unsigned int i_timeout_ms,
unsigned int i_cdb, const scsi_mmc_cdb_t *p_cdb,
scsi_mmc_direction_t e_direction,
@@ -1148,6 +1160,7 @@ cdio_open_am_linux (const char *psz_orig_source, const char *access_mode)
#endif
.get_first_track_num = get_first_track_num_generic,
.get_hwinfo = NULL,
.get_media_changed = get_media_changed_linux,
.get_mcn = get_mcn_linux,
.get_num_tracks = get_num_tracks_generic,
.get_track_channels = get_track_channels_generic,
@@ -1165,7 +1178,7 @@ cdio_open_am_linux (const char *psz_orig_source, const char *access_mode)
.read_mode2_sector = _read_mode2_sector_linux,
.read_mode2_sectors = _read_mode2_sectors_linux,
.read_toc = read_toc_linux,
.run_scsi_mmc_cmd = run_scsi_cmd_linux,
.run_mmc_cmd = run_mmc_cmd_linux,
.set_arg = set_arg_linux,
.set_blocksize = set_blocksize_mmc,
.set_speed = set_speed_linux,

View File

@@ -1,5 +1,5 @@
/*
$Id: _cdio_osx.c,v 1.14 2005/02/03 07:35:15 rocky Exp $
$Id: _cdio_osx.c,v 1.15 2005/02/06 11:13:37 rocky Exp $
Copyright (C) 2003, 2004, 2005 Rocky Bernstein <rocky@panix.com>
from vcdimager code:
@@ -34,7 +34,7 @@
#include "config.h"
#endif
static const char _rcsid[] = "$Id: _cdio_osx.c,v 1.14 2005/02/03 07:35:15 rocky Exp $";
static const char _rcsid[] = "$Id: _cdio_osx.c,v 1.15 2005/02/06 11:13:37 rocky Exp $";
#include <cdio/logging.h>
#include <cdio/sector.h>
@@ -355,8 +355,8 @@ init_osx(_img_private_t *p_env) {
static int
run_scsi_cmd_osx( void *p_user_data,
unsigned int i_timeout_ms,
unsigned int i_cdb, const scsi_mmc_cdb_t *p_cdb,
scsi_mmc_direction_t e_direction,
unsigned int i_cdb, const mmc_cdb_t *p_cdb,
mmc_direction_t e_direction,
unsigned int i_buf, /*in/out*/ void *p_buf )
{
_img_private_t *p_env = p_user_data;
@@ -486,11 +486,11 @@ run_scsi_cmd_osx( void *p_user_data,
We return true if command completed successfully and false if not.
*/
static int
run_scsi_cmd_osx( const void *p_user_data,
unsigned int i_timeout_ms,
unsigned int i_cdb, const scsi_mmc_cdb_t *p_cdb,
scsi_mmc_direction_t e_direction,
unsigned int i_buf, /*in/out*/ void *p_buf )
run_mmc_cmd_osx( const void *p_user_data,
unsigned int i_timeout_ms,
unsigned int i_cdb, const scsi_mmc_cdb_t *p_cdb,
scsi_mmc_direction_t e_direction,
unsigned int i_buf, /*in/out*/ void *p_buf )
{
#ifndef SCSI_MMC_FIXED
@@ -1689,7 +1689,7 @@ cdio_open_osx (const char *psz_orig_source)
.read_mode2_sector = _get_read_mode2_sector_osx,
.read_mode2_sectors = _get_read_mode2_sectors_osx,
.read_toc = read_toc_osx,
.run_scsi_mmc_cmd = run_scsi_cmd_osx,
.run_mmc_cmd = run_mmc_cmd_osx,
.set_arg = _set_arg_osx,
.set_speed = set_speed_osx,
};

View File

@@ -1,5 +1,5 @@
/*
$Id: _cdio_sunos.c,v 1.18 2005/02/03 07:35:15 rocky Exp $
$Id: _cdio_sunos.c,v 1.19 2005/02/06 11:13:37 rocky Exp $
Copyright (C) 2001 Herbert Valerio Riedel <hvr@gnu.org>
Copyright (C) 2002, 2003, 2004, 2005 Rocky Bernstein <rocky@panix.com>
@@ -38,7 +38,7 @@
#ifdef HAVE_SOLARIS_CDROM
static const char _rcsid[] = "$Id: _cdio_sunos.c,v 1.18 2005/02/03 07:35:15 rocky Exp $";
static const char _rcsid[] = "$Id: _cdio_sunos.c,v 1.19 2005/02/06 11:13:37 rocky Exp $";
#ifdef HAVE_GLOB_H
#include <glob.h>
@@ -146,8 +146,8 @@ init_solaris (_img_private_t *p_env)
*/
static driver_return_code_t
run_scsi_cmd_solaris( void *p_user_data, unsigned int i_timeout_ms,
unsigned int i_cdb, const scsi_mmc_cdb_t *p_cdb,
scsi_mmc_direction_t e_direction,
unsigned int i_cdb, const mmc_cdb_t *p_cdb,
mmc_direction_t e_direction,
unsigned int i_buf, /*in/out*/ void *p_buf )
{
const _img_private_t *p_env = p_user_data;
@@ -575,7 +575,7 @@ get_discmode_solaris (void *p_user_data)
Issue a SCSI MMC-2 FULL TOC command first to try get more
accurate information.
*/
discmode = scsi_mmc_get_discmode(p_env->gen.cdio);
discmode = mmc_get_discmode(p_env->gen.cdio);
if (CDIO_DISC_MODE_NO_INFO != discmode)
return discmode;
@@ -872,12 +872,12 @@ cdio_open_am_solaris (const char *psz_orig_source, const char *access_mode)
_funcs.read_mode2_sector = _read_mode2_sector_solaris;
_funcs.read_mode2_sectors = _read_mode2_sectors_solaris;
_funcs.read_toc = read_toc_solaris;
_funcs.run_scsi_mmc_cmd = run_scsi_cmd_solaris;
_funcs.run_mmc_cmd = run_mmc_cmd_solaris;
_funcs.set_arg = _set_arg_solaris;
_funcs.set_blocksize = set_blocksize_mmc;
_funcs.set_speed = set_speed_solaris;
_data = calloc(1, sizeof (_img_private_t));
_data = calloc(1, sizeof (_img_private_t));
_data->access_mode = _AM_SUN_CTRL_SCSI;
_data->gen.init = false;

View File

@@ -1,5 +1,5 @@
/*
$Id: cdio_private.h,v 1.12 2005/02/05 13:07:02 rocky Exp $
$Id: cdio_private.h,v 1.13 2005/02/06 11:13:37 rocky Exp $
Copyright (C) 2003, 2004, 2005 Rocky Bernstein <rocky@panix.com>
@@ -56,6 +56,9 @@ extern "C" {
/*!
Eject media in CD drive. If successful, as a side effect we
also free obj. Return 0 if success and 1 for failure.
@param p_cdio the CD object to be acted upon.
If the CD is ejected *p_cdio is freed and p_cdio set to NULL.
*/
int (*eject_media) (void *p_env);
@@ -97,7 +100,14 @@ extern "C" {
char ** (*get_devices) (void);
/*!
Return a string containing the default CD device if none is specified.
Get the default CD device.
@return a string containing the default CD device or NULL is
if we couldn't get a default device.
In some situations of drivers or OS's we can't find a CD device if
there is no media in it and it is possible for this routine to return
NULL even though there may be a hardware CD-ROM.
*/
char * (*get_default_device)(void);
@@ -134,6 +144,14 @@ extern "C" {
bool (*get_hwinfo) ( const CdIo_t *p_cdio,
/* out*/ cdio_hwinfo_t *p_hw_info );
/*!
Find out if media has changed since the last call.
@param p_env the CD object to be acted upon.
@return 1 if media has changed since last call, 0 if not. Error
return codes are the same as driver_return_code_t
*/
int (*get_media_changed) (void *p_env);
/*!
Return the media catalog number MCN from the CD or NULL if
there is none or we don't have the ability to get it.
@@ -172,12 +190,6 @@ extern "C" {
*/
track_format_t (*get_track_format) (void *p_env, track_t i_track);
/*!
Set the drive speed. -1 is returned if we had an error.
-2 is returned if this is not implemented for the current driver.
*/
int (*get_speed) (void *p_env);
/*!
Return true if we have XA data (green, mode2 form1) or
XA data (green, mode2 form2). That is track begins:
@@ -273,7 +285,7 @@ extern "C" {
Returns 0 if command completed successfully.
*/
scsi_mmc_run_cmd_fn_t run_scsi_mmc_cmd;
mmc_run_cmd_fn_t run_mmc_cmd;
/*!
Set the arg "key" with "value" in the source device.
@@ -282,11 +294,8 @@ extern "C" {
/*!
Set the blocksize for subsequent reads.
@return 0 if everything went okay, -1 if we had an error. is -2
returned if this is not implemented for the current driver.
*/
int (*set_blocksize) ( void *p_env, int i_blocksize );
driver_return_code_t (*set_blocksize) ( void *p_env, int i_blocksize );
/*!
Set the drive speed.

View File

@@ -1,5 +1,5 @@
/*
$Id: device.c,v 1.8 2005/01/26 01:03:16 rocky Exp $
$Id: device.c,v 1.9 2005/02/06 11:13:37 rocky Exp $
Copyright (C) 2005 Rocky Bernstein <rocky@panix.com>
@@ -290,7 +290,7 @@ driver_return_code_t
cdio_eject_media (CdIo_t **pp_cdio)
{
if ((pp_cdio == NULL) || (*pp_cdio == NULL)) return 1;
if ((pp_cdio == NULL) || (*pp_cdio == NULL)) return DRIVER_OP_UNINIT;
if ((*pp_cdio)->op.eject_media) {
int ret = (*pp_cdio)->op.eject_media ((*pp_cdio)->env);
@@ -564,10 +564,25 @@ cdio_get_hwinfo (const CdIo_t *p_cdio, cdio_hwinfo_t *hw_info)
} else {
/* Perhaps driver forgot to initialize. We are no worse off Using
scsi_mmc than returning false here. */
return scsi_mmc_get_hwinfo(p_cdio, hw_info);
return mmc_get_hwinfo(p_cdio, hw_info);
}
}
/*!
Find out if media has changed since the last call.
@param p_cdio the CD object to be acted upon.
@return 1 if media has changed since last call, 0 if not. Error
return codes are the same as driver_return_code_t
*/
int
cdio_get_media_changed(CdIo_t *p_cdio)
{
if (!p_cdio) return DRIVER_OP_UNINIT;
if (p_cdio->op.get_media_changed)
return p_cdio->op.get_media_changed(p_cdio->env);
return DRIVER_OP_UNSUPPORTED;
}
bool
cdio_have_driver(driver_id_t driver_id)
{
@@ -581,6 +596,7 @@ cdio_is_device(const char *psz_source, driver_id_t driver_id)
return (*CdIo_all_drivers[driver_id].is_device)(psz_source);
}
/*! Sets up to read from place specified by source_name and
driver_id. This should be called before using any other routine,
except cdio_init. This will call cdio_init, if that hasn't been
@@ -707,7 +723,7 @@ cdio_set_blocksize ( const CdIo_t *p_cdio, int i_blocksize )
/*!
Set the drive speed.
@see cdio_get_speed
@see cdio_set_speed
*/
driver_return_code_t
cdio_set_speed (const CdIo_t *p_cdio, int i_speed)

View File

@@ -1,5 +1,5 @@
/*
$Id: bincue.c,v 1.11 2005/02/03 07:35:16 rocky Exp $
$Id: bincue.c,v 1.12 2005/02/06 11:13:37 rocky Exp $
Copyright (C) 2002, 2003, 2004, 2005 Rocky Bernstein <rocky@panix.com>
Copyright (C) 2001 Herbert Valerio Riedel <hvr@gnu.org>
@@ -26,7 +26,7 @@
(*.cue).
*/
static const char _rcsid[] = "$Id: bincue.c,v 1.11 2005/02/03 07:35:16 rocky Exp $";
static const char _rcsid[] = "$Id: bincue.c,v 1.12 2005/02/06 11:13:37 rocky Exp $";
#include "image.h"
#include "cdio_assert.h"
@@ -1146,6 +1146,7 @@ cdio_open_cue (const char *psz_cue_name)
_funcs.get_drive_cap = _get_drive_cap_image;
_funcs.get_first_track_num = _get_first_track_num_image;
_funcs.get_hwinfo = get_hwinfo_bincue;
_funcs.get_media_changed = get_media_changed_image;
_funcs.get_mcn = _get_mcn_image;
_funcs.get_num_tracks = _get_num_tracks_image;
_funcs.get_track_channels = get_track_channels_image,

View File

@@ -1,5 +1,5 @@
/*
$Id: cdrdao.c,v 1.12 2005/02/03 07:35:16 rocky Exp $
$Id: cdrdao.c,v 1.13 2005/02/06 11:13:37 rocky Exp $
Copyright (C) 2004, 2005 Rocky Bernstein <rocky@panix.com>
toc reading routine adapted from cuetools
@@ -25,7 +25,7 @@
(*.cue).
*/
static const char _rcsid[] = "$Id: cdrdao.c,v 1.12 2005/02/03 07:35:16 rocky Exp $";
static const char _rcsid[] = "$Id: cdrdao.c,v 1.13 2005/02/06 11:13:37 rocky Exp $";
#include "image.h"
#include "cdio_assert.h"
@@ -1273,6 +1273,7 @@ cdio_open_cdrdao (const char *psz_cue_name)
_funcs.get_drive_cap = _get_drive_cap_image;
_funcs.get_first_track_num = _get_first_track_num_image;
_funcs.get_hwinfo = get_hwinfo_cdrdao;
_funcs.get_media_changed = get_media_changed_image;
_funcs.get_mcn = _get_mcn_image;
_funcs.get_num_tracks = _get_num_tracks_image;
_funcs.get_track_channels = get_track_channels_image,

View File

@@ -1,5 +1,5 @@
/*
$Id: nrg.c,v 1.10 2005/02/03 07:35:16 rocky Exp $
$Id: nrg.c,v 1.11 2005/02/06 11:13:37 rocky Exp $
Copyright (C) 2003, 2004, 2005 Rocky Bernstein <rocky@panix.com>
Copyright (C) 2001, 2003 Herbert Valerio Riedel <hvr@gnu.org>
@@ -46,7 +46,7 @@
#include "_cdio_stdio.h"
#include "nrg.h"
static const char _rcsid[] = "$Id: nrg.c,v 1.10 2005/02/03 07:35:16 rocky Exp $";
static const char _rcsid[] = "$Id: nrg.c,v 1.11 2005/02/06 11:13:37 rocky Exp $";
/* reader */
@@ -1226,6 +1226,7 @@ cdio_open_nrg (const char *psz_source)
_funcs.get_drive_cap = _get_drive_cap_image;
_funcs.get_first_track_num = _get_first_track_num_image;
_funcs.get_hwinfo = get_hwinfo_nrg;
_funcs.get_media_changed = get_media_changed_image;
_funcs.get_mcn = _get_mcn_image;
_funcs.get_num_tracks = _get_num_tracks_image;
_funcs.get_track_channels = get_track_channels_generic,

View File

@@ -1,5 +1,5 @@
/*
$Id: image_common.c,v 1.7 2005/01/23 05:31:03 rocky Exp $
$Id: image_common.c,v 1.8 2005/02/06 11:13:37 rocky Exp $
Copyright (C) 2004, 2005 Rocky Bernstein <rocky@panix.com>
@@ -41,7 +41,7 @@
/*!
Eject media -- there's nothing to do here except free resources.
We always return -2.
We always return DRIVER_OP_UNSUPPORTED.
*/
driver_return_code_t
_eject_media_image(void *p_user_data)
@@ -146,6 +146,19 @@ _get_first_track_num_image(void *p_user_data)
return p_env->gen.i_first_track;
}
/*!
Find out if media has changed since the last call.
@param p_user_data the CD object to be acted upon.
@return 1 if media has changed since last call, 0 if not. Error
return codes are the same as driver_return_code_t
We always return DRIVER_OP_UNSUPPORTED.
*/
int
get_media_changed_image(void *p_user_data)
{
return DRIVER_OP_UNSUPPORTED;
}
/*!
Return the media catalog number (MCN) from the CD or NULL if there
is none or we don't have the ability to get it.

View File

@@ -1,5 +1,5 @@
/*
$Id: image_common.h,v 1.6 2005/01/18 00:57:20 rocky Exp $
$Id: image_common.h,v 1.7 2005/02/06 11:13:37 rocky Exp $
Copyright (C) 2004, 2005 Rocky Bernstein <rocky@panix.com>
@@ -99,6 +99,15 @@ void _get_drive_cap_image (const void *user_data,
*/
track_t _get_first_track_num_image(void *p_user_data);
/*!
Find out if media has changed since the last call.
@param p_user_data the CD object to be acted upon.
@return 1 if media has changed since last call, 0 if not. Error
return codes are the same as driver_return_code_t
We always return DRIVER_OP_UNSUPPORTED.
*/
int get_media_changed_image(void *p_user_data);
/*!
Return the media catalog number (MCN) from the CD or NULL if there
is none or we don't have the ability to get it.

View File

@@ -1,6 +1,6 @@
/* Common Multimedia Command (MMC) routines.
$Id: mmc.c,v 1.1 2005/02/05 13:07:02 rocky Exp $
$Id: mmc.c,v 1.2 2005/02/06 11:13:37 rocky Exp $
Copyright (C) 2004, 2005 Rocky Bernstein <rocky@panix.com>
@@ -56,7 +56,7 @@ get_blocksize_mmc (void *p_user_data)
{
generic_img_private_t *p_env = p_user_data;
if (!p_env) return DRIVER_OP_UNINIT;
return scsi_mmc_get_blocksize(p_env->cdio);
return mmc_get_blocksize(p_env->cdio);
}
/*!
@@ -69,7 +69,7 @@ get_disc_last_lsn_mmc (void *p_user_data)
{
generic_img_private_t *p_env = p_user_data;
if (!p_env) return CDIO_INVALID_LSN;
return scsi_mmc_get_disc_last_lsn(p_env->cdio);
return mmc_get_disc_last_lsn(p_env->cdio);
}
void
@@ -79,15 +79,22 @@ get_drive_cap_mmc (const void *p_user_data,
/*out*/ cdio_drive_misc_cap_t *p_misc_cap)
{
const generic_img_private_t *p_env = p_user_data;
scsi_mmc_get_drive_cap( p_env->cdio,
mmc_get_drive_cap( p_env->cdio,
p_read_cap, p_write_cap, p_misc_cap );
}
int
get_media_changed_mmc (const void *p_user_data)
{
const generic_img_private_t *p_env = p_user_data;
return mmc_get_media_changed( p_env->cdio );
}
char *
get_mcn_mmc (const void *p_user_data)
{
const generic_img_private_t *p_env = p_user_data;
return scsi_mmc_get_mcn( p_env->cdio );
return mmc_get_mcn( p_env->cdio );
}
/* Set read blocksize (via MMC) */
@@ -96,7 +103,7 @@ set_blocksize_mmc (void *p_user_data, int i_blocksize)
{
generic_img_private_t *p_env = p_user_data;
if (!p_env) return DRIVER_OP_UNINIT;
return scsi_mmc_set_blocksize(p_env->cdio, i_blocksize);
return mmc_set_blocksize(p_env->cdio, i_blocksize);
}
/* Set CD-ROM drive speed (via MMC) */
@@ -105,7 +112,7 @@ set_speed_mmc (void *p_user_data, int i_speed)
{
generic_img_private_t *p_env = p_user_data;
if (!p_env) return DRIVER_OP_UNINIT;
return scsi_mmc_set_speed( p_env->cdio, i_speed );
return mmc_set_speed( p_env->cdio, i_speed );
}
/*************************************************************************
@@ -115,7 +122,7 @@ set_speed_mmc (void *p_user_data, int i_speed)
int
mmc_get_blocksize_private ( void *p_env,
const scsi_mmc_run_cmd_fn_t run_scsi_mmc_cmd)
const mmc_run_cmd_fn_t run_mmc_cmd)
{
int i_status = 0;
scsi_mmc_cdb_t cdb = {{0, }};
@@ -139,7 +146,7 @@ mmc_get_blocksize_private ( void *p_env,
uint8_t *p = &mh.block_length_med;
if ( ! p_env ) return DRIVER_OP_UNINIT;
if ( ! run_scsi_mmc_cmd ) return DRIVER_OP_UNSUPPORTED;
if ( ! run_mmc_cmd ) return DRIVER_OP_UNSUPPORTED;
memset (&mh, 0, sizeof (mh));
@@ -148,9 +155,9 @@ mmc_get_blocksize_private ( void *p_env,
cdb.field[1] = 0x3F&1;
cdb.field[4] = 12;
i_status = run_scsi_mmc_cmd (p_env, DEFAULT_TIMEOUT_MS,
scsi_mmc_get_cmd_len(cdb.field[0]), &cdb,
SCSI_MMC_DATA_WRITE, sizeof(mh), &mh);
i_status = run_mmc_cmd (p_env, DEFAULT_TIMEOUT_MS,
mmc_get_cmd_len(cdb.field[0]), &cdb,
SCSI_MMC_DATA_WRITE, sizeof(mh), &mh);
if (DRIVER_OP_SUCCESS != i_status) return i_status;
return CDIO_MMC_GET_LEN16(p);
@@ -198,7 +205,7 @@ mmc_get_drive_cap_buf(const uint8_t *p,
*/
void
mmc_get_drive_cap_private (void *p_env,
const scsi_mmc_run_cmd_fn_t run_scsi_mmc_cmd,
const mmc_run_cmd_fn_t run_mmc_cmd,
/*out*/ cdio_drive_read_cap_t *p_read_cap,
/*out*/ cdio_drive_write_cap_t *p_write_cap,
/*out*/ cdio_drive_misc_cap_t *p_misc_cap)
@@ -211,7 +218,7 @@ mmc_get_drive_cap_private (void *p_env,
int i_status;
uint16_t i_data = BUF_MAX;
if ( ! p_env || ! run_scsi_mmc_cmd )
if ( ! p_env || ! run_mmc_cmd )
return;
CDIO_MMC_SET_COMMAND(cdb.field, CDIO_MMC_GPCMD_MODE_SENSE_10);
@@ -223,10 +230,10 @@ mmc_get_drive_cap_private (void *p_env,
/* In the first run we run MODE SENSE 10 we are trying to get the
length of the data features. */
i_status = run_scsi_mmc_cmd (p_env, DEFAULT_TIMEOUT_MS,
scsi_mmc_get_cmd_len(cdb.field[0]),
&cdb, SCSI_MMC_DATA_READ,
sizeof(buf), &buf);
i_status = run_mmc_cmd (p_env, DEFAULT_TIMEOUT_MS,
mmc_get_cmd_len(cdb.field[0]),
&cdb, SCSI_MMC_DATA_READ,
sizeof(buf), &buf);
if (0 == i_status) {
uint16_t i_data_try = (uint16_t) CDIO_MMC_GET_LEN16(buf);
if (i_data_try < BUF_MAX) i_data = i_data_try;
@@ -237,10 +244,10 @@ mmc_get_drive_cap_private (void *p_env,
length. */
CDIO_MMC_SET_READ_LENGTH16(cdb.field, i_data);
i_status = run_scsi_mmc_cmd (p_env, DEFAULT_TIMEOUT_MS,
scsi_mmc_get_cmd_len(cdb.field[0]),
&cdb, SCSI_MMC_DATA_READ,
sizeof(buf), &buf);
i_status = run_mmc_cmd (p_env, DEFAULT_TIMEOUT_MS,
mmc_get_cmd_len(cdb.field[0]),
&cdb, SCSI_MMC_DATA_READ,
sizeof(buf), &buf);
if (0 != i_status && CDIO_MMC_CAPABILITIES_PAGE != cdb.field[2]) {
cdb.field[2] = CDIO_MMC_CAPABILITIES_PAGE;
@@ -289,7 +296,7 @@ mmc_get_drive_cap_private (void *p_env,
*/
discmode_t
mmc_get_dvd_struct_physical_private ( void *p_env,
scsi_mmc_run_cmd_fn_t run_scsi_mmc_cmd,
mmc_run_cmd_fn_t run_mmc_cmd,
cdio_dvd_struct_t *s)
{
scsi_mmc_cdb_t cdb = {{0, }};
@@ -300,7 +307,7 @@ mmc_get_dvd_struct_physical_private ( void *p_env,
cdio_dvd_layer_t *layer;
if (!p_env) return DRIVER_OP_UNINIT;
if (!run_scsi_mmc_cmd) return DRIVER_OP_UNSUPPORTED;
if (!run_mmc_cmd) return DRIVER_OP_UNSUPPORTED;
if (layer_num >= CDIO_DVD_MAX_LAYERS)
return -EINVAL;
@@ -310,8 +317,8 @@ mmc_get_dvd_struct_physical_private ( void *p_env,
cdb.field[7] = CDIO_DVD_STRUCT_PHYSICAL;
cdb.field[9] = sizeof(buf) & 0xff;
i_status = run_scsi_mmc_cmd(p_env, DEFAULT_TIMEOUT_MS,
scsi_mmc_get_cmd_len(cdb.field[0]),
i_status = run_mmc_cmd(p_env, DEFAULT_TIMEOUT_MS,
mmc_get_cmd_len(cdb.field[0]),
&cdb, SCSI_MMC_DATA_READ,
sizeof(buf), &buf);
if (0 != i_status)
@@ -351,14 +358,14 @@ mmc_get_dvd_struct_physical_private ( void *p_env,
*/
char *
mmc_get_mcn_private ( void *p_env,
const scsi_mmc_run_cmd_fn_t run_scsi_mmc_cmd
const mmc_run_cmd_fn_t run_mmc_cmd
)
{
scsi_mmc_cdb_t cdb = {{0, }};
char buf[28] = { 0, };
int i_status;
if ( ! p_env || ! run_scsi_mmc_cmd )
if ( ! p_env || ! run_mmc_cmd )
return NULL;
CDIO_MMC_SET_COMMAND(cdb.field, CDIO_MMC_GPCMD_READ_SUBCHANNEL);
@@ -367,8 +374,8 @@ mmc_get_mcn_private ( void *p_env,
cdb.field[3] = CDIO_SUBCHANNEL_MEDIA_CATALOG;
CDIO_MMC_SET_READ_LENGTH16(cdb.field, sizeof(buf));
i_status = run_scsi_mmc_cmd(p_env, DEFAULT_TIMEOUT_MS,
scsi_mmc_get_cmd_len(cdb.field[0]),
i_status = run_mmc_cmd(p_env, DEFAULT_TIMEOUT_MS,
mmc_get_cmd_len(cdb.field[0]),
&cdb, SCSI_MMC_DATA_READ,
sizeof(buf), buf);
if(i_status == 0) {
@@ -385,7 +392,7 @@ mmc_get_mcn_private ( void *p_env,
*/
bool
mmc_init_cdtext_private ( void *p_user_data,
const scsi_mmc_run_cmd_fn_t run_scsi_mmc_cmd,
const mmc_run_cmd_fn_t run_mmc_cmd,
set_cdtext_field_fn_t set_cdtext_field_fn
)
{
@@ -395,7 +402,7 @@ mmc_init_cdtext_private ( void *p_user_data,
unsigned char wdata[5000] = { 0, };
int i_status, i_errno;
if ( ! p_env || ! run_scsi_mmc_cmd || p_env->b_cdtext_error )
if ( ! p_env || ! run_mmc_cmd || p_env->b_cdtext_error )
return false;
/* Operation code */
@@ -415,8 +422,8 @@ mmc_init_cdtext_private ( void *p_user_data,
/* We may need to give CD-Text a little more time to complete. */
/* First off, just try and read the size */
i_status = run_scsi_mmc_cmd (p_env, READ_TIMEOUT,
scsi_mmc_get_cmd_len(cdb.field[0]),
i_status = run_mmc_cmd (p_env, READ_TIMEOUT,
mmc_get_cmd_len(cdb.field[0]),
&cdb, SCSI_MMC_DATA_READ,
4, &wdata);
@@ -432,8 +439,8 @@ mmc_init_cdtext_private ( void *p_user_data,
if (i_cdtext > sizeof(wdata)) i_cdtext = sizeof(wdata);
CDIO_MMC_SET_READ_LENGTH16(cdb.field, i_cdtext);
i_status = run_scsi_mmc_cmd (p_env, READ_TIMEOUT,
scsi_mmc_get_cmd_len(cdb.field[0]),
i_status = run_mmc_cmd (p_env, READ_TIMEOUT,
mmc_get_cmd_len(cdb.field[0]),
&cdb, SCSI_MMC_DATA_READ,
i_cdtext, &wdata);
if (i_status != 0) {
@@ -450,7 +457,7 @@ mmc_init_cdtext_private ( void *p_user_data,
driver_return_code_t
mmc_set_blocksize_private ( void *p_env,
const scsi_mmc_run_cmd_fn_t run_scsi_mmc_cmd,
const mmc_run_cmd_fn_t run_mmc_cmd,
unsigned int i_bsize)
{
scsi_mmc_cdb_t cdb = {{0, }};
@@ -472,7 +479,7 @@ mmc_set_blocksize_private ( void *p_env,
} mh;
if ( ! p_env ) return DRIVER_OP_UNINIT;
if ( ! run_scsi_mmc_cmd ) return DRIVER_OP_UNSUPPORTED;
if ( ! run_mmc_cmd ) return DRIVER_OP_UNSUPPORTED;
memset (&mh, 0, sizeof (mh));
mh.block_desc_length = 0x08;
@@ -485,8 +492,8 @@ mmc_set_blocksize_private ( void *p_env,
cdb.field[1] = 1 << 4;
cdb.field[4] = 12;
return run_scsi_mmc_cmd (p_env, DEFAULT_TIMEOUT_MS,
scsi_mmc_get_cmd_len(cdb.field[0]), &cdb,
return run_mmc_cmd (p_env, DEFAULT_TIMEOUT_MS,
mmc_get_cmd_len(cdb.field[0]), &cdb,
SCSI_MMC_DATA_WRITE, sizeof(mh), &mh);
}
@@ -499,7 +506,7 @@ mmc_set_blocksize_private ( void *p_env,
either 6, 10, or 12.
*/
uint8_t
scsi_mmc_get_cmd_len(uint8_t scsi_cmd)
mmc_get_cmd_len(uint8_t scsi_cmd)
{
static const uint8_t scsi_cdblen[8] = {6, 10, 10, 12, 12, 12, 10, 10};
return scsi_cdblen[((scsi_cmd >> 5) & 7)];
@@ -510,7 +517,7 @@ scsi_mmc_get_cmd_len(uint8_t scsi_cmd)
@return the lsn. On error 0 or CDIO_INVALD_LSN.
*/
lsn_t
scsi_mmc_get_disc_last_lsn ( const CdIo_t *p_cdio )
mmc_get_disc_last_lsn ( const CdIo_t *p_cdio )
{
scsi_mmc_cdb_t cdb = {{0, }};
uint8_t buf[12] = { 0, };
@@ -530,9 +537,8 @@ scsi_mmc_get_disc_last_lsn ( const CdIo_t *p_cdio )
CDIO_MMC_SET_READ_LENGTH16(cdb.field, sizeof(buf));
i_status = scsi_mmc_run_cmd(p_cdio, DEFAULT_TIMEOUT_MS, &cdb,
SCSI_MMC_DATA_READ,
sizeof(buf), buf);
i_status = mmc_run_cmd(p_cdio, DEFAULT_TIMEOUT_MS, &cdb, SCSI_MMC_DATA_READ,
sizeof(buf), buf);
if (i_status) return CDIO_INVALID_LSN;
@@ -557,7 +563,7 @@ scsi_mmc_get_disc_last_lsn ( const CdIo_t *p_cdio )
especially tables 72, 73 and 75.
*/
discmode_t
scsi_mmc_get_discmode( const CdIo_t *p_cdio )
mmc_get_discmode( const CdIo_t *p_cdio )
{
uint8_t buf[14] = { 0, };
@@ -568,7 +574,7 @@ scsi_mmc_get_discmode( const CdIo_t *p_cdio )
cdb.field[1] = CDIO_CDROM_MSF; /* The MMC-5 spec may require this. */
cdb.field[2] = CDIO_MMC_READTOC_FMT_FULTOC;
CDIO_MMC_SET_READ_LENGTH8(cdb.field, sizeof(buf));
scsi_mmc_run_cmd(p_cdio, 2000, &cdb, SCSI_MMC_DATA_READ, sizeof(buf), buf);
mmc_run_cmd(p_cdio, 2000, &cdb, SCSI_MMC_DATA_READ, sizeof(buf), buf);
if (buf[7] == 0xA0) {
if (buf[13] == 0x00) {
if (buf[5] & 0x04)
@@ -585,14 +591,14 @@ scsi_mmc_get_discmode( const CdIo_t *p_cdio )
}
void
scsi_mmc_get_drive_cap (const CdIo_t *p_cdio,
mmc_get_drive_cap (const CdIo_t *p_cdio,
/*out*/ cdio_drive_read_cap_t *p_read_cap,
/*out*/ cdio_drive_write_cap_t *p_write_cap,
/*out*/ cdio_drive_misc_cap_t *p_misc_cap)
{
if ( ! p_cdio ) return;
mmc_get_drive_cap_private (p_cdio->env,
p_cdio->op.run_scsi_mmc_cmd,
p_cdio->op.run_mmc_cmd,
p_read_cap, p_write_cap, p_misc_cap);
}
@@ -600,12 +606,12 @@ scsi_mmc_get_drive_cap (const CdIo_t *p_cdio,
Get the DVD type associated with cd object.
*/
discmode_t
scsi_mmc_get_dvd_struct_physical ( const CdIo_t *p_cdio, cdio_dvd_struct_t *s)
mmc_get_dvd_struct_physical ( const CdIo_t *p_cdio, cdio_dvd_struct_t *s)
{
if ( ! p_cdio ) return -2;
return
mmc_get_dvd_struct_physical_private (p_cdio->env,
p_cdio->op.run_scsi_mmc_cmd,
p_cdio->op.run_mmc_cmd,
s);
}
@@ -614,7 +620,7 @@ scsi_mmc_get_dvd_struct_physical ( const CdIo_t *p_cdio, cdio_dvd_struct_t *s)
False is returned if we had an error getting the information.
*/
bool
scsi_mmc_get_hwinfo ( const CdIo_t *p_cdio,
mmc_get_hwinfo ( const CdIo_t *p_cdio,
/*out*/ cdio_hwinfo_t *hw_info )
{
int i_status; /* Result of SCSI MMC command */
@@ -626,7 +632,7 @@ scsi_mmc_get_hwinfo ( const CdIo_t *p_cdio,
if (! p_cdio || ! hw_info ) return false;
i_status = scsi_mmc_run_cmd(p_cdio, DEFAULT_TIMEOUT_MS,
i_status = mmc_run_cmd(p_cdio, DEFAULT_TIMEOUT_MS,
&cdb, SCSI_MMC_DATA_READ,
sizeof(buf), &buf);
if (i_status == 0) {
@@ -648,11 +654,42 @@ scsi_mmc_get_hwinfo ( const CdIo_t *p_cdio,
return false;
}
/*!
Find out if media has changed since the last call.
@param p_cdio the CD object to be acted upon.
@return 1 if media has changed since last call, 0 if not. Error
return codes are the same as driver_return_code_t
*/
int mmc_get_media_changed(const CdIo_t *p_cdio)
{
scsi_mmc_cdb_t cdb = {{0, }};
char buf[8] = { 0, };
int i_status;
if ( ! p_cdio ) return DRIVER_OP_UNINIT;
if ( ! p_cdio->op.run_mmc_cmd ) return DRIVER_OP_UNSUPPORTED;
CDIO_MMC_SET_COMMAND(cdb.field, CDIO_MMC_GPCMD_GET_EVENT_STATUS);
cdb.field[4] = 1 << 4; /* Media */
/* Setup to read header, to get length of data */
CDIO_MMC_SET_READ_LENGTH16(cdb.field, sizeof(buf));
i_status = p_cdio->op.run_mmc_cmd(p_cdio->env, DEFAULT_TIMEOUT_MS,
mmc_get_cmd_len(cdb.field[0]),
&cdb, SCSI_MMC_DATA_READ,
sizeof(buf), buf);
if(i_status == 0) {
return 0 != (buf[6] & 0x02);
}
return DRIVER_OP_ERROR;
}
char *
scsi_mmc_get_mcn ( const CdIo_t *p_cdio )
mmc_get_mcn ( const CdIo_t *p_cdio )
{
if ( ! p_cdio ) return NULL;
return mmc_get_mcn_private (p_cdio->env, p_cdio->op.run_scsi_mmc_cmd );
return mmc_get_mcn_private (p_cdio->env, p_cdio->op.run_mmc_cmd );
}
/*!
@@ -669,24 +706,24 @@ scsi_mmc_get_mcn ( const CdIo_t *p_cdio )
input. We'll figure out what the right CDB length should be.
*/
driver_return_code_t
scsi_mmc_run_cmd( const CdIo_t *p_cdio, unsigned int i_timeout_ms,
mmc_run_cmd( const CdIo_t *p_cdio, unsigned int i_timeout_ms,
const scsi_mmc_cdb_t *p_cdb,
scsi_mmc_direction_t e_direction, unsigned int i_buf,
/*in/out*/ void *p_buf )
{
if (!p_cdio) return DRIVER_OP_UNINIT;
if (!p_cdio->op.run_scsi_mmc_cmd) return DRIVER_OP_UNSUPPORTED;
return p_cdio->op.run_scsi_mmc_cmd(p_cdio->env, i_timeout_ms,
if (!p_cdio->op.run_mmc_cmd) return DRIVER_OP_UNSUPPORTED;
return p_cdio->op.run_mmc_cmd(p_cdio->env, i_timeout_ms,
scsi_mmc_get_cmd_len(p_cdb->field[0]),
p_cdb, e_direction, i_buf, p_buf);
}
int
scsi_mmc_get_blocksize ( const CdIo_t *p_cdio)
mmc_get_blocksize ( const CdIo_t *p_cdio)
{
if ( ! p_cdio ) return DRIVER_OP_UNINIT;
return
mmc_get_blocksize_private (p_cdio->env, p_cdio->op.run_scsi_mmc_cmd);
mmc_get_blocksize_private (p_cdio->env, p_cdio->op.run_mmc_cmd);
}
@@ -694,29 +731,29 @@ scsi_mmc_get_blocksize ( const CdIo_t *p_cdio)
* Eject using SCSI MMC commands. Return 0 if successful.
*/
driver_return_code_t
scsi_mmc_eject_media( const CdIo_t *p_cdio )
mmc_eject_media( const CdIo_t *p_cdio )
{
int i_status = 0;
scsi_mmc_cdb_t cdb = {{0, }};
uint8_t buf[1];
scsi_mmc_run_cmd_fn_t run_scsi_mmc_cmd;
mmc_run_cmd_fn_t run_mmc_cmd;
if ( ! p_cdio ) return DRIVER_OP_UNINIT;
if ( ! p_cdio->op.run_scsi_mmc_cmd ) return DRIVER_OP_UNSUPPORTED;
if ( ! p_cdio->op.run_mmc_cmd ) return DRIVER_OP_UNSUPPORTED;
run_scsi_mmc_cmd = p_cdio->op.run_scsi_mmc_cmd;
run_mmc_cmd = p_cdio->op.run_mmc_cmd;
CDIO_MMC_SET_COMMAND(cdb.field, CDIO_MMC_GPCMD_ALLOW_MEDIUM_REMOVAL);
i_status = run_scsi_mmc_cmd (p_cdio->env, DEFAULT_TIMEOUT_MS,
scsi_mmc_get_cmd_len(cdb.field[0]), &cdb,
i_status = run_mmc_cmd (p_cdio->env, DEFAULT_TIMEOUT_MS,
mmc_get_cmd_len(cdb.field[0]), &cdb,
SCSI_MMC_DATA_WRITE, 0, &buf);
if (0 != i_status) return i_status;
CDIO_MMC_SET_COMMAND(cdb.field, CDIO_MMC_GPCMD_START_STOP);
cdb.field[4] = 1;
i_status = run_scsi_mmc_cmd (p_cdio->env, DEFAULT_TIMEOUT_MS,
scsi_mmc_get_cmd_len(cdb.field[0]), &cdb,
i_status = run_mmc_cmd (p_cdio->env, DEFAULT_TIMEOUT_MS,
mmc_get_cmd_len(cdb.field[0]), &cdb,
SCSI_MMC_DATA_WRITE, 0, &buf);
if (0 != i_status)
return i_status;
@@ -724,9 +761,9 @@ scsi_mmc_eject_media( const CdIo_t *p_cdio )
CDIO_MMC_SET_COMMAND(cdb.field, CDIO_MMC_GPCMD_START_STOP);
cdb.field[4] = 2; /* eject */
return run_scsi_mmc_cmd (p_cdio->env, DEFAULT_TIMEOUT_MS,
scsi_mmc_get_cmd_len(cdb.field[0]), &cdb,
SCSI_MMC_DATA_WRITE, 0, &buf);
return run_mmc_cmd (p_cdio->env, DEFAULT_TIMEOUT_MS,
mmc_get_cmd_len(cdb.field[0]), &cdb,
SCSI_MMC_DATA_WRITE, 0, &buf);
}
@@ -734,17 +771,17 @@ scsi_mmc_eject_media( const CdIo_t *p_cdio )
Can read only up to 25 blocks.
*/
driver_return_code_t
scsi_mmc_read_sectors ( const CdIo_t *p_cdio, void *p_buf, lba_t lba,
mmc_read_sectors ( const CdIo_t *p_cdio, void *p_buf, lba_t lba,
int sector_type, unsigned int i_blocks )
{
scsi_mmc_cdb_t cdb = {{0, }};
scsi_mmc_run_cmd_fn_t run_scsi_mmc_cmd;
mmc_run_cmd_fn_t run_mmc_cmd;
if (!p_cdio) return DRIVER_OP_UNINIT;
if (!p_cdio->op.run_scsi_mmc_cmd ) return DRIVER_OP_UNSUPPORTED;
if (!p_cdio->op.run_mmc_cmd ) return DRIVER_OP_UNSUPPORTED;
run_scsi_mmc_cmd = p_cdio->op.run_scsi_mmc_cmd;
run_mmc_cmd = p_cdio->op.run_mmc_cmd;
CDIO_MMC_SET_COMMAND(cdb.field, CDIO_MMC_GPCMD_READ_CD);
CDIO_MMC_SET_READ_TYPE (cdb.field, sector_type);
@@ -753,19 +790,19 @@ scsi_mmc_read_sectors ( const CdIo_t *p_cdio, void *p_buf, lba_t lba,
CDIO_MMC_SET_MAIN_CHANNEL_SELECTION_BITS(cdb.field,
CDIO_MMC_MCSB_ALL_HEADERS);
return run_scsi_mmc_cmd (p_cdio->env, DEFAULT_TIMEOUT_MS,
scsi_mmc_get_cmd_len(cdb.field[0]), &cdb,
SCSI_MMC_DATA_READ,
CDIO_CD_FRAMESIZE_RAW * i_blocks,
p_buf);
return run_mmc_cmd (p_cdio->env, DEFAULT_TIMEOUT_MS,
mmc_get_cmd_len(cdb.field[0]), &cdb,
SCSI_MMC_DATA_READ,
CDIO_CD_FRAMESIZE_RAW * i_blocks,
p_buf);
}
driver_return_code_t
scsi_mmc_set_blocksize ( const CdIo_t *p_cdio, unsigned int i_blocksize)
mmc_set_blocksize ( const CdIo_t *p_cdio, unsigned int i_blocksize)
{
if ( ! p_cdio ) return DRIVER_OP_UNINIT;
return
mmc_set_blocksize_private (p_cdio->env, p_cdio->op.run_scsi_mmc_cmd,
mmc_set_blocksize_private (p_cdio->env, p_cdio->op.run_mmc_cmd,
i_blocksize);
}
@@ -775,11 +812,9 @@ scsi_mmc_set_blocksize ( const CdIo_t *p_cdio, unsigned int i_blocksize)
@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.
@see scsi_mmc_set_speed
*/
int
scsi_mmc_set_speed( const CdIo_t *p_cdio, int i_speed )
mmc_set_speed( const CdIo_t *p_cdio, int i_speed )
{
uint8_t buf[14] = { 0, };
@@ -800,8 +835,8 @@ scsi_mmc_set_speed( const CdIo_t *p_cdio, int i_speed )
the maximum allowable speed.
*/
CDIO_MMC_SET_LEN16(cdb.field, 4, 0xffff);
return scsi_mmc_run_cmd(p_cdio, 2000, &cdb, SCSI_MMC_DATA_READ,
sizeof(buf), buf);
return mmc_run_cmd(p_cdio, 2000, &cdb, SCSI_MMC_DATA_READ,
sizeof(buf), buf);
}

View File

@@ -1,6 +1,6 @@
/* private MMC helper routines.
$Id: mmc_private.h,v 1.1 2005/02/05 13:07:02 rocky Exp $
$Id: mmc_private.h,v 1.2 2005/02/06 11:13:37 rocky Exp $
Copyright (C) 2004, 2005 Rocky Bernstein <rocky@panix.com>
@@ -55,6 +55,8 @@ void get_drive_cap_mmc (const void *p_user_data,
/*out*/ cdio_drive_write_cap_t *p_write_cap,
/*out*/ cdio_drive_misc_cap_t *p_misc_cap);
int get_media_changed_mmc (const void *p_user_data);
char *get_mcn_mmc (const void *p_user_data);
/* Set read blocksize (via MMC) */
@@ -68,7 +70,7 @@ driver_return_code_t set_speed_mmc (void *p_user_data, int i_speed);
to better classify these.
************************************************************/
typedef driver_return_code_t (*scsi_mmc_run_cmd_fn_t)
typedef driver_return_code_t (*mmc_run_cmd_fn_t)
( void *p_user_data,
unsigned int i_timeout_ms,
unsigned int i_cdb,
@@ -77,7 +79,7 @@ typedef driver_return_code_t (*scsi_mmc_run_cmd_fn_t)
unsigned int i_buf, /*in/out*/ void *p_buf );
int mmc_set_blocksize_mmc_private ( const void *p_env, const
scsi_mmc_run_cmd_fn_t run_scsi_mmc_cmd,
mmc_run_cmd_fn_t run_mmc_cmd,
unsigned int bsize );
/*!
@@ -85,20 +87,20 @@ int mmc_set_blocksize_mmc_private ( const void *p_env, const
*/
discmode_t
mmc_get_dvd_struct_physical_private ( void *p_env,
scsi_mmc_run_cmd_fn_t run_scsi_mmc_cmd,
mmc_run_cmd_fn_t run_mmc_cmd,
cdio_dvd_struct_t *s );
int
mmc_get_blocksize_private ( void *p_env,
scsi_mmc_run_cmd_fn_t run_scsi_mmc_cmd);
mmc_run_cmd_fn_t run_mmc_cmd);
char *mmc_get_mcn_private ( void *p_env,
scsi_mmc_run_cmd_fn_t run_scsi_mmc_cmd
mmc_run_cmd_fn_t run_mmc_cmd
);
bool mmc_init_cdtext_private ( void *p_user_data,
scsi_mmc_run_cmd_fn_t run_scsi_mmc_cmd,
mmc_run_cmd_fn_t run_mmc_cmd,
set_cdtext_field_fn_t set_cdtext_field_fn
);
@@ -121,11 +123,11 @@ void mmc_get_drive_cap_buf(const uint8_t *p,
*/
void
mmc_get_drive_cap_private ( void *p_env,
const scsi_mmc_run_cmd_fn_t run_scsi_mmc_cmd,
const mmc_run_cmd_fn_t run_mmc_cmd,
/*out*/ cdio_drive_read_cap_t *p_read_cap,
/*out*/ cdio_drive_write_cap_t *p_write_cap,
/*out*/ cdio_drive_misc_cap_t *p_misc_cap);
driver_return_code_t
mmc_set_blocksize_private ( void *p_env,
const scsi_mmc_run_cmd_fn_t run_scsi_mmc_cmd,
const mmc_run_cmd_fn_t run_mmc_cmd,
unsigned int i_bsize);