Merge branch 'master' of rocky@git.sv.gnu.org:/srv/git/libcdio

This commit is contained in:
R. Bernstein
2009-12-25 19:47:22 -05:00
2 changed files with 159 additions and 151 deletions

View File

@@ -1,7 +1,5 @@
/* /*
$Id: aspi32.c,v 1.11 2008/04/21 18:30:21 karl Exp $ Copyright (C) 2004, 2005, 2008, 2009 Rocky Bernstein <rocky@gnu.org>
Copyright (C) 2004, 2005, 2008 Rocky Bernstein <rocky@gnu.org>
This program is free software: you can redistribute it and/or modify This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by it under the terms of the GNU General Public License as published by
@@ -491,9 +489,10 @@ run_mmc_cmd_aspi( void *p_user_data, unsigned int i_timeout_ms,
cdio_mmc_direction_t e_direction, cdio_mmc_direction_t e_direction,
unsigned int i_buf, /*in/out*/ void *p_buf ) unsigned int i_buf, /*in/out*/ void *p_buf )
{ {
const _img_private_t *p_env = p_user_data; _img_private_t *p_env = p_user_data;
HANDLE hEvent; HANDLE hEvent;
struct SRB_ExecSCSICmd ssc; struct SRB_ExecSCSICmd ssc;
int sense_size;
/* Create the transfer completion event */ /* Create the transfer completion event */
hEvent = CreateEvent( NULL, TRUE, FALSE, NULL ); hEvent = CreateEvent( NULL, TRUE, FALSE, NULL );
@@ -502,6 +501,7 @@ run_mmc_cmd_aspi( void *p_user_data, unsigned int i_timeout_ms,
return 1; return 1;
} }
p_env->gen.scsi_mmc_sense_valid = 0;
memset( &ssc, 0, sizeof( ssc ) ); memset( &ssc, 0, sizeof( ssc ) );
ssc.SRB_Cmd = SC_EXEC_SCSI_CMD; ssc.SRB_Cmd = SC_EXEC_SCSI_CMD;
@@ -536,10 +536,18 @@ run_mmc_cmd_aspi( void *p_user_data, unsigned int i_timeout_ms,
/* check that the transfer went as planned */ /* check that the transfer went as planned */
if( ssc.SRB_Status != SS_COMP ) { if( ssc.SRB_Status != SS_COMP ) {
cdio_info("ASPI: %s", aspierror(ssc.SRB_Status)); cdio_info("ASPI: %s", aspierror(ssc.SRB_Status));
return 2; return DRIVER_OP_ERROR;
} else {
sense_size = ssc.SenseArea[7] + 8; /* SPC 4.5.3, Table 26:
252 bytes legal,
263 bytes possible */
if (sense_size > SENSE_LEN)
sense_size = SENSE_LEN;
memcpy((void *) p_env->gen.scsi_mmc_sense, ssc.SenseArea, sense_size);
p_env->gen.scsi_mmc_sense_valid = sense_size;
} }
return 0; return DRIVER_OP_SUCCESS;
} }

View File

@@ -1262,8 +1262,8 @@ run_mmc_cmd_linux(void *p_user_data,
/* Record SCSI sense reply for API call mmc_last_cmd_sense(). /* Record SCSI sense reply for API call mmc_last_cmd_sense().
*/ */
if (u_sense[7]) { if (u_sense[7]) {
sense_size = u_sense[7] + 8; /* SPC 4.5.3, Table 26 : sense_size = u_sense[7] + 8; /* SPC 4.5.3, Table 26:
252 bytes legal , 263 bytes possible */ 252 bytes legal, 263 bytes possible */
if (sense_size > sizeof(sense)) if (sense_size > sizeof(sense))
sense_size = sizeof(sense); sense_size = sizeof(sense);
memcpy((void *) p_env->gen.scsi_mmc_sense, &sense, sense_size); memcpy((void *) p_env->gen.scsi_mmc_sense, &sense, sense_size);