Bug fix for mmc_have_interface.

checK_paranoia.sh.in: fix bug in returning success on a core dump
win32.c: some small changes - more later.
image/*.c: set run_mmc_cmd NULL explicitly.
This commit is contained in:
rocky
2005-02-11 01:34:12 +00:00
parent e491ba74d6
commit 8dfb4780cd
7 changed files with 53 additions and 20 deletions

View File

@@ -1,5 +1,5 @@
/* /*
$Id: win32.c,v 1.17 2005/02/07 03:36:02 rocky Exp $ $Id: win32.c,v 1.18 2005/02/11 01:34:12 rocky Exp $
Copyright (C) 2003, 2004, 2005 Rocky Bernstein <rocky@panix.com> Copyright (C) 2003, 2004, 2005 Rocky Bernstein <rocky@panix.com>
@@ -26,7 +26,7 @@
# include "config.h" # include "config.h"
#endif #endif
static const char _rcsid[] = "$Id: win32.c,v 1.17 2005/02/07 03:36:02 rocky Exp $"; static const char _rcsid[] = "$Id: win32.c,v 1.18 2005/02/11 01:34:12 rocky Exp $";
#include <cdio/cdio.h> #include <cdio/cdio.h>
#include <cdio/sector.h> #include <cdio/sector.h>
@@ -186,9 +186,10 @@ run_mmc_cmd_win32( void *p_user_data, unsigned int i_timeout_ms,
Initialize CD device. Initialize CD device.
*/ */
static bool static bool
_cdio_init_win32 (void *user_data) _init_win32 (void *user_data)
{ {
_img_private_t *p_env = user_data; _img_private_t *p_env = user_data;
bool b_ret;
if (p_env->gen.init) { if (p_env->gen.init) {
cdio_error ("init called more than once"); cdio_error ("init called more than once");
return false; return false;
@@ -208,10 +209,18 @@ _cdio_init_win32 (void *user_data)
p_env->b_ioctl_init = false; p_env->b_ioctl_init = false;
if ( _AM_IOCTL == p_env->access_mode ) { if ( _AM_IOCTL == p_env->access_mode ) {
return init_win32ioctl(p_env); b_ret = init_win32ioctl(p_env);
} else { } else {
return init_aspi(p_env); b_ret = init_aspi(p_env);
} }
/* It looks like get_media_changed_mmc will always
return 1 (media changed) on the first call. So
we call it here to clear that flag. We may have
to rethink this if there's a problem doing this
extra work down the line. */
get_media_changed_mmc(p_user_data);
return b_ret;
} }
/*! /*!
@@ -795,7 +804,7 @@ cdio_open_am_win32 (const char *psz_orig_source, const char *psz_access_mode)
ret = cdio_new ((void *)_data, &_funcs); ret = cdio_new ((void *)_data, &_funcs);
if (ret == NULL) return NULL; if (ret == NULL) return NULL;
if (_cdio_init_win32(_data)) if (_init_win32(_data))
return ret; return ret;
else { else {
_free_win32 (_data); _free_win32 (_data);

View File

@@ -1,5 +1,5 @@
/* /*
$Id: bincue.c,v 1.12 2005/02/06 11:13:37 rocky Exp $ $Id: bincue.c,v 1.13 2005/02/11 01:34:12 rocky Exp $
Copyright (C) 2002, 2003, 2004, 2005 Rocky Bernstein <rocky@panix.com> Copyright (C) 2002, 2003, 2004, 2005 Rocky Bernstein <rocky@panix.com>
Copyright (C) 2001 Herbert Valerio Riedel <hvr@gnu.org> Copyright (C) 2001 Herbert Valerio Riedel <hvr@gnu.org>
@@ -26,7 +26,7 @@
(*.cue). (*.cue).
*/ */
static const char _rcsid[] = "$Id: bincue.c,v 1.12 2005/02/06 11:13:37 rocky Exp $"; static const char _rcsid[] = "$Id: bincue.c,v 1.13 2005/02/11 01:34:12 rocky Exp $";
#include "image.h" #include "image.h"
#include "cdio_assert.h" #include "cdio_assert.h"
@@ -1163,6 +1163,7 @@ cdio_open_cue (const char *psz_cue_name)
_funcs.read_mode1_sectors = _read_mode1_sectors_bincue; _funcs.read_mode1_sectors = _read_mode1_sectors_bincue;
_funcs.read_mode2_sector = _read_mode2_sector_bincue; _funcs.read_mode2_sector = _read_mode2_sector_bincue;
_funcs.read_mode2_sectors = _read_mode2_sectors_bincue; _funcs.read_mode2_sectors = _read_mode2_sectors_bincue;
_funcs.run_mmc_cmd = NULL;
_funcs.set_arg = _set_arg_image; _funcs.set_arg = _set_arg_image;
if (NULL == psz_cue_name) return NULL; if (NULL == psz_cue_name) return NULL;

View File

@@ -1,5 +1,5 @@
/* /*
$Id: cdrdao.c,v 1.13 2005/02/06 11:13:37 rocky Exp $ $Id: cdrdao.c,v 1.14 2005/02/11 01:34:12 rocky Exp $
Copyright (C) 2004, 2005 Rocky Bernstein <rocky@panix.com> Copyright (C) 2004, 2005 Rocky Bernstein <rocky@panix.com>
toc reading routine adapted from cuetools toc reading routine adapted from cuetools
@@ -25,7 +25,7 @@
(*.cue). (*.cue).
*/ */
static const char _rcsid[] = "$Id: cdrdao.c,v 1.13 2005/02/06 11:13:37 rocky Exp $"; static const char _rcsid[] = "$Id: cdrdao.c,v 1.14 2005/02/11 01:34:12 rocky Exp $";
#include "image.h" #include "image.h"
#include "cdio_assert.h" #include "cdio_assert.h"
@@ -1290,6 +1290,7 @@ cdio_open_cdrdao (const char *psz_cue_name)
_funcs.read_mode1_sectors = _read_mode1_sectors_cdrdao; _funcs.read_mode1_sectors = _read_mode1_sectors_cdrdao;
_funcs.read_mode2_sector = _read_mode2_sector_cdrdao; _funcs.read_mode2_sector = _read_mode2_sector_cdrdao;
_funcs.read_mode2_sectors = _read_mode2_sectors_cdrdao; _funcs.read_mode2_sectors = _read_mode2_sectors_cdrdao;
_funcs.run_mmc_cmd = NULL;
_funcs.set_arg = _set_arg_image; _funcs.set_arg = _set_arg_image;
_funcs.set_speed = cdio_generic_unimplemented_set_speed; _funcs.set_speed = cdio_generic_unimplemented_set_speed;
_funcs.set_blocksize = cdio_generic_unimplemented_set_blocksize; _funcs.set_blocksize = cdio_generic_unimplemented_set_blocksize;

View File

@@ -1,5 +1,5 @@
/* /*
$Id: nrg.c,v 1.12 2005/02/09 09:55:38 rocky Exp $ $Id: nrg.c,v 1.13 2005/02/11 01:34:12 rocky Exp $
Copyright (C) 2003, 2004, 2005 Rocky Bernstein <rocky@panix.com> Copyright (C) 2003, 2004, 2005 Rocky Bernstein <rocky@panix.com>
Copyright (C) 2001, 2003 Herbert Valerio Riedel <hvr@gnu.org> Copyright (C) 2001, 2003 Herbert Valerio Riedel <hvr@gnu.org>
@@ -46,7 +46,7 @@
#include "_cdio_stdio.h" #include "_cdio_stdio.h"
#include "nrg.h" #include "nrg.h"
static const char _rcsid[] = "$Id: nrg.c,v 1.12 2005/02/09 09:55:38 rocky Exp $"; static const char _rcsid[] = "$Id: nrg.c,v 1.13 2005/02/11 01:34:12 rocky Exp $";
/* reader */ /* reader */
@@ -1243,6 +1243,7 @@ cdio_open_nrg (const char *psz_source)
_funcs.read_mode1_sectors = _read_mode1_sectors_nrg; _funcs.read_mode1_sectors = _read_mode1_sectors_nrg;
_funcs.read_mode2_sector = _read_mode2_sector_nrg; _funcs.read_mode2_sector = _read_mode2_sector_nrg;
_funcs.read_mode2_sectors = _read_mode2_sectors_nrg; _funcs.read_mode2_sectors = _read_mode2_sectors_nrg;
_funcs.run_mmc_cmd = NULL;
_funcs.set_arg = _set_arg_image; _funcs.set_arg = _set_arg_image;
_data = calloc(1, sizeof (_img_private_t)); _data = calloc(1, sizeof (_img_private_t));

View File

@@ -1,5 +1,5 @@
/* /*
$Id: image_common.c,v 1.9 2005/02/06 11:32:22 rocky Exp $ $Id: image_common.c,v 1.10 2005/02/11 01:34:12 rocky Exp $
Copyright (C) 2004, 2005 Rocky Bernstein <rocky@panix.com> Copyright (C) 2004, 2005 Rocky Bernstein <rocky@panix.com>
@@ -151,12 +151,13 @@ _get_first_track_num_image(void *p_user_data)
@param p_user_data the CD object to be acted upon. @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 1 if media has changed since last call, 0 if not. Error
return codes are the same as driver_return_code_t return codes are the same as driver_return_code_t
We always return DRIVER_OP_UNSUPPORTED. There is no such thing as changing a media image so we will
always return 0 - no change.
*/ */
int int
get_media_changed_image(const void *p_user_data) get_media_changed_image(const void *p_user_data)
{ {
return DRIVER_OP_UNSUPPORTED; return 0;
} }
/*! /*!

View File

@@ -1,6 +1,6 @@
/* Common Multimedia Command (MMC) routines. /* Common Multimedia Command (MMC) routines.
$Id: mmc.c,v 1.9 2005/02/10 11:23:08 rocky Exp $ $Id: mmc.c,v 1.10 2005/02/11 01:34:12 rocky Exp $
Copyright (C) 2004, 2005 Rocky Bernstein <rocky@panix.com> Copyright (C) 2004, 2005 Rocky Bernstein <rocky@panix.com>
@@ -90,6 +90,11 @@ get_drive_cap_mmc (const void *p_user_data,
p_read_cap, p_write_cap, p_misc_cap ); p_read_cap, p_write_cap, p_misc_cap );
} }
/*! Find out if media has changed since the last call. @param
p_user_data the environment of 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 int
get_media_changed_mmc (const void *p_user_data) get_media_changed_mmc (const void *p_user_data)
{ {
@@ -259,7 +264,8 @@ int
mmc_mode_sense( CdIo_t *p_cdio, /*out*/ void *p_buf, int i_size, mmc_mode_sense( CdIo_t *p_cdio, /*out*/ void *p_buf, int i_size,
int page) int page)
{ {
if ( cdio_have_atapi(p_cdio) ) { bool_3way_t e_status = cdio_have_atapi(p_cdio);
if ( yep == e_status ) {
if ( DRIVER_OP_SUCCESS == mmc_mode_sense_6(p_cdio, p_buf, i_size, page) ) if ( DRIVER_OP_SUCCESS == mmc_mode_sense_6(p_cdio, p_buf, i_size, page) )
return DRIVER_OP_SUCCESS; return DRIVER_OP_SUCCESS;
return mmc_mode_sense_10(p_cdio, p_buf, i_size, page); return mmc_mode_sense_10(p_cdio, p_buf, i_size, page);
@@ -668,7 +674,7 @@ int mmc_get_media_changed(const CdIo_t *p_cdio)
CDIO_MMC_SET_COMMAND(cdb.field, CDIO_MMC_GPCMD_GET_EVENT_STATUS); CDIO_MMC_SET_COMMAND(cdb.field, CDIO_MMC_GPCMD_GET_EVENT_STATUS);
cdb.field[1] = 1; /* We poll for info */ cdb.field[1] = 1; /* We poll for info */
cdb.field[4] = 1 << 4; /* Media */ cdb.field[4] = 1 << 4; /* We want Media events */
/* Setup to read header, to get length of data */ /* Setup to read header, to get length of data */
CDIO_MMC_SET_READ_LENGTH16(cdb.field, sizeof(buf)); CDIO_MMC_SET_READ_LENGTH16(cdb.field, sizeof(buf));
@@ -951,6 +957,8 @@ mmc_have_interface( CdIo_t *p_cdio, mmc_feature_interface_t e_interface )
uint8_t buf[500] = { 0, }; /* Place to hold returned data */ uint8_t buf[500] = { 0, }; /* Place to hold returned data */
scsi_mmc_cdb_t cdb = {{0, }}; /* Command Descriptor Buffer */ scsi_mmc_cdb_t cdb = {{0, }}; /* Command Descriptor Buffer */
if (!p_cdio || !p_cdio->op.run_mmc_cmd) return nope;
CDIO_MMC_SET_COMMAND(cdb.field, CDIO_MMC_GPCMD_GET_CONFIGURATION); CDIO_MMC_SET_COMMAND(cdb.field, CDIO_MMC_GPCMD_GET_CONFIGURATION);
CDIO_MMC_SET_READ_LENGTH8(cdb.field, sizeof(buf)); CDIO_MMC_SET_READ_LENGTH8(cdb.field, sizeof(buf));
cdb.field[1] = CDIO_MMC_GET_CONF_NAMED_FEATURE; cdb.field[1] = CDIO_MMC_GET_CONF_NAMED_FEATURE;

View File

@@ -1,9 +1,12 @@
#!/bin/sh #!/bin/sh
# $Id: check_paranoia.sh.in,v 1.6 2005/01/22 19:39:16 rocky Exp $ # $Id: check_paranoia.sh.in,v 1.7 2005/02/11 01:34:12 rocky Exp $
# Compare our cd-paranoia with an installed cdparanoia # Compare our cd-paranoia with an installed cdparanoia
if test "@CMP@" != no -a "@BUILD_CD_PARANOIA_TRUE@"X = X ; then if test "@CMP@" != no -a "@BUILD_CD_PARANOIA_TRUE@"X = X ; then
../src/cd-paranoia/cd-paranoia -d ./cdda.cue -v -r -- "1-" ../src/cd-paranoia/cd-paranoia -d ./cdda.cue -v -r -- "1-"
if test $? -ne 0 ; then
exit 6
fi
dd bs=16 skip=17 if=./cdda.raw of=./cdda-1.raw dd bs=16 skip=17 if=./cdda.raw of=./cdda-1.raw
dd bs=16 if=./cdda.bin of=cdda-2.raw count=44377 dd bs=16 if=./cdda.bin of=cdda-2.raw count=44377
if @CMP@ ./cdda-1.raw ./cdda-2.raw ; then if @CMP@ ./cdda-1.raw ./cdda-2.raw ; then
@@ -16,6 +19,9 @@ if test "@CMP@" != no -a "@BUILD_CD_PARANOIA_TRUE@"X = X ; then
../src/cd-paranoia/cd-paranoia -d ./cdda.cue -x 64 -v -r -- "1-" ../src/cd-paranoia/cd-paranoia -d ./cdda.cue -x 64 -v -r -- "1-"
mv cdda.raw cdda-underrun.raw mv cdda.raw cdda-underrun.raw
../src/cd-paranoia/cd-paranoia -d ./cdda.cue -r -- "1-" ../src/cd-paranoia/cd-paranoia -d ./cdda.cue -r -- "1-"
if test $? -ne 0 ; then
exit 6
fi
if @CMP@ ./cdda-underrun.raw ./cdda-good.raw ; then if @CMP@ ./cdda-underrun.raw ./cdda-good.raw ; then
echo "** Under-run correction okay" echo "** Under-run correction okay"
else else
@@ -24,6 +30,9 @@ if test "@CMP@" != no -a "@BUILD_CD_PARANOIA_TRUE@"X = X ; then
fi fi
# Start out with small jitter # Start out with small jitter
../src/cd-paranoia/cd-paranoia -d ./cdda.cue -x 5 -v -r -- "1-" ../src/cd-paranoia/cd-paranoia -d ./cdda.cue -x 5 -v -r -- "1-"
if test $? -ne 0 ; then
exit 6
fi
mv cdda.raw cdda-jitter.raw mv cdda.raw cdda-jitter.raw
if @CMP@ ./cdda-jitter.raw ./cdda-good.raw ; then if @CMP@ ./cdda-jitter.raw ./cdda-good.raw ; then
echo "** Small jitter correction okay" echo "** Small jitter correction okay"
@@ -33,6 +42,9 @@ if test "@CMP@" != no -a "@BUILD_CD_PARANOIA_TRUE@"X = X ; then
fi fi
# A more massive set of failures: underrun + medium jitter # A more massive set of failures: underrun + medium jitter
../src/cd-paranoia/cd-paranoia -d ./cdda.cue -x 70 -v -r -- "1-" ../src/cd-paranoia/cd-paranoia -d ./cdda.cue -x 70 -v -r -- "1-"
if test $? -ne 0 ; then
exit 6
fi
mv cdda.raw cdda-jitter.raw mv cdda.raw cdda-jitter.raw
if @CMP@ ./cdda-jitter.raw ./cdda-good.raw ; then if @CMP@ ./cdda-jitter.raw ./cdda-good.raw ; then
echo "** under-run + jitter correction okay" echo "** under-run + jitter correction okay"