]> gitweb.hhaalo.de Git - sane-kds-s2000w-net.git/commitdiff
add stop scan
authorBastian Dehn <hhaalo@arcor.de>
Tue, 27 Feb 2024 17:16:23 +0000 (18:16 +0100)
committerBastian Dehn <hhaalo@arcor.de>
Tue, 27 Feb 2024 17:45:18 +0000 (18:45 +0100)
src/kds_s2000w_net.c

index bf159d5a779dde5c77f5d5a187ed95f0b38020fb..7997711c8e1ba7c6fc663a8c2de0953e1f2da2ae 100644 (file)
@@ -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;
 }