diff --git a/backend/genesys.c b/backend/genesys.c index f01bb6bb6..2d80bf025 100644 --- a/backend/genesys.c +++ b/backend/genesys.c @@ -4686,7 +4686,7 @@ genesys_start_scan (Genesys_Device * dev) return status; } - status = dev->model->cmd_set->slow_back_home (dev, 1); + status = dev->model->cmd_set->slow_back_home (dev, SANE_TRUE); if (status != SANE_STATUS_GOOD) { DBG (DBG_error, @@ -4701,7 +4701,7 @@ genesys_start_scan (Genesys_Device * dev) /* Go home */ /* TODO: check we can drop this since we cannot have the scanner's head wandering here */ - status = dev->model->cmd_set->slow_back_home (dev, 1); + status = dev->model->cmd_set->slow_back_home (dev, SANE_TRUE); if (status != SANE_STATUS_GOOD) { DBG (DBG_error, @@ -6973,6 +6973,15 @@ genesys_buffer_image(Genesys_Scanner *s) } } + /* since digital processing is going to take place, + * issue head parking command so that the head move while + * computing so we can save time + */ + if (dev->model->is_sheetfed == SANE_FALSE) + { + dev->model->cmd_set->slow_back_home (dev, dev->model->flags & GENESYS_FLAG_MUST_WAIT); + } + /* update counters */ dev->total_bytes_to_read = total; dev->total_bytes_read = 0; @@ -7260,11 +7269,16 @@ sane_close (SANE_Handle handle) return; /* oops, not a handle we know about */ } - /* eject document for shhetfed scanners */ + /* eject document for sheetfed scanners */ if (s->dev->model->is_sheetfed == SANE_TRUE) { s->dev->model->cmd_set->eject_document (s->dev); } + else + { + /* for flatbed scanners, get sure the head is parked before leaving */ + s->dev->model->cmd_set->slow_back_home (s->dev, SANE_TRUE); + } /* here is the place to store calibration cache */ write_calibration (s->dev); @@ -8029,7 +8043,7 @@ sane_cancel (SANE_Handle handle) /* park head if flatbed scanner */ if (s->dev->model->is_sheetfed == SANE_FALSE) { - status = s->dev->model->cmd_set->slow_back_home (s->dev, 1); + status = s->dev->model->cmd_set->slow_back_home (s->dev, s->dev->model->flags & GENESYS_FLAG_MUST_WAIT); if (status != SANE_STATUS_GOOD) { DBG (DBG_error, diff --git a/backend/genesys_low.h b/backend/genesys_low.h index feab4c619..776cb24e3 100644 --- a/backend/genesys_low.h +++ b/backend/genesys_low.h @@ -74,42 +74,38 @@ /* Flags */ -#define GENESYS_FLAG_UNTESTED (1 << 0) /* Print a warning for these scanners */ -#define GENESYS_FLAG_14BIT_GAMMA (1 << 1) /* use 14bit Gamma table instead of 12 */ -#define GENESYS_FLAG_LAZY_INIT (1 << 2) /* skip extensive ASIC test at init */ +#define GENESYS_FLAG_UNTESTED (1 << 0) /**> Print a warning for these scanners */ +#define GENESYS_FLAG_14BIT_GAMMA (1 << 1) /**> use 14bit Gamma table instead of 12 */ +#define GENESYS_FLAG_LAZY_INIT (1 << 2) /**> skip extensive ASIC test at init */ #define GENESYS_FLAG_XPA (1 << 3) -#define GENESYS_FLAG_SKIP_WARMUP (1 << 4) /* skip genesys_warmup() */ -#define GENESYS_FLAG_OFFSET_CALIBRATION (1 << 5) /* do offset calibration */ -#define GENESYS_FLAG_SEARCH_START (1 << 6) /* do start search beofre scanning */ -#define GENESYS_FLAG_REPARK (1 << 7) /* repark head (and check for lock) by +#define GENESYS_FLAG_SKIP_WARMUP (1 << 4) /**> skip genesys_warmup() */ +#define GENESYS_FLAG_OFFSET_CALIBRATION (1 << 5) /**> do offset calibration */ +#define GENESYS_FLAG_SEARCH_START (1 << 6) /**> do start search before scanning */ +#define GENESYS_FLAG_REPARK (1 << 7) /**> repark head (and check for lock) by moving without scanning */ -#define GENESYS_FLAG_DARK_CALIBRATION (1 << 8) /* do dark calibration */ -#define GENESYS_FLAG_STAGGERED_LINE (1 << 9) /* pixel columns are shifted vertically for hi-res modes */ +#define GENESYS_FLAG_DARK_CALIBRATION (1 << 8) /**> do dark calibration */ +#define GENESYS_FLAG_STAGGERED_LINE (1 << 9) /**> pixel columns are shifted vertically for hi-res modes */ -#define GENESYS_FLAG_MUST_WAIT (1 << 10) /* tells wether the scanner - should wait 1 minute after - init before doing anything - */ +#define GENESYS_FLAG_MUST_WAIT (1 << 10) /**> tells wether the scanner must wait for the head when parking */ -#define GENESYS_FLAG_ALT_SLOPE_CREATE (1 << 11) /* use alternative slope - creation function */ +#define GENESYS_FLAG_ALT_SLOPE_CREATE (1 << 11) /**> use alternative slope creation function */ -#define GENESYS_FLAG_DARK_WHITE_CALIBRATION (1 << 12) /* yet another calibration method. does white and dark shading in one run, depending on a black and a white strip*/ -#define GENESYS_FLAG_CUSTOM_GAMMA (1 << 13) /* allow custom gamma tables */ -#define GENESYS_FLAG_NO_CALIBRATION (1 << 14) /* allow scanners to use skip the calibration, needed for sheetfed scanners */ -#define GENESYS_FLAG_HALF_CCD_MODE (1 << 15) /* scanner has setting for half ccd mode */ -#define GENESYS_FLAG_ODD_EVEN_CIS (1 << 16) /* scan odd and even pixels come in separated lines */ +#define GENESYS_FLAG_DARK_WHITE_CALIBRATION (1 << 12) /**> yet another calibration method. does white and dark shading in one run, depending on a black and a white strip*/ +#define GENESYS_FLAG_CUSTOM_GAMMA (1 << 13) /**> allow custom gamma tables */ +#define GENESYS_FLAG_NO_CALIBRATION (1 << 14) /**> allow scanners to use skip the calibration, needed for sheetfed scanners */ +#define GENESYS_FLAG_HALF_CCD_MODE (1 << 15) /**> scanner has setting for half ccd mode */ +#define GENESYS_FLAG_ODD_EVEN_CIS (1 << 16) /**> scan odd and even pixels come in separated lines */ -#define GENESYS_HAS_NO_BUTTONS 0 /* scanner has no supported button */ -#define GENESYS_HAS_SCAN_SW (1 << 0) /* scanner has SCAN button */ -#define GENESYS_HAS_FILE_SW (1 << 1) /* scanner has FILE button */ -#define GENESYS_HAS_COPY_SW (1 << 2) /* scanner has COPY button */ -#define GENESYS_HAS_EMAIL_SW (1 << 3) /* scanner has EMAIL button */ -#define GENESYS_HAS_PAGE_LOADED_SW (1 << 4) /* scanner has paper in detection */ -#define GENESYS_HAS_OCR_SW (1 << 5) /* scanner has OCR button */ -#define GENESYS_HAS_POWER_SW (1 << 6) /* scanner has power button */ -#define GENESYS_HAS_CALIBRATE (1 << 7) /* scanner has 'calibrate' software button to start calibration */ +#define GENESYS_HAS_NO_BUTTONS 0 /**> scanner has no supported button */ +#define GENESYS_HAS_SCAN_SW (1 << 0) /**> scanner has SCAN button */ +#define GENESYS_HAS_FILE_SW (1 << 1) /**> scanner has FILE button */ +#define GENESYS_HAS_COPY_SW (1 << 2) /**> scanner has COPY button */ +#define GENESYS_HAS_EMAIL_SW (1 << 3) /**> scanner has EMAIL button */ +#define GENESYS_HAS_PAGE_LOADED_SW (1 << 4) /**> scanner has paper in detection */ +#define GENESYS_HAS_OCR_SW (1 << 5) /**> scanner has OCR button */ +#define GENESYS_HAS_POWER_SW (1 << 6) /**> scanner has power button */ +#define GENESYS_HAS_CALIBRATE (1 << 7) /**> scanner has 'calibrate' software button to start calibration */ /* USB control message values */ #define REQUEST_TYPE_IN (USB_TYPE_VENDOR | USB_DIR_IN)