diff --git a/include/cdio/mmc.h b/include/cdio/mmc.h index c7a4eeaf..d85bc282 100644 --- a/include/cdio/mmc.h +++ b/include/cdio/mmc.h @@ -374,18 +374,20 @@ typedef struct mmc_cdb_s { unsigned char reserved2; unsigned char profile_msb; 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 - data or getting data. + data, or getting data, or does none of both. + */ + typedef enum mmc_direction_s { + SCSI_MMC_DATA_READ, + SCSI_MMC_DATA_WRITE, + SCSI_MMC_DATA_NONE + } cdio_mmc_direction_t; + /** Indicate to applications that SCSI_MMC_DATA_NONE is available */ - typedef enum mmc_direction_s { - SCSI_MMC_DATA_READ, - SCSI_MMC_DATA_WRITE - } cdio_mmc_direction_t; - +#define SCSI_MMC_HAS_DIR_NONE 1 typedef struct mmc_subchannel_s - { + { uint8_t reserved; uint8_t audio_status; uint16_t data_length; /**< Really ISO 9660 7.2.2 */ diff --git a/lib/driver/gnu_linux.c b/lib/driver/gnu_linux.c index a7eaa663..74a2e256 100644 --- a/lib/driver/gnu_linux.c +++ b/lib/driver/gnu_linux.c @@ -1224,13 +1224,12 @@ run_mmc_cmd_linux( void *p_user_data, const _img_private_t *p_env = p_user_data; struct cdrom_generic_command cgc; memset (&cgc, 0, sizeof (struct cdrom_generic_command)); - memcpy(&cgc.cmd, p_cdb, i_cdb); - cgc.buflen = i_buf; - cgc.buffer = p_buf; - cgc.data_direction = (SCSI_MMC_DATA_READ == cgc.data_direction) - ? CGC_DATA_READ : CGC_DATA_WRITE; - -#ifdef HAVE_LINUX_CDROM_TIMEOUT + memcpy(&cgc.cmd, p_cdb, i_cdb); + cgc.buflen = i_buf; + cgc.buffer = p_buf; + cgc.data_direction = (SCSI_MMC_DATA_READ == e_direction) + ? CGC_DATA_READ : CGC_DATA_WRITE; + #ifdef HAVE_LINUX_CDROM_TIMEOUT cgc.timeout = i_timeout_ms; #endif @@ -1639,7 +1638,7 @@ cdio_open_am_linux (const char *psz_orig_source, const char *access_mode) ret->driver_id = DRIVER_LINUX; - if (cdio_generic_init(_data, O_RDONLY|O_NONBLOCK)) { + if (cdio_generic_init(_data, O_RDWR|O_NONBLOCK)) { return ret; } else { cdio_generic_free (_data);