From 6be79c4d1f8ad118e21b75985087292ae530a6b2 Mon Sep 17 00:00:00 2001 From: Sascha Silbe Date: Tue, 28 May 2013 16:05:49 +0000 Subject: Re-open scanner after each scan to work around HPLIP/SANE bugs With recent versions of HPLIP and SANE, my HP OfficeJet 4500 doesn't properly finish an ADF job. All images get returned, but the device is still busy afterwards, refusing to scan anything else. Closing the device finishes the job, allowing further scans after opening the device again. --- diff --git a/scan.py b/scan.py index b8a5b98..faa403d 100644 --- a/scan.py +++ b/scan.py @@ -525,10 +525,10 @@ class ScanThread(threading.Thread): self._images = images finally: - logging.debug('_scan(): closing iterator') + logging.debug('_scan_multi(): closing iterator') # make sure the scan is "cancelled" _now_ del scan_iter - logging.debug('_scan(): iterator closed') + logging.debug('_scan_multi(): iterator closed') @trace() def _check_action(self, actions): @@ -906,8 +906,9 @@ class ScanActivity(activity.Activity): if not exc: self._set_status('ready') - else: - self._open_scanner(self._current_scanner_name) + + # always re-open scanner, to work around HPLIP bugs + self._open_scanner(self._current_scanner_name) def _add_images(self, image_infos): for info in image_infos: -- cgit v0.9.1