Fix all fo the bugs I introduced "improving" the code of others.
mmc_ll_cmds.c: mmc_mode_select and mmc_get_configuration now work. mmc_hl_cmds.c: bug introduced by turning a var into a pointer to that variable.
This commit is contained in:
@@ -33,7 +33,6 @@
|
|||||||
if ( ! p_cdio ) return DRIVER_OP_UNINIT; \
|
if ( ! p_cdio ) return DRIVER_OP_UNINIT; \
|
||||||
if ( ! p_cdio->op.run_mmc_cmd ) return DRIVER_OP_UNSUPPORTED; \
|
if ( ! p_cdio->op.run_mmc_cmd ) return DRIVER_OP_UNSUPPORTED; \
|
||||||
\
|
\
|
||||||
memset (p_buf, 0, i_size); \
|
|
||||||
CDIO_MMC_SET_COMMAND(cdb.field, mmc_cmd)
|
CDIO_MMC_SET_COMMAND(cdb.field, mmc_cmd)
|
||||||
|
|
||||||
/* Boilerplate initialization code to setup running MMC read command
|
/* Boilerplate initialization code to setup running MMC read command
|
||||||
|
|||||||
@@ -83,7 +83,7 @@ mmc_get_disctype( const CdIo_t *p_cdio, unsigned int i_timeout_ms,
|
|||||||
q = p+4;
|
q = p+4;
|
||||||
*p_disctype = CDIO_MMC_DISCTYPE_NO_DISC;
|
*p_disctype = CDIO_MMC_DISCTYPE_NO_DISC;
|
||||||
|
|
||||||
while ((p_disctype == CDIO_MMC_DISCTYPE_NO_DISC) &&
|
while ((CDIO_MMC_DISCTYPE_NO_DISC == *p_disctype) &&
|
||||||
(q < p + profiles_list_length)) {
|
(q < p + profiles_list_length)) {
|
||||||
profile_number = CDIO_MMC_GET_LEN16(q);
|
profile_number = CDIO_MMC_GET_LEN16(q);
|
||||||
profile_active = q[2] & 0x01;
|
profile_active = q[2] & 0x01;
|
||||||
|
|||||||
@@ -74,9 +74,9 @@ mmc_get_configuration(const CdIo_t *p_cdio, void *p_buf,
|
|||||||
|
|
||||||
{
|
{
|
||||||
MMC_CMD_SETUP(CDIO_MMC_GPCMD_GET_CONFIGURATION);
|
MMC_CMD_SETUP(CDIO_MMC_GPCMD_GET_CONFIGURATION);
|
||||||
|
CDIO_MMC_SET_READ_LENGTH8(cdb.field, i_size);
|
||||||
if (0 == i_timeout_ms) i_timeout_ms = mmc_timeout_ms;
|
if (0 == i_timeout_ms) i_timeout_ms = mmc_timeout_ms;
|
||||||
cdb.field[1] = return_type & 0x3;
|
cdb.field[1] = return_type & 0x3;
|
||||||
|
|
||||||
CDIO_MMC_SET_LEN16(cdb.field, 2, i_starting_feature_number);
|
CDIO_MMC_SET_LEN16(cdb.field, 2, i_starting_feature_number);
|
||||||
return MMC_RUN_CMD(SCSI_MMC_DATA_READ, i_timeout_ms);
|
return MMC_RUN_CMD(SCSI_MMC_DATA_READ, i_timeout_ms);
|
||||||
}
|
}
|
||||||
@@ -289,7 +289,6 @@ mmc_read_cd(const CdIo_t *p_cdio, void *p_buf1, lsn_t i_lsn,
|
|||||||
{
|
{
|
||||||
void *p_buf = p_buf1;
|
void *p_buf = p_buf1;
|
||||||
uint8_t cdb9 = 0;
|
uint8_t cdb9 = 0;
|
||||||
const unsigned int i_size = i_blocksize * i_blocks;
|
|
||||||
const unsigned int i_timeout = mmc_timeout_ms * (MAX_CD_READ_BLOCKS/2);
|
const unsigned int i_timeout = mmc_timeout_ms * (MAX_CD_READ_BLOCKS/2);
|
||||||
|
|
||||||
MMC_CMD_SETUP(CDIO_MMC_GPCMD_READ_CD);
|
MMC_CMD_SETUP(CDIO_MMC_GPCMD_READ_CD);
|
||||||
|
|||||||
@@ -272,9 +272,6 @@ test_mode_select(CdIo_t *p_cdio,
|
|||||||
unsigned char *p_buf, unsigned int i_size, unsigned int i_flag)
|
unsigned char *p_buf, unsigned int i_size, unsigned int i_flag)
|
||||||
{
|
{
|
||||||
int i_status, i;
|
int i_status, i;
|
||||||
#ifndef MODE_SELECT_FIXED
|
|
||||||
mmc_cdb_t cdb = {{0, }};
|
|
||||||
#endif
|
|
||||||
|
|
||||||
if (i_size < 10)
|
if (i_size < 10)
|
||||||
return DRIVER_OP_BAD_PARAMETER;
|
return DRIVER_OP_BAD_PARAMETER;
|
||||||
@@ -293,15 +290,7 @@ test_mode_select(CdIo_t *p_cdio,
|
|||||||
if (i_flag & 1)
|
if (i_flag & 1)
|
||||||
fprintf(stderr, "test_mode_select(0x%X, %d, %d) ... ",
|
fprintf(stderr, "test_mode_select(0x%X, %d, %d) ... ",
|
||||||
(unsigned int) p_buf[8], (unsigned int) p_buf[9], i_size);
|
(unsigned int) p_buf[8], (unsigned int) p_buf[9], i_size);
|
||||||
#ifdef MODE_SELECT_FIXED
|
|
||||||
i_status = mmc_mode_select_10(p_cdio, p_buf, i_size, 0x10, 10000);
|
i_status = mmc_mode_select_10(p_cdio, p_buf, i_size, 0x10, 10000);
|
||||||
#else
|
|
||||||
CDIO_MMC_SET_COMMAND(cdb.field, CDIO_MMC_GPCMD_MODE_SELECT_10); /* SPC-3 6.8 */
|
|
||||||
cdb.field[1] = 0x10; /* PF = 1 : official SCSI mode page */
|
|
||||||
CDIO_MMC_SET_READ_LENGTH16(cdb.field, i_size);
|
|
||||||
i_status = mmc_run_cmd(p_cdio, 10000, &cdb, SCSI_MMC_DATA_WRITE,
|
|
||||||
i_size, p_buf);
|
|
||||||
#endif
|
|
||||||
return test_handle_outcome(p_cdio, i_status, sense_avail, sense_reply,
|
return test_handle_outcome(p_cdio, i_status, sense_avail, sense_reply,
|
||||||
i_flag & 1);
|
i_flag & 1);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user