From 9160b1dcbb587a4fc852307aedde564e7f52a308 Mon Sep 17 00:00:00 2001 From: Thomas Schmitt Date: Thu, 12 Nov 2009 17:56:18 +0000 Subject: [PATCH] Workaround for Pioneer DVR-216D refusal to eject --- cdrskin/cdrskin_timestamp.h | 2 +- libburn/mmc.c | 6 +++++ libburn/sbc.c | 45 +++++++++++++++++++++++-------------- libburn/spc.c | 11 --------- 4 files changed, 35 insertions(+), 29 deletions(-) diff --git a/cdrskin/cdrskin_timestamp.h b/cdrskin/cdrskin_timestamp.h index 5211c5a..f3aaf37 100644 --- a/cdrskin/cdrskin_timestamp.h +++ b/cdrskin/cdrskin_timestamp.h @@ -1 +1 @@ -#define Cdrskin_timestamP "2009.11.12.175514" +#define Cdrskin_timestamP "2009.11.12.175735" diff --git a/libburn/mmc.c b/libburn/mmc.c index 4c7f702..d715be4 100644 --- a/libburn/mmc.c +++ b/libburn/mmc.c @@ -245,8 +245,14 @@ int mmc_function_spy(struct burn_drive *d, char * text) d->cancel = 1; return 0; } + + /* >>> should one rather have a positve list ? */ + if (d->is_stopped && strcmp(text, "stop_unit") != 0 && + strcmp(text, "eject") != 0 && strcmp(text, "start_unit") != 0 && + strcmp(text, "load") != 0 && + strncmp(text, "enumerate", 9) != 0 && strncmp(text, "sg_", 3) != 0) { d->start_unit(d); d->is_stopped = 0; diff --git a/libburn/sbc.c b/libburn/sbc.c index 3e005dd..08c0350 100644 --- a/libburn/sbc.c +++ b/libburn/sbc.c @@ -31,11 +31,6 @@ void sbc_load(struct burn_drive *d) return; scsi_init_command(&c, SBC_LOAD, sizeof(SBC_LOAD)); -/* - memcpy(c.opcode, SBC_LOAD, sizeof(SBC_LOAD)); - c.oplen = sizeof(SBC_LOAD); - c.page = NULL; -*/ c.retry = 1; /* ts A70921 : Had to revoke Immed because of LG GSA-4082B */ @@ -59,14 +54,7 @@ void sbc_eject(struct burn_drive *d) return; scsi_init_command(&c, SBC_UNLOAD, sizeof(SBC_UNLOAD)); -/* - memcpy(c.opcode, SBC_UNLOAD, sizeof(SBC_UNLOAD)); - c.oplen = sizeof(SBC_UNLOAD); - c.page = NULL; -*/ - c.opcode[1] |= 1; /* ts A70918 : Immed */ - c.page = NULL; c.dir = NO_TRANSFER; d->issue_command(d, &c); @@ -76,8 +64,11 @@ void sbc_eject(struct burn_drive *d) spc_wait_unit_attention(d, 1800, "STOP UNIT (+ EJECT)", 0); } -/* ts A61118 : is it necessary to tell the drive to get ready for use ? */ -int sbc_start_unit(struct burn_drive *d) + +/* ts A91112 : Now with flag */ +/* @param flag bit0= asynchronous waiting +*/ +int sbc_start_unit_flag(struct burn_drive *d, int flag) { struct command c; int ret; @@ -87,17 +78,37 @@ int sbc_start_unit(struct burn_drive *d) scsi_init_command(&c, SBC_START_UNIT, sizeof(SBC_START_UNIT)); c.retry = 1; - c.opcode[1] |= 1; /* ts A70918 : Immed */ + c.opcode[1] |= (flag & 1); /* ts A70918 : Immed */ c.dir = NO_TRANSFER; d->issue_command(d, &c); if (c.error) return 0; - /* ts A70918 : now asynchronous */ - d->is_stopped = 0; + if (!(flag & 1)) + return 1; + /* ts A70918 : asynchronous */ ret = spc_wait_unit_attention(d, 1800, "START UNIT", 0); return ret; } + +int sbc_start_unit(struct burn_drive *d) +{ + int ret; + + d->is_stopped = 0; /* no endless starting attempts */ + + /* Asynchronous, not to block controller by waiting */ + ret = sbc_start_unit_flag(d, 1); + if (ret <= 0) + return ret; + /* Synchronous to catch Pioneer DVD-216D which is ready too early. + A pending START UNIT can prevent ejecting of the tray. + */ + ret = sbc_start_unit_flag(d, 0); + return ret; +} + + /* ts A90824 : Trying to reduce drive noise */ int sbc_stop_unit(struct burn_drive *d) { diff --git a/libburn/spc.c b/libburn/spc.c index ec8e1ba..b3543bb 100644 --- a/libburn/spc.c +++ b/libburn/spc.c @@ -761,14 +761,6 @@ void spc_probe_write_modes(struct burn_drive *d) c.page->data[23] = 150; c.dir = TO_DRIVE; -#ifdef Libburn_pioneer_dvr_216d_no_probe_wM - - key = asc = ascq = 0; - if (last_try) - break; - -#else /* Libburn_pioneer_dvr_216d_no_probe_wM */ - d->silent_on_scsi_error = 1; d->issue_command(d, &c); d->silent_on_scsi_error = 0; @@ -779,9 +771,6 @@ void spc_probe_write_modes(struct burn_drive *d) key = c.sense[2]; asc = c.sense[12]; ascq = c.sense[13]; - -#endif /* ! Libburn_pioneer_dvr_216d_no_probe_wM */ - if (key) burn_print(7, "%d not supported\n", try_block_type); else {