From: Bastian Dehn Date: Tue, 27 Feb 2024 17:16:23 +0000 (+0100) Subject: add stop scan X-Git-Tag: v1.0.0^2~166 X-Git-Url: https://gitweb.hhaalo.de/?a=commitdiff_plain;h=4a6854191d9ce8f4a2ff8a97fde8a7906733e6da;p=sane-kds-s2000w-net.git add stop scan --- diff --git a/src/kds_s2000w_net.c b/src/kds_s2000w_net.c index bf159d5..7997711 100644 --- a/src/kds_s2000w_net.c +++ b/src/kds_s2000w_net.c @@ -173,16 +173,21 @@ SANE_Status _sane_kds_s2000w_net_start(SANE_Handle handle) kds_s2000w_handler_start_scan(h); } - for (int i = 0; i < 10; i++) { + for (int i = 0; i < 100; i++) { + usleep(100000); kds_s2000w_handler_get_parameters(h); if (h->current_metadata->valid) break; } + if (h->current_scan_status->complete_scanned) + kds_s2000w_handler_stop_scan(h); + if (h->current_scan_status->complete_scanned && h->current_scan_status->current_image_number >= h->current_scan_status->downloaded_images - && h->current_scan_status->available_images <= 0) + && h->current_scan_status->available_images <= 0) { return SANE_STATUS_NO_DOCS; + } return SANE_STATUS_GOOD; }