[PATCH] Add tweaks to get linux dvdrecord happy
Ronnie Sahlberg
ronniesahlberg
Tue May 6 08:32:05 CEST 2008
Add a new modepage (write performance) and a few commands to keep
linux dvdrecord happy.
Document an example on how to use MMC emulation with linux dvdrecord
Signed-off-by: Ronnie Sahlberg <ronniesahlberg at gmail.com>
---
doc/README.mmc | 7 +++++++
usr/mmc.c | 54 +++++++++++++++++++++++++++++++++++++++++++++++-------
2 files changed, 54 insertions(+), 7 deletions(-)
diff --git a/doc/README.mmc b/doc/README.mmc
index 265b95a..6f7074d 100644
--- a/doc/README.mmc
+++ b/doc/README.mmc
@@ -37,6 +37,13 @@ operations in which case it may or may not work.
It is the intent that the emulation will be enhanced to provide compatibility
with all DVD burning applications on all important platforms.
+The emulation is also compatible with Linux:dvdrecorder but you must
+specify the command arguments -dao -ignsize -overburn
+
+Example:
+dvdrecord -dao -ignsize -overburn dev=/dev/sg3 ./IMAGE.iso
+
+
Please report incompatibilities with other burning applications other than
Windows/DVD-Decrypter to ronniesahlberg at gmail.com and I will try to
enhance the emulation to also support your application of choice.
diff --git a/usr/mmc.c b/usr/mmc.c
index 1ab31c3..074b9be 100644
--- a/usr/mmc.c
+++ b/usr/mmc.c
@@ -54,6 +54,7 @@
struct mmc_info {
int current_profile;
+ uint64_t reserve_track_len;
};
static int mmc_rw(int host_no, struct scsi_cmd *cmd)
@@ -61,6 +62,7 @@ static int mmc_rw(int host_no, struct scsi_cmd *cmd)
struct mmc_info *mmc = (struct mmc_info *)cmd->dev->mmc_p;
int ret;
uint64_t end_offset;
+ uint64_t offset, length;
if (mmc->current_profile == PROFILE_NO_PROFILE) {
scsi_set_in_resid_by_actual(cmd, 0);
@@ -97,11 +99,13 @@ static int mmc_rw(int host_no, struct scsi_cmd *cmd)
cmd->scsi_cmd_done = target_cmd_io_done;
- cmd->offset = (scsi_rw_offset(cmd->scb) << MMC_BLK_SHIFT);
+ offset = scsi_rw_offset(cmd->scb);
+ cmd->offset = (offset << MMC_BLK_SHIFT);
/* update the size of the device */
- end_offset = cmd->offset +
- (((uint64_t)scsi_rw_count(cmd->scb)) << MMC_BLK_SHIFT);
+ length = scsi_rw_count(cmd->scb);
+ end_offset = cmd->offset + (length << MMC_BLK_SHIFT);
+
if (end_offset > cmd->dev->size)
cmd->dev->size = end_offset;
@@ -116,6 +120,12 @@ static int mmc_rw(int host_no, struct scsi_cmd *cmd)
sense_data_build(cmd, ILLEGAL_REQUEST, ASC_LUN_NOT_SUPPORTED);
return SAM_STAT_CHECK_CONDITION;
} else {
+ if ((mmc->current_profile == PROFILE_DVD_PLUS_R) &&
+ (mmc->reserve_track_len == (offset + length))) {
+ /* once we close the track it becomes a DVD_ROM */
+ mmc->current_profile = PROFILE_DVD_ROM;
+ }
+
set_cmd_mmapio(cmd);
return SAM_STAT_GOOD;
}
@@ -2146,6 +2156,31 @@ static int mmc_read_dvd_structure(int host_no,
struct scsi_cmd *cmd)
return SAM_STAT_CHECK_CONDITION;
}
+static int mmc_reserve_track(int host_no, struct scsi_cmd *cmd)
+{
+ struct mmc_info *mmc = (struct mmc_info *)cmd->dev->mmc_p;
+ uint64_t tmp;
+
+ tmp = cmd->scb[5];
+ tmp = (tmp << 8) | cmd->scb[6];
+ tmp = (tmp << 8) | cmd->scb[7];
+ tmp = (tmp << 8) | cmd->scb[8];
+
+ mmc->reserve_track_len = tmp;
+
+ return SAM_STAT_GOOD;
+}
+
+static int mmc_mode_select(int host_no, struct scsi_cmd *cmd)
+{
+ return SAM_STAT_GOOD;
+}
+
+static int mmc_set_cd_speed(int host_no, struct scsi_cmd *cmd)
+{
+ return SAM_STAT_GOOD;
+}
+
static int mmc_mode_sense(int host_no, struct scsi_cmd *cmd)
{
uint8_t *scb = cmd->scb;
@@ -2222,7 +2257,11 @@ static int mmc_lu_init(struct scsi_lu *lu)
"0x83:0x00:0x00:0x02:0xc2:0x00:0x00:0x00:"
"0x00:0x00:0x00:0x00:0x00:0x00:0x00:0x00:"
"0x00");
-
+ /* Write parameters */
+ add_mode_page(lu, "0x05:0:0x32:0x62:5:8:0x10:0:0:0:0:0:0:0:"
+ "0x10:0:0x96:0:0:0:0:0:0:0:0:0:0:0:0:0:0:"
+ "0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:"
+ "0:0");
return 0;
}
@@ -2232,6 +2271,7 @@ static int mmc_lu_online(struct scsi_lu *lu)
struct stat st;
mmc->current_profile = PROFILE_NO_PROFILE;
+ mmc->reserve_track_len = 0;
if (lu->fd == -1)
return TGTADM_INVALID_REQUEST;
@@ -2363,9 +2403,9 @@ static struct device_type_template mmc_template = {
{spc_illegal_op,},
{mmc_read_disc_information,},
{mmc_read_track_information,},
+ {mmc_reserve_track,},
{spc_illegal_op,},
- {spc_illegal_op,},
- {spc_illegal_op,},
+ {mmc_mode_select,},
{spc_illegal_op,},
{spc_illegal_op,},
@@ -2412,7 +2452,7 @@ static struct device_type_template mmc_template = {
{spc_illegal_op,},
{spc_illegal_op,},
{spc_illegal_op,},
- {spc_illegal_op,},
+ {mmc_set_cd_speed,},
{spc_illegal_op,},
{spc_illegal_op,},
{spc_illegal_op,},
--
1.5.5
------=_Part_11120_29418391.1210056494449
Content-Type: application/x-gzip;
name=0003-Add-tweaks-to-get-linux-dvdrecord-happy.patch.gz
Content-Transfer-Encoding: base64
X-Attachment-Id: f_ffw48c7q0
Content-Disposition: attachment;
filename=0003-Add-tweaks-to-get-linux-dvdrecord-happy.patch.gz
H4sICCD9H0gAAzAwMDMtQWRkLXR3ZWFrcy10by1nZXQtbGludXgtZHZkcmVjb3JkLWhhcHB5LnBh
dGNoAK1XW3PaVhB+Rr9ixw8dMAgkQDLGsSfUkIQpvtSQ9qGT0ehyBGokHY0uxjT1f+/ukQCBIXba
yh4hrfa+3+4550PMA3BdzbJdhXXNjmvbPcZ0zdU7Vs/qWq5ruVrPPbf0jubADQ9hyiJQz0BR+uIf
2oqiSh9QTR8eeBh6DKbmwrdYPId3sSAkxfv7eWB6ftPmwZU0NFPWh1nGGqDDjbkiNT1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Qm/wXDHlQexz1DUcp8rXoS4vyD1DX
qkuD57jiI9Q8hV01b9WutrtT/59S+Fbq98MsD8AfjvOwPRkktak1NUn6Bwyua4zhEgAA
------=_Part_11120_29418391.1210056494449--
More information about the stgt
mailing list