From 95ac953da3e08633c6dd502ccb0651a3e78917ed Mon Sep 17 00:00:00 2001 From: gb <741021719@qq.com> Date: Wed, 24 May 2023 17:16:23 +0800 Subject: [PATCH] =?UTF-8?q?=E8=B0=83=E6=95=B4pop=5Ffirst=5Fimage=E8=B0=83?= =?UTF-8?q?=E7=94=A8=E4=BD=8D=E7=BD=AE=EF=BC=8C=E9=81=BF=E5=85=8D=E6=AD=BB?= =?UTF-8?q?=E9=94=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- hgdriver/hgdev/hg_scanner_302.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/hgdriver/hgdev/hg_scanner_302.cpp b/hgdriver/hgdev/hg_scanner_302.cpp index f7a00c5..cd4493f 100644 --- a/hgdriver/hgdev/hg_scanner_302.cpp +++ b/hgdriver/hgdev/hg_scanner_302.cpp @@ -543,6 +543,7 @@ int hg_scanner_302::read_one_image_from_usb(SANE_Image_Statu statu) total = get_front_data_size(), off = 0, ret = SCANNER_ERR_OK; + bool popimg = false; VLOG_MINI_1(LOG_LEVEL_ALL, "New image size: %u\n", total); if (!waiting_for_memory_enough(total)) @@ -600,7 +601,7 @@ int hg_scanner_302::read_one_image_from_usb(SANE_Image_Statu statu) ret = save_usb_data(buf); if (ret == SCANNER_ERR_OK) { - pop_first_image(); + popimg = true; } else { @@ -617,6 +618,8 @@ int hg_scanner_302::read_one_image_from_usb(SANE_Image_Statu statu) VLOG_MINI_1(LOG_LEVEL_FATAL, "write command SR_IM_TX failed: %s\n", hg_scanner_err_name(ret)); } } + if(popimg) + pop_first_image(); return ret; }