Run a Multimedia command (MMC) specifying the CDB length.

The motivation here is for example ot use in is an undocumented
debug command for LG drives (namely E7), whose length is being
miscalculated by mmc_get_cmd_len(); it doesn't follow the usual
code number to length conventions. Patch supplied by SukkoPera.
This commit is contained in:
rocky
2007-11-21 03:01:58 +00:00
parent efab9a09c9
commit 8e48c0ad7f
3 changed files with 45 additions and 4 deletions

View File

@@ -1,7 +1,7 @@
/* /*
$Id: mmc.h,v 1.29 2006/10/27 10:38:41 rocky Exp $ $Id: mmc.h,v 1.30 2007/11/21 03:01:58 rocky Exp $
Copyright (C) 2003, 2004, 2005, 2006 Rocky Bernstein <rocky@cpan.org> Copyright (C) 2003, 2004, 2005, 2006, 2007 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
@@ -785,6 +785,31 @@ mmc_audio_read_subchannel (CdIo_t *p_cdio,
const mmc_cdb_t *p_cdb, const mmc_cdb_t *p_cdb,
cdio_mmc_direction_t e_direction, unsigned int i_buf, cdio_mmc_direction_t e_direction, unsigned int i_buf,
/*in/out*/ void *p_buf ); /*in/out*/ void *p_buf );
/**
Run a Multimedia command (MMC) specifying the CDB length.
The motivation here is for example ot use in is an undocumented
debug command for LG drives (namely E7), whose length is being
miscalculated by mmc_get_cmd_len(); it doesn't follow the usual
code number to length conventions. Patch supplied by SukkoPera.
@param p_cdio CD structure set by cdio_open().
@param i_timeout_ms time in milliseconds we will wait for the command
to complete.
@param p_cdb CDB bytes. All values that are needed should be set
on input.
@param i_cdb number of CDB bytes.
@param e_direction direction the transfer is to go.
@param i_buf Size of buffer
@param p_buf Buffer for data, both sending and receiving.
@return 0 if command completed successfully.
*/
int mmc_run_cmd_len( const CdIo_t *p_cdio, unsigned int i_timeout_ms,
const mmc_cdb_t *p_cdb, unsigned int i_cdb,
cdio_mmc_direction_t e_direction, unsigned int i_buf,
/*in/out*/ void *p_buf );
/** /**
Set the block size for subsequest read requests, via MMC. Set the block size for subsequest read requests, via MMC.
*/ */

View File

@@ -201,6 +201,7 @@ mmc_read_data_sectors
mmc_read_sectors mmc_read_sectors
mmc_read_timeout_ms mmc_read_timeout_ms
mmc_run_cmd mmc_run_cmd
mmc_run_cmd_len
mmc_set_blocksize mmc_set_blocksize
mmc_set_speed mmc_set_speed
mmc_start_stop_media mmc_start_stop_media

View File

@@ -1,8 +1,8 @@
/* Common Multimedia Command (MMC) routines. /* Common Multimedia Command (MMC) routines.
$Id: mmc.c,v 1.35 2006/10/11 12:38:18 rocky Exp $ $Id: mmc.c,v 1.36 2007/11/21 03:01:58 rocky Exp $
Copyright (C) 2004, 2005, 2006 Rocky Bernstein <rocky@cpan.org> Copyright (C) 2004, 2005, 2006, 2007 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
@@ -950,6 +950,21 @@ mmc_run_cmd( const CdIo_t *p_cdio, unsigned int i_timeout_ms,
p_cdb, e_direction, i_buf, p_buf); p_cdb, e_direction, i_buf, p_buf);
} }
/* Added by SukkoPera to allow CDB length to be specified manually */
driver_return_code_t
mmc_run_cmd_len( const CdIo_t *p_cdio, unsigned int i_timeout_ms,
const mmc_cdb_t *p_cdb, unsigned int i_cdb,
cdio_mmc_direction_t e_direction, unsigned int i_buf,
/*in/out*/ void *p_buf )
{
if (!p_cdio) return DRIVER_OP_UNINIT;
if (!p_cdio->op.run_mmc_cmd) return DRIVER_OP_UNSUPPORTED;
return p_cdio->op.run_mmc_cmd(p_cdio->env, i_timeout_ms,
i_cdb,
p_cdb, e_direction, i_buf, p_buf);
}
/*! Return the byte size returned on a MMC READ command (e.g. READ_10, /*! Return the byte size returned on a MMC READ command (e.g. READ_10,
READ_MSF, ..) READ_MSF, ..)
*/ */