From 22c187cd61495d5c7dda240746d30908be41c536 Mon Sep 17 00:00:00 2001 From: Thomas Schmitt Date: Mon, 24 Aug 2009 20:24:39 +0000 Subject: [PATCH] Implemented automatic START UNIT after STOP UNIT before any other SCSI command --- cdrskin/cdrskin_timestamp.h | 2 +- libburn/mmc.c | 5 +++++ libburn/sbc.c | 11 +++++++++-- libburn/transport.h | 4 ++++ 4 files changed, 19 insertions(+), 3 deletions(-) diff --git a/cdrskin/cdrskin_timestamp.h b/cdrskin/cdrskin_timestamp.h index a135d3f..9265305 100644 --- a/cdrskin/cdrskin_timestamp.h +++ b/cdrskin/cdrskin_timestamp.h @@ -1 +1 @@ -#define Cdrskin_timestamP "2009.08.24.161646" +#define Cdrskin_timestamP "2009.08.24.202517" diff --git a/libburn/mmc.c b/libburn/mmc.c index 0b031a2..8f54a66 100644 --- a/libburn/mmc.c +++ b/libburn/mmc.c @@ -236,6 +236,11 @@ int mmc_function_spy(struct burn_drive *d, char * text) d->cancel = 1; return 0; } + if (d->is_stopped && strcmp(text, "stop_unit") != 0 && + strcmp(text, "start_unit") != 0) { + d->start_unit(d); + d->is_stopped = 0; + } return 1; } diff --git a/libburn/sbc.c b/libburn/sbc.c index 3c7a31e..f64c358 100644 --- a/libburn/sbc.c +++ b/libburn/sbc.c @@ -80,6 +80,7 @@ void sbc_eject(struct burn_drive *d) int sbc_start_unit(struct burn_drive *d) { struct command c; + int ret; if (mmc_function_spy(d, "start_unit") <= 0) return 0; @@ -92,13 +93,16 @@ int sbc_start_unit(struct burn_drive *d) if (c.error) return 0; /* ts A70918 : now asynchronous */ - return spc_wait_unit_attention(d, 1800, "START UNIT", 0); + d->is_stopped = 0; + ret = spc_wait_unit_attention(d, 1800, "START UNIT", 0); + return ret; } /* ts A90824 : Trying to reduce drive noise */ int sbc_stop_unit(struct burn_drive *d) { struct command c; + int ret; if (mmc_function_spy(d, "stop_unit") <= 0) return 0; @@ -110,7 +114,9 @@ int sbc_stop_unit(struct burn_drive *d) d->issue_command(d, &c); if (c.error) return 0; - return spc_wait_unit_attention(d, 1800, "STOP UNIT", 0); + ret = spc_wait_unit_attention(d, 1800, "STOP UNIT", 0); + d->is_stopped = 1; + return ret; } @@ -123,6 +129,7 @@ int sbc_setup_drive(struct burn_drive *d) d->load = sbc_load; d->start_unit = sbc_start_unit; d->stop_unit = sbc_stop_unit; + d->is_stopped = 0; return 1; } diff --git a/libburn/transport.h b/libburn/transport.h index 2f31200..efb1d27 100644 --- a/libburn/transport.h +++ b/libburn/transport.h @@ -317,7 +317,11 @@ struct burn_drive void (*eject) (struct burn_drive *); void (*load) (struct burn_drive *); int (*start_unit) (struct burn_drive *); + + /* ts A90824 : Calming down noisy drives */ int (*stop_unit) (struct burn_drive *); + int is_stopped; + void (*read_disc_info) (struct burn_drive *); void (*read_sectors) (struct burn_drive *, int start,