diff --git a/include/cdio/mmc.h b/include/cdio/mmc.h index 767596cc..69efa280 100644 --- a/include/cdio/mmc.h +++ b/include/cdio/mmc.h @@ -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 + Copyright (C) 2003, 2004, 2005, 2006, 2007 Rocky Bernstein 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 @@ -785,6 +785,31 @@ mmc_audio_read_subchannel (CdIo_t *p_cdio, const mmc_cdb_t *p_cdb, cdio_mmc_direction_t e_direction, unsigned int i_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. */ diff --git a/lib/driver/libcdio.sym b/lib/driver/libcdio.sym index 2c118e35..43fbdcb5 100644 --- a/lib/driver/libcdio.sym +++ b/lib/driver/libcdio.sym @@ -201,6 +201,7 @@ mmc_read_data_sectors mmc_read_sectors mmc_read_timeout_ms mmc_run_cmd +mmc_run_cmd_len mmc_set_blocksize mmc_set_speed mmc_start_stop_media diff --git a/lib/driver/mmc.c b/lib/driver/mmc.c index 2e6a1d4c..a0658962 100644 --- a/lib/driver/mmc.c +++ b/lib/driver/mmc.c @@ -1,8 +1,8 @@ /* 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 + Copyright (C) 2004, 2005, 2006, 2007 Rocky Bernstein 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 @@ -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); } +/* 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, READ_MSF, ..) */