From 90cafb8935ac4fd997f486d72a80840739bfd223 Mon Sep 17 00:00:00 2001 From: Peter Kirchgessner Date: Sun, 4 Feb 2001 17:36:26 +0000 Subject: [PATCH] Switch off lamp after scan --- backend/hp-handle.c | 30 +++++++++++++++++------------- backend/hp-scl.h | 1 + backend/hp.c | 5 ++++- 3 files changed, 22 insertions(+), 14 deletions(-) diff --git a/backend/hp-handle.c b/backend/hp-handle.c index a59677971..eb4825fcd 100644 --- a/backend/hp-handle.c +++ b/backend/hp-handle.c @@ -155,16 +155,19 @@ hp_handle_stopScan (HpHandle this) close(this->pipefd); this->reader_pid = 0; - if (WIFSIGNALED(info) - && !FAILED( sanei_hp_scsi_new(&scsi, this->dev->sanedev.name) )) + if ( !FAILED( sanei_hp_scsi_new(&scsi, this->dev->sanedev.name)) ) + { + if (WIFSIGNALED(info)) { /* sanei_hp_scl_set(scsi, SCL_CLEAR_ERRORS, 0); sanei_hp_scl_errcheck(scsi); */ sanei_hp_scl_reset(scsi); - sanei_hp_scsi_destroy(scsi,0); - } + } + sanei_hp_scl_set(scsi, SCL_LAMPTEST, 0); /* Switch off lamp */ + sanei_hp_scsi_destroy(scsi,0); + } } else { @@ -554,20 +557,21 @@ sanei_hp_handle_read (HpHandle this, void * buf, size_t *lengthp) status = this->bytes_left ? SANE_STATUS_IO_ERROR : SANE_STATUS_EOF; RETURN_IF_FAIL( hp_handle_stopScan(this) ); - /* Check unload after scan */ + /* Switch off lamp and check unload after scan */ if (status == SANE_STATUS_EOF) { const HpDeviceInfo *hpinfo; - hpinfo = sanei_hp_device_info_get ( this->dev->sanedev.name ); - if ( hpinfo && hpinfo->unload_after_scan ) + HpScsi scsi; + + if ( sanei_hp_scsi_new(&scsi, this->dev->sanedev.name) == SANE_STATUS_GOOD ) { - HpScsi scsi; - if ( sanei_hp_scsi_new(&scsi, this->dev->sanedev.name) - == SANE_STATUS_GOOD ) - { + sanei_hp_scl_set(scsi, SCL_LAMPTEST, 0); + + hpinfo = sanei_hp_device_info_get ( this->dev->sanedev.name ); + if ( hpinfo && hpinfo->unload_after_scan ) sanei_hp_scl_set(scsi, SCL_UNLOAD, 0); - sanei_hp_scsi_destroy(scsi,0); - } + + sanei_hp_scsi_destroy(scsi,0); } } return status; diff --git a/backend/hp-scl.h b/backend/hp-scl.h index 8c430368e..d11d3e49f 100644 --- a/backend/hp-scl.h +++ b/backend/hp-scl.h @@ -80,6 +80,7 @@ #define SCL_PRELOAD_ADF HP_SCL_CONTROL(10468, 'f', 'C') #define SCL_MEDIA HP_SCL_CONTROL(10469, 'f', 'D') #define SCL_10470 HP_SCL_CONTROL(10470, 'f', 'E') +#define SCL_LAMPTEST HP_SCL_CONTROL(10477, 'f', 'L') #define SCL_X_EXTENT HP_SCL_CONTROL(10481, 'f', 'P') #define SCL_Y_EXTENT HP_SCL_CONTROL(10482, 'f', 'Q') #define SCL_START_SCAN HP_SCL_COMMAND('f', 'S') diff --git a/backend/hp.c b/backend/hp.c index 515a641e3..064c0f2cf 100644 --- a/backend/hp.c +++ b/backend/hp.c @@ -43,9 +43,12 @@ HP Scanner Control Language (SCL). */ -static char *hp_backend_version = "0.93"; +static char *hp_backend_version = "0.94"; /* Changes: + V 0.94, 31-Dec-2000, PK (peter@kirchgessner.net) + - always switch off lamp after scan + V 0.93, 04-Dec-2000, PK (peter@kirchgessner.net) - fix problem with ADF-support on ScanJet 6350 (and maybe others)