diff --git a/hgdriver/hgdev/hg_scanner.cpp b/hgdriver/hgdev/hg_scanner.cpp index b480774..670327f 100644 --- a/hgdriver/hgdev/hg_scanner.cpp +++ b/hgdriver/hgdev/hg_scanner.cpp @@ -356,9 +356,13 @@ void hg_scanner::thread_read_int(void) } void hg_scanner::thread_handle_usb(void) { + int cnt = 0; + VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO, "[thread_handle_usb 'START' !!!]:[%d]\n", cnt); while (run_) { + VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO, "[thread_handle_usb 'WAIT' !!!]:[%d]\n", cnt); wait_usb_.wait(); + VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO, "[thread_handle_usb 'NOTIFY' !!!]:[%d]\n", cnt); if (!run_) break; @@ -367,7 +371,7 @@ void hg_scanner::thread_handle_usb(void) std::this_thread::sleep_for(std::chrono::milliseconds(3000)); if (scan_life_) { - LOG_INFO(LOG_LEVEL_FATAL, "image process is still running!\n"); + VLOG_MINI_1(LOG_LEVEL_FATAL, "[thread_handle_usb image process is still running!]:[%d]\n", cnt); continue; } } @@ -377,7 +381,11 @@ void hg_scanner::thread_handle_usb(void) thread_handle_usb_read(); if (scan_life_->release() == 0) scan_life_ = NULL; + + VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO, "[thread_handle_usb_read 'GET IMAGE END'!!!]:[%d]\n", cnt); + cnt++; } + VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO, "[thread_handle_usb EXIT !!!]:[%d]\n", cnt); } void hg_scanner::thread_image_handle(void) { diff --git a/hgdriver/hgdev/hg_scanner_239.cpp b/hgdriver/hgdev/hg_scanner_239.cpp index a8c8610..272b081 100644 --- a/hgdriver/hgdev/hg_scanner_239.cpp +++ b/hgdriver/hgdev/hg_scanner_239.cpp @@ -1323,10 +1323,14 @@ void hg_scanner_239::thread_handle_usb_read(void) int hg_scanner_239::start(void) { - if (is_read_int) + StopWatch sw; + while (is_read_int) { - VLOG_MINI_1(LOG_LEVEL_WARNING, "device status is(%s)\n", hg_log::lang_load(ID_STATU_DESC_SCANNER_ERR_DEVICE_BUSY)); - return SCANNER_ERR_DEVICE_DEVS_BOOTING; + if (sw.elapsed_s() > 10) + { + break; + } + VLOG_MINI_1(LOG_LEVEL_WARNING, "device status is(%s)\n", STATU_DESC_SCANNER_ERR_DEVICE_DEVS_BOOTING); } bool handled = false; int ret = try_third_app_handle_start(handled), diff --git a/hgdriver/hgdev/hg_scanner_300.cpp b/hgdriver/hgdev/hg_scanner_300.cpp index 4ad9407..1e4227e 100644 --- a/hgdriver/hgdev/hg_scanner_300.cpp +++ b/hgdriver/hgdev/hg_scanner_300.cpp @@ -127,7 +127,7 @@ void hg_scanner_300::thread_handle_usb_read(void) status_ = ret = SCANNER_ERR_USER_CANCELED; VLOG_MINI_2(LOG_LEVEL_DEBUG_INFO, "%s:%s\n", hg_log::lang_load(ID_STATU_DESC_SCANNER_ERR_DEVICE_GET_USER_CANCEL_SCAN), hg_scanner_err_name(status_)); } - VLOG_MINI_2(LOG_LEVEL_DEBUG_INFO, "%s:%s\n", "'STOPSCAN' message in usb thread\n" , hg_scanner_err_name(status_)); + VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO, "'STOPSCAN' message in usb thread:%s\n" , hg_scanner_err_name(status_)); break; } @@ -269,7 +269,7 @@ int hg_scanner_300::discard_all_images(void) std::lock_guard lock(io_lock_); int ret = io_->read_bulk(&str[0], &block); } - while (ret != SCANNER_ERR_TIMEOUT) + while (ret == SCANNER_ERR_OK) { cnt++; { @@ -292,12 +292,20 @@ int hg_scanner_300::discard_all_images(void) } int hg_scanner_300::start(void) { - if (is_read_int) + //if (is_read_int) + //{ + // VLOG_MINI_1(LOG_LEVEL_WARNING, "device status is(%s)\n", STATU_DESC_SCANNER_ERR_DEVICE_DEVS_BOOTING); + // return SCANNER_ERR_DEVICE_DEVS_BOOTING; + //} + StopWatch sw; + while (is_read_int) { + if (sw.elapsed_s() > 10) + { + break; + } VLOG_MINI_1(LOG_LEVEL_WARNING, "device status is(%s)\n", STATU_DESC_SCANNER_ERR_DEVICE_DEVS_BOOTING); - return SCANNER_ERR_DEVICE_DEVS_BOOTING; } - //discard_all_images(); bool handled = false; int ret = try_third_app_handle_start(handled),