diff --git a/NEWS b/NEWS index 329267ee..f7fb45bd 100644 --- a/NEWS +++ b/NEWS @@ -1,14 +1,15 @@ -$Id: NEWS,v 1.71 2005/06/25 10:14:00 rocky Exp $ +$Id: NEWS,v 1.72 2005/06/26 18:29:49 rocky Exp $ version 0.75 ===================================== 2005-?? -- Windows audio volume level fix +- audio volume level fix on Microsoft Windows - fix build when --enable-shared, --disable-static - CD-Text retrieval fix - miscellaneous small bug fixes, removal of questionable idioms or memory leak fixes +- allow the MMC timout to be adjusted by the application version 0.74 ===================================== @@ -258,4 +259,4 @@ version 0.1 Routines split off from VCDImager. -$Id: NEWS,v 1.71 2005/06/25 10:14:00 rocky Exp $ +$Id: NEWS,v 1.72 2005/06/26 18:29:49 rocky Exp $ diff --git a/include/cdio/mmc.h b/include/cdio/mmc.h index ca62d0ec..738aa655 100644 --- a/include/cdio/mmc.h +++ b/include/cdio/mmc.h @@ -1,5 +1,5 @@ /* - $Id: mmc.h,v 1.20 2005/04/30 09:42:37 rocky Exp $ + $Id: mmc.h,v 1.21 2005/06/26 18:29:49 rocky Exp $ Copyright (C) 2003, 2004, 2005 Rocky Bernstein @@ -36,6 +36,22 @@ #ifdef __cplusplus extern "C" { #endif /* __cplusplus */ + + /*! Set this to the maximum value in milliseconds that we will + wait on an MMC command. */ + extern uint32_t mmc_timeout_ms; + + /*! The default timeout (non-read) is 6 seconds. */ +#define MMC_TIMEOUT_DEFAULT 6000 + + /*! Set this to the maximum value in milliseconds that we will + wait on an MMC read command. */ + extern uint32_t mmc_read_timeout_ms; + + /*! The default read timeout is 3 minutes. */ +#define MMC_READ_TIMEOUT_DEFAULT 3*60*1000 + + /*! \brief The opcode-portion (generic packet commands) of an MMC command. diff --git a/lib/driver/libcdio.sym b/lib/driver/libcdio.sym index 3fd9762f..c2d2cedb 100644 --- a/lib/driver/libcdio.sym +++ b/lib/driver/libcdio.sym @@ -184,9 +184,11 @@ mmc_mode_sense_6 mmc_read_cd mmc_read_data_sectors mmc_read_sectors +mmc_read_timeout_ms mmc_run_cmd mmc_set_blocksize mmc_set_speed mmc_start_stop_media +mmc_timeout_ms track_format2str CDIO_SECTOR_SYNC_HEADER diff --git a/lib/driver/mmc.c b/lib/driver/mmc.c index 10e35656..2aaa8a3e 100644 --- a/lib/driver/mmc.c +++ b/lib/driver/mmc.c @@ -1,6 +1,6 @@ /* Common Multimedia Command (MMC) routines. - $Id: mmc.c,v 1.26 2005/04/30 09:42:37 rocky Exp $ + $Id: mmc.c,v 1.27 2005/06/26 18:29:49 rocky Exp $ Copyright (C) 2004, 2005 Rocky Bernstein @@ -45,8 +45,6 @@ #include #endif -#define DEFAULT_TIMEOUT_MS 6000 - /************************************************************************* MMC CdIo Operations which a driver may use. These are not accessible directly. @@ -55,6 +53,14 @@ corresponding publically-accessible routine. *************************************************************************/ +/*! The maximum value in milliseconds that we will wait on an MMC + command. */ +uint32_t mmc_timeout_ms = MMC_TIMEOUT_DEFAULT; + +/*! The maximum value in milliseconds that we will wait on an MMC read + command. */ +uint32_t mmc_read_timeout_ms = MMC_READ_TIMEOUT_DEFAULT; + /*! Read Audio Subchannel information @@ -267,7 +273,7 @@ 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_mmc_cmd(p_env, DEFAULT_TIMEOUT_MS, + i_status = run_mmc_cmd(p_env, mmc_timeout_ms, mmc_get_cmd_len(cdb.field[0]), &cdb, SCSI_MMC_DATA_READ, sizeof(buf), &buf); @@ -325,7 +331,7 @@ mmc_get_mcn_private ( void *p_env, cdb.field[2] = 0x40; cdb.field[3] = CDIO_SUBCHANNEL_MEDIA_CATALOG; - i_status = run_mmc_cmd(p_env, DEFAULT_TIMEOUT_MS, + i_status = run_mmc_cmd(p_env, mmc_timeout_ms, mmc_get_cmd_len(cdb.field[0]), &cdb, SCSI_MMC_DATA_READ, sizeof(buf), buf); @@ -372,7 +378,7 @@ mmc_mode_sense_6( CdIo_t *p_cdio, void *p_buf, int i_size, int page) cdb.field[4] = i_size; return p_cdio->op.run_mmc_cmd (p_cdio->env, - DEFAULT_TIMEOUT_MS, + mmc_timeout_ms, mmc_get_cmd_len(cdb.field[0]), &cdb, SCSI_MMC_DATA_READ, i_size, p_buf); } @@ -398,7 +404,7 @@ mmc_mode_sense_10( CdIo_t *p_cdio, void *p_buf, int i_size, int page) cdb.field[2] = 0x3F & page; return p_cdio->op.run_mmc_cmd (p_cdio->env, - DEFAULT_TIMEOUT_MS, + mmc_timeout_ms, mmc_get_cmd_len(cdb.field[0]), &cdb, SCSI_MMC_DATA_READ, i_size, p_buf); } @@ -437,15 +443,12 @@ mmc_init_cdtext_private ( void *p_user_data, errno = 0; -/* Set read timeout 3 minues. */ -#define READ_TIMEOUT 3*60*1000 - /* We may need to give CD-Text a little more time to complete. */ /* First off, just try and read the size */ - i_status = run_mmc_cmd (p_env, READ_TIMEOUT, - mmc_get_cmd_len(cdb.field[0]), - &cdb, SCSI_MMC_DATA_READ, - 4, &wdata); + i_status = run_mmc_cmd (p_env, mmc_read_timeout_ms, + mmc_get_cmd_len(cdb.field[0]), + &cdb, SCSI_MMC_DATA_READ, + 4, &wdata); if (i_status != 0) { cdio_info ("CD-Text read failed for header: %s\n", strerror(errno)); @@ -459,10 +462,10 @@ 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_mmc_cmd (p_env, READ_TIMEOUT, - mmc_get_cmd_len(cdb.field[0]), - &cdb, SCSI_MMC_DATA_READ, - i_cdtext, &wdata); + i_status = run_mmc_cmd (p_env, mmc_read_timeout_ms, + mmc_get_cmd_len(cdb.field[0]), + &cdb, SCSI_MMC_DATA_READ, + i_cdtext, &wdata); if (i_status != 0) { cdio_info ("CD-Text read for text failed: %s\n", strerror(errno)); i_errno = errno; @@ -512,7 +515,7 @@ mmc_set_blocksize_private ( void *p_env, cdb.field[1] = 1 << 4; cdb.field[4] = 12; - return run_mmc_cmd (p_env, DEFAULT_TIMEOUT_MS, + return run_mmc_cmd (p_env, mmc_timeout_ms, mmc_get_cmd_len(cdb.field[0]), &cdb, SCSI_MMC_DATA_WRITE, sizeof(mh), &mh); } @@ -557,7 +560,7 @@ mmc_get_disc_last_lsn ( const CdIo_t *p_cdio ) CDIO_MMC_SET_READ_LENGTH16(cdb.field, sizeof(buf)); - i_status = mmc_run_cmd(p_cdio, DEFAULT_TIMEOUT_MS, &cdb, SCSI_MMC_DATA_READ, + i_status = mmc_run_cmd(p_cdio, mmc_timeout_ms, &cdb, SCSI_MMC_DATA_READ, sizeof(buf), buf); if (i_status) return CDIO_INVALID_LSN; @@ -600,7 +603,7 @@ mmc_audio_read_subchannel (CdIo_t *p_cdio, cdio_subchannel_t *p_subchannel) cdb.field[3] = CDIO_SUBCHANNEL_CURRENT_POSITION; cdb.field[6] = 0; /* track number (only in isrc mode, ignored) */ - i_rc = mmc_run_cmd(p_cdio, DEFAULT_TIMEOUT_MS, &cdb, SCSI_MMC_DATA_READ, + i_rc = mmc_run_cmd(p_cdio, mmc_timeout_ms, &cdb, SCSI_MMC_DATA_READ, sizeof(mmc_subchannel_t), &mmc_subchannel); if (DRIVER_OP_SUCCESS == i_rc) { p_subchannel->format = mmc_subchannel.format; @@ -791,7 +794,7 @@ mmc_get_hwinfo ( const CdIo_t *p_cdio, if (! p_cdio || ! hw_info ) return false; - i_status = mmc_run_cmd(p_cdio, DEFAULT_TIMEOUT_MS, + i_status = mmc_run_cmd(p_cdio, mmc_timeout_ms, &cdb, SCSI_MMC_DATA_READ, sizeof(buf), &buf); if (i_status == 0) { @@ -836,7 +839,7 @@ int mmc_get_media_changed(const CdIo_t *p_cdio) cdb.field[1] = 1; /* We poll for info */ cdb.field[4] = 1 << 4; /* We want Media events */ - i_status = p_cdio->op.run_mmc_cmd(p_cdio->env, DEFAULT_TIMEOUT_MS, + i_status = p_cdio->op.run_mmc_cmd(p_cdio->env, mmc_timeout_ms, mmc_get_cmd_len(cdb.field[0]), &cdb, SCSI_MMC_DATA_READ, sizeof(buf), buf); @@ -948,7 +951,7 @@ mmc_start_stop_media(const CdIo_t *p_cdio, bool b_eject, bool b_immediate, cdb.field[4] = 3; /* close tray for tray-type */ } - return p_cdio->op.run_mmc_cmd (p_cdio->env, DEFAULT_TIMEOUT_MS, + return p_cdio->op.run_mmc_cmd (p_cdio->env, mmc_timeout_ms, mmc_get_cmd_len(cdb.field[0]), &cdb, SCSI_MMC_DATA_WRITE, 0, &buf); } @@ -981,7 +984,7 @@ mmc_eject_media( const CdIo_t *p_cdio ) CDIO_MMC_SET_COMMAND(cdb.field, CDIO_MMC_GPCMD_ALLOW_MEDIUM_REMOVAL); - i_status = p_cdio->op.run_mmc_cmd (p_cdio->env, DEFAULT_TIMEOUT_MS, + i_status = p_cdio->op.run_mmc_cmd (p_cdio->env, mmc_timeout_ms, mmc_get_cmd_len(cdb.field[0]), &cdb, SCSI_MMC_DATA_WRITE, 0, &buf); if (0 != i_status) return i_status; @@ -1190,7 +1193,7 @@ mmc_have_interface( CdIo_t *p_cdio, mmc_feature_interface_t e_interface ) drive capabilities. */ #define MAX_CD_READ_BLOCKS 16 -#define CD_READ_TIMEOUT_MS DEFAULT_TIMEOUT_MS * (MAX_CD_READ_BLOCKS/2) +#define CD_READ_TIMEOUT_MS mmc_timeout_ms * (MAX_CD_READ_BLOCKS/2) /*! issue a MMC READ_CD command. */ @@ -1303,7 +1306,7 @@ mmc_read_sectors ( const CdIo_t *p_cdio, void *p_buf, lsn_t i_lsn, CDIO_MMC_SET_MAIN_CHANNEL_SELECTION_BITS(cdb.field, CDIO_MMC_MCSB_ALL_HEADERS); - return run_mmc_cmd (p_cdio->env, DEFAULT_TIMEOUT_MS, + return run_mmc_cmd (p_cdio->env, mmc_timeout_ms, mmc_get_cmd_len(cdb.field[0]), &cdb, SCSI_MMC_DATA_READ, CDIO_CD_FRAMESIZE_RAW * i_blocks,