diff --git a/lib/MSWindows/aspi32.h b/lib/MSWindows/aspi32.h index 3c6f6976..c93e8908 100644 --- a/lib/MSWindows/aspi32.h +++ b/lib/MSWindows/aspi32.h @@ -1,6 +1,6 @@ /* Win32 aspi specific */ /* - $Id: aspi32.h,v 1.9 2004/07/18 06:51:49 rocky Exp $ + $Id: aspi32.h,v 1.10 2004/07/23 14:40:43 rocky Exp $ Copyright (C) 2003, 2004 Rocky Bernstein @@ -232,3 +232,24 @@ int read_mode2_sector_aspi (const _img_private_t *env, void *data, lsn_t lsn, */ bool read_toc_aspi (_img_private_t *env); +/*! + Run a SCSI MMC command. + + env private CD structure + i_timeout time in milliseconds we will wait for the command + to complete. If this value is -1, use the default + time-out value. + p_buf Buffer for data, both sending and receiving + i_buf Size of buffer + e_direction direction the transfer is to go. + cdb CDB bytes. All values that are needed should be set on + input. We'll figure out what the right CDB length should be. + + Return 0 if command completed successfully. + */ +int scsi_mmc_run_cmd_aspi( const void *p_user_data, 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 ); + diff --git a/lib/MSWindows/win32.c b/lib/MSWindows/win32.c index 5778c29c..fe461075 100644 --- a/lib/MSWindows/win32.c +++ b/lib/MSWindows/win32.c @@ -1,5 +1,5 @@ /* - $Id: win32.c,v 1.26 2004/07/19 15:40:47 rocky Exp $ + $Id: win32.c,v 1.27 2004/07/23 14:40:43 rocky Exp $ Copyright (C) 2003, 2004 Rocky Bernstein @@ -26,7 +26,7 @@ # include "config.h" #endif -static const char _rcsid[] = "$Id: win32.c,v 1.26 2004/07/19 15:40:47 rocky Exp $"; +static const char _rcsid[] = "$Id: win32.c,v 1.27 2004/07/23 14:40:43 rocky Exp $"; #include #include @@ -124,6 +124,39 @@ _cdio_get_drive_cap (const void *env, } } + +/*! + Run a SCSI MMC command. + + env private CD structure + i_timeout time in milliseconds we will wait for the command + to complete. If this value is -1, use the default + time-out value. + p_buf Buffer for data, both sending and receiving + i_buf Size of buffer + e_direction direction the transfer is to go. + cdb CDB bytes. All values that are needed should be set on + input. We'll figure out what the right CDB length should be. + + Return 0 if command completed successfully. + */ +static int +scsi_mmc_run_cmd_win32( const void *p_user_data, 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 ) +{ + const _img_private_t *p_env = p_user_data; + + if (p_env->hASPI) { + return scsi_mmc_run_cmd_aspi( p_env, i_timeout, i_cdb, p_cdb, + e_direction, i_buf, p_buf ); + } else { + return scsi_mmc_run_cmd_win32ioctl( p_env, i_timeout, i_cdb, p_cdb, + e_direction, i_buf, p_buf ); + } +} + /*! Initialize CD device. */ @@ -755,6 +788,7 @@ cdio_open_am_win32 (const char *psz_orig_source, const char *psz_access_mode) .read_mode1_sectors = _cdio_read_mode1_sectors, .read_mode2_sector = _cdio_read_mode2_sector, .read_mode2_sectors = _cdio_read_mode2_sectors, + .run_scsi_mmc_cmd = scsi_mmc_run_cmd_win32, .set_arg = _set_arg_win32, .stat_size = _cdio_stat_size }; diff --git a/lib/MSWindows/win32.h b/lib/MSWindows/win32.h index 6ffb2a29..4ba7d4b9 100644 --- a/lib/MSWindows/win32.h +++ b/lib/MSWindows/win32.h @@ -1,5 +1,5 @@ /* - $Id: win32.h,v 1.13 2004/07/18 06:51:49 rocky Exp $ + $Id: win32.h,v 1.14 2004/07/23 14:40:43 rocky Exp $ Copyright (C) 2004 Rocky Bernstein @@ -85,6 +85,27 @@ int read_mode1_sector_win32ioctl (const _img_private_t *env, void *data, const char *is_cdrom_win32ioctl (const char drive_letter); +/*! + Run a SCSI MMC command. + + env private CD structure + i_timeout time in milliseconds we will wait for the command + to complete. If this value is -1, use the default + time-out value. + p_buf Buffer for data, both sending and receiving + i_buf Size of buffer + e_direction direction the transfer is to go. + cdb CDB bytes. All values that are needed should be set on + input. We'll figure out what the right CDB length should be. + + Return 0 if command completed successfully. + */ +int scsi_mmc_run_cmd_win32ioctl( const void *p_user_data, 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 ); + /*! Initialize internal structures for CD device. */ diff --git a/lib/MSWindows/win32_ioctl.c b/lib/MSWindows/win32_ioctl.c index 67175910..92eed84e 100644 --- a/lib/MSWindows/win32_ioctl.c +++ b/lib/MSWindows/win32_ioctl.c @@ -1,5 +1,5 @@ /* - $Id: win32_ioctl.c,v 1.21 2004/07/23 14:28:42 rocky Exp $ + $Id: win32_ioctl.c,v 1.22 2004/07/23 14:40:43 rocky Exp $ Copyright (C) 2004 Rocky Bernstein @@ -26,7 +26,7 @@ # include "config.h" #endif -static const char _rcsid[] = "$Id: win32_ioctl.c,v 1.21 2004/07/23 14:28:42 rocky Exp $"; +static const char _rcsid[] = "$Id: win32_ioctl.c,v 1.22 2004/07/23 14:40:43 rocky Exp $"; #include #include @@ -142,7 +142,7 @@ typedef struct _SUB_Q_MEDIA_CATALOG_NUMBER { Return 0 if command completed successfully. */ -static int +int scsi_mmc_run_cmd_win32ioctl( const void *p_user_data, int i_timeout, unsigned int i_cdb, const scsi_mmc_cdb_t * p_cdb, scsi_mmc_direction_t e_direction,