diff --git a/hgdriver/hgdev/hg_scanner.cpp b/hgdriver/hgdev/hg_scanner.cpp index 583eceb..21d11d0 100644 --- a/hgdriver/hgdev/hg_scanner.cpp +++ b/hgdriver/hgdev/hg_scanner.cpp @@ -363,6 +363,7 @@ void hg_scanner::thread_handle_usb(void) VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO, "[thread_handle_usb 'START' !!!]:[%d]\n", cnt); while (run_) { + cnt++; 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); @@ -386,7 +387,6 @@ void hg_scanner::thread_handle_usb(void) 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); } @@ -989,19 +989,26 @@ void hg_scanner::thread_handle_image_process(void) //VLDGlobalEnable(); //VLDReportLeaks(); //while (run_ && !user_cancel_) + int cnt = 0; while (run_) { std::shared_ptr tiny_buffer; if (imgs_.Size() == 0) { if (wait_usb_.is_waiting()) + { + VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO, "[thread_handle_image_process 'break thread!!!'] Total pic %d.\n", cnt); + cnt = 0; break; - + } this_thread::sleep_for(chrono::milliseconds(30)); continue; } uint32_t id = -1; + cnt++; + LOG_INFO(LOG_LEVEL_DEBUG_INFO, "\r\n"); + VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO, "[thread_handle_image_process] Total from the queue:[%d].\n", cnt); tiny_buffer = imgs_.Take(&id); if (tiny_buffer->swap()) { @@ -1010,7 +1017,7 @@ void hg_scanner::thread_handle_image_process(void) if (!ImagePrc_pHandle_) { - VLOG_MINI_1(LOG_LEVEL_FATAL, "Get Image Process is NULL pid is %d.\n",pid_); + VLOG_MINI_1(LOG_LEVEL_FATAL, "[thread_handle_image_process]:Get Image Process is NULL pid is %d.\n",pid_); stop_fatal_ = SCANNER_ERR_INSUFFICIENT_MEMORY; stop(); break; @@ -1026,23 +1033,24 @@ void hg_scanner::thread_handle_image_process(void) } else stop_fatal_ = SCANNER_ERR_INSUFFICIENT_MEMORY; - VLOG_MINI_1(LOG_LEVEL_ALL, "is opencv Fatal: %s\n", e.what()); + VLOG_MINI_1(LOG_LEVEL_FATAL, "[thread_handle_image_process]:is opencv Fatal and stop scanner: %s\n", e.what()); stop(); break; } catch (...) { - VLOG_MINI_1(LOG_LEVEL_FATAL, "FATAL: Insufficient memory when proecss image with %d bytes.\n", tiny_buffer->size()); + VLOG_MINI_1(LOG_LEVEL_FATAL, "[thread_handle_image_process]:stop scanner!!! Insufficient memory when proecss image with %d bytes.\n", tiny_buffer->size()); stop_fatal_ = SCANNER_ERR_INSUFFICIENT_MEMORY; stop(); } } else { - VLOG_MINI_1(LOG_LEVEL_FATAL, "Reload USB data '%s' failed!\n", tiny_buffer->file().c_str()); + VLOG_MINI_1(LOG_LEVEL_FATAL, "[thread_handle_image_process]:Reload USB data '%s' failed!\n", tiny_buffer->file().c_str()); } } + LOG_INFO(LOG_LEVEL_DEBUG_INFO, "[thread_handle_image_process 'EXIT !!!']\n"); //VLDGlobalDisable(); } void hg_scanner::working_begin(void*) @@ -1150,7 +1158,7 @@ void hg_scanner::working_done(void*) } else { - VLOG_MINI_3(LOG_LEVEL_DEBUG_INFO, "[%s] scanned %d picture(s) and finished with error %s.\n", hg_log::current_time().c_str(), final_img_index_, hg_scanner_err_name(status_)); + VLOG_MINI_3(LOG_LEVEL_DEBUG_INFO, "[%s] EXIT All Thread--->Total picture: [%d] and scanner status [%s].\n", hg_log::current_time().c_str(), final_img_index_, hg_scanner_err_description(status_)); } test_1_paper_ = false; @@ -1712,7 +1720,7 @@ int hg_scanner::setting_rid_hoe_range(void* data) *((int*)data) = rid_hole_range_; } rid_hole_range_*=100; - VLOG_MINI_1(LOG_LEVEL_WARNING, "rid_hole_range_ = %f\r\n", rid_hole_range_); + VLOG_MINI_1(LOG_LEVEL_WARNING, "set rid_hole_range_ = %f\r\n", rid_hole_range_); return ret; } @@ -1726,7 +1734,7 @@ int hg_scanner::setting_bright(void* data) ret = SCANNER_ERR_NOT_EXACT; *((int*)data) = bright_; } - VLOG_MINI_1(LOG_LEVEL_WARNING, "bright_ = %d\r\n", bright_); + VLOG_MINI_1(LOG_LEVEL_WARNING, "set bright_ = %d\r\n", bright_); return ret; } int hg_scanner::setting_contrast(void* data) @@ -1739,7 +1747,7 @@ int hg_scanner::setting_contrast(void* data) ret = SCANNER_ERR_NOT_EXACT; *((int*)data) = contrast_; } - VLOG_MINI_1(LOG_LEVEL_WARNING, "contrast_ = %d\r\n", contrast_); + VLOG_MINI_1(LOG_LEVEL_WARNING, "set contrast_ = %d\r\n", contrast_); return ret; } int hg_scanner::setting_gamma(void* data) @@ -4491,58 +4499,58 @@ int hg_scanner::image_configuration(SCANCONF& ic) ic.cropRect.enable = false; } img_conf_ = ic; - VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO, "\n ic.pixtype=%d", ic.pixtype); - VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO, "\n ic.papertype=%d", ic.papertype); - VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO, "\n ic.AutoCrop_threshold=%d", ic.AutoCrop_threshold); - VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO, "\n ic.autodescrew=%d", ic.autodescrew); - VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO, "\n ic.automaticcolor=%d", ic.automaticcolor); - VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO, "\n ic.brightness=%f", ic.brightness); - VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO, "\n ic.contrast=%f", ic.contrast); - VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO, "\n ic.en_fold=%d", ic.en_fold); - VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO, "\n ic.en_sizecheck=%d", ic.en_sizecheck); - VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO, "\n ic.enhance_color=%d", ic.enhance_color); - VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO, "\n ic.fillbackground=%d", ic.fillbackground); - VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO, "\n ic.filter=%d", ic.filter); - VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO, "\n ic.gamma=%f", ic.gamma); - VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO, "\n ic.hardwarecaps.capturepixtype=%d", ic.hardwarecaps.capturepixtype); - VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO, "\n ic.hardwarecaps.en_doublefeed=%d", ic.hardwarecaps.en_doublefeed); - VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO, "\n ic.hsvcorrect=%d", ic.hsvcorrect); - VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO, "\n ic.imageRotateDegree=%f", ic.imageRotateDegree); - VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO, "\n ic.indent=%d", 5); - VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO, "\n ic.is_autocontrast=%d", ic.is_autocontrast); - VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO, "\n ic.is_autocrop=%d", ic.is_autocrop); - VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO, "\n ic.is_autodiscradblank_normal=%d", ic.is_autodiscradblank_normal); - VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO, "\n ic.is_autodiscradblank_vince=%d", ic.is_autodiscradblank_vince); - VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO, "\n ic.isfillcolor=%d", ic.isfillcolor); - VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO, "\n ic.is_autotext=%d", ic.is_autotext); - VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO, "\n ic.is_backrotate180=%d", ic.is_backrotate180); - VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO, "\n ic.is_convex=%d", ic.is_convex); - VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO, "\n ic.is_duplex=%d", ic.is_duplex); - VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO, "\n ic.is_switchfrontback=%d", ic.is_switchfrontback); - VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO, "\n ic.is_dogeardetection=%d", ic.is_dogeardetection); - VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO, "\n ic.fillhole.multi_output_red=%d", ic.multi_output_red); - VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO, "\n ic.noise=%d", ic.noise); - VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO, "\n ic.pixtype=%d", ic.pixtype); - VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO, "\n ic.resolution_dst=%f", ic.resolution_dst); - VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO, "\n ic.resolution_native=%f", ic.resolution_native); - VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO, "\n ic.scannum=%d", ic.scannum); - VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO, "\n ic.sharpen=%d", ic.sharpen); - VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO, "\n ic.discardblank_percent=%d", ic.discardblank_percent); - VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO, "\n ic.detachnoise.is_detachnoise=%d", ic.detachnoise.is_detachnoise); - VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO, "\n ic.detachnoise.detachnoise=%d\r ", ic.detachnoise.detachnoise); - VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO, "\n ic.detachnoise.refuseInflow=%d\r ", ic.refuseInflow); - VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO, "\n ic.detachnoise.refuseInflow=%d\r ", ic.refuseInflow); - VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO, "\n ic.removeMorr=%d\r ", ic.removeMorr); - VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO, "\n ic.errorExtention=%d\r ", ic.errorExtention); - VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO, "\n ic.textureRemove=%d\r\n ", ic.refuseInflow); - VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO, "\n ic.fillhole.is_fillhole=%d\r\n ", ic.fillhole.is_fillhole); - VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO, "\n ic.ic.fillhole.fillholeratio=%d\r\n ", ic.fillhole.fillholeratio); - VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO, "\n ic.fadeback=%d\r\n ", ic.fadeback); - VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO, "\n ic.cropRect.enable=%d\r ", ic.cropRect.enable); - VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO, "\n ic.cropRect.width=%d\r\n ", ic.cropRect.width); - VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO, "\n ic.cropRect.height=%d\r\n ", ic.cropRect.height); - VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO, "\n ic.cropRect.x=%d\r\n ", ic.cropRect.x); - VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO, "\n ic.cropRect.y=%d\r\n ", ic.cropRect.y); + VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO, "ic.pixtype=%d\r\n", ic.pixtype); + VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO, "ic.papertype=%d\r\n", ic.papertype); + VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO, "ic.AutoCrop_threshold=%d\r\n", ic.AutoCrop_threshold); + VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO, "ic.autodescrew=%d\r\n", ic.autodescrew); + VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO, "ic.automaticcolor=%d\r\n", ic.automaticcolor); + VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO, "ic.brightness=%f\r\n", ic.brightness); + VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO, "ic.contrast=%f\r\n", ic.contrast); + VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO, "ic.en_fold=%d\r\n", ic.en_fold); + VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO, "ic.en_sizecheck=%d\r\n", ic.en_sizecheck); + VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO, "ic.enhance_color=%d\r\n", ic.enhance_color); + VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO, "ic.fillbackground=%d\r\n", ic.fillbackground); + VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO, "ic.filter=%d\r\n", ic.filter); + VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO, "ic.gamma=%f\r\n", ic.gamma); + VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO, "ic.hardwarecaps.capturepixtype=%d\r\n", ic.hardwarecaps.capturepixtype); + VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO, "ic.hardwarecaps.en_doublefeed=%d\r\n", ic.hardwarecaps.en_doublefeed); + VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO, "ic.hsvcorrect=%d", ic.hsvcorrect); + VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO, "ic.imageRotateDegree=%f\r\n", ic.imageRotateDegree); + VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO, "ic.indent=%d\r\n", 5); + VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO, "ic.is_autocontrast=%d\r\n", ic.is_autocontrast); + VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO, "ic.is_autocrop=%d\r\n", ic.is_autocrop); + VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO, "ic.is_autodiscradblank_normal=%d\r\n", ic.is_autodiscradblank_normal); + VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO, "ic.is_autodiscradblank_vince=%d\r\n", ic.is_autodiscradblank_vince); + VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO, "ic.isfillcolor=%d\r\n", ic.isfillcolor); + VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO, "ic.is_autotext=%d\r\n", ic.is_autotext); + VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO, "ic.is_backrotate180=%d\r\n", ic.is_backrotate180); + VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO, "ic.is_convex=%d\r\n", ic.is_convex); + VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO, "ic.is_duplex=%d\r\n", ic.is_duplex); + VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO, "ic.is_switchfrontback=%d\r\n", ic.is_switchfrontback); + VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO, "ic.is_dogeardetection=%d\r\n", ic.is_dogeardetection); + VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO, "ic.fillhole.multi_output_red=%d\r\n", ic.multi_output_red); + VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO, "ic.noise=%d\r\n", ic.noise); + VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO, "ic.pixtype=%d\r\n", ic.pixtype); + VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO, "ic.resolution_dst=%f\r\n", ic.resolution_dst); + VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO, "ic.resolution_native=%f\r\n", ic.resolution_native); + VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO, "ic.scannum=%d\r\n", ic.scannum); + VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO, "ic.sharpen=%d\r\n", ic.sharpen); + VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO, "ic.discardblank_percent=%d\r\n", ic.discardblank_percent); + VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO, "ic.detachnoise.is_detachnoise=%d\r\n", ic.detachnoise.is_detachnoise); + VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO, "ic.detachnoise.detachnoise=%d\r\n ", ic.detachnoise.detachnoise); + VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO, "ic.detachnoise.refuseInflow=%d\r\n ", ic.refuseInflow); + VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO, "ic.detachnoise.refuseInflow=%d\r\n ", ic.refuseInflow); + VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO, "ic.removeMorr=%d\r\n ", ic.removeMorr); + VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO, "ic.errorExtention=%d\r\n ", ic.errorExtention); + VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO, "ic.textureRemove=%d\r\n ", ic.refuseInflow); + VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO, "ic.fillhole.is_fillhole=%d\r\n ", ic.fillhole.is_fillhole); + VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO, "ic.ic.fillhole.fillholeratio=%d\r\n ", ic.fillhole.fillholeratio); + VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO, "ic.fadeback=%d\r\n ", ic.fadeback); + VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO, "ic.cropRect.enable=%d\r\n ", ic.cropRect.enable); + VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO, "ic.cropRect.width=%d\r\n ", ic.cropRect.width); + VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO, "ic.cropRect.height=%d\r\n ", ic.cropRect.height); + VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO, "ic.cropRect.x=%d\r\n ", ic.cropRect.x); + VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO, "ic.cropRect.y=%d\r\n ", ic.cropRect.y); return ret; } \ No newline at end of file diff --git a/hgdriver/hgdev/hg_scanner_239.cpp b/hgdriver/hgdev/hg_scanner_239.cpp index 1899a2a..f7afeb0 100644 --- a/hgdriver/hgdev/hg_scanner_239.cpp +++ b/hgdriver/hgdev/hg_scanner_239.cpp @@ -381,7 +381,7 @@ int hg_scanner_239::get_image_count(void) int val = 0, ret = read_register(setting3399::SR_IM_COUNT, &val); - VLOG_MINI_2(LOG_LEVEL_DEBUG_INFO, "get_image_count() = %d, error: %s\n", val, hg_scanner_err_name(ret)); + //VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO, "Gets The image queue in the 'DEVICE':[%d]\n", val); if (ret == SCANNER_ERR_OK) return val; @@ -564,9 +564,10 @@ int hg_scanner_239::writedown_image_configuration(void) int hg_scanner_239::pop_first_image(void) { int ret = write_register(setting3399::SR_IM_POP, 1); - - VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO, "popup first image = %s\n", hg_scanner_err_name(ret)); - + if (ret) + { + VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO, "popup first image = %s\n", hg_scanner_err_name(ret)); + } return ret; } int hg_scanner_239::read_one_image_from_usb(SANE_Image_Statu statu) @@ -575,8 +576,9 @@ int hg_scanner_239::read_one_image_from_usb(SANE_Image_Statu statu) total = get_front_data_size(), off = 0, ret = SCANNER_ERR_OK; - - VLOG_MINI_1(LOG_LEVEL_FATAL, "read_one_image_from_usb get data total len is:%d\n", total); + //LOG_INFO(LOG_LEVEL_DEBUG_INFO, "\n") + //LOG_INFO(LOG_LEVEL_DEBUG_INFO,"------------------------------------------------------------\n") + //VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO, "read_one_image_from_usb get data total len is:%d\n", total); if (!waiting_for_memory_enough(total)) { @@ -645,12 +647,12 @@ int hg_scanner_239::read_one_image_from_usb(SANE_Image_Statu statu) } if (r > 0) { - VLOG_MINI_1(LOG_LEVEL_FATAL, "read_one_image_from_usb 'left' total len is:%d!!!\n", r); + VLOG_MINI_2(LOG_LEVEL_FATAL, "read_one_image_from_usb 'total' is %d, 'left' total len is:%d!!!\n", total, r); } if (ret == SCANNER_ERR_OK) { - VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO, "Read image from USB = %s\n", hg_scanner_err_name(ret)); + //VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO, "Read image from USB = %s\n", hg_scanner_err_name(ret)); ret = save_usb_data(buf); if (ret == SCANNER_ERR_OK) { @@ -661,7 +663,7 @@ int hg_scanner_239::read_one_image_from_usb(SANE_Image_Statu statu) } else { - VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO, "Read image data from USB err: %s\n", hg_scanner_err_name(ret)); + VLOG_MINI_1(LOG_LEVEL_FATAL, "Read image data from USB err: %s\n", hg_scanner_err_name(ret)); } } } @@ -1135,8 +1137,10 @@ void hg_scanner_239::thread_get_dves_image(void) if (size == sizeof(buf)) { status_ = settings::device_status_to_hg_err(info); - VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO, "status from interrupt point is '%s'\n", hg_scanner_err_name(status_)); - + if (status_) + { + VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO, "status from interrupt point is '%s'\n", hg_scanner_err_description(status_)); + } if (status_ != SCANNER_ERR_OK && status_ != SCANNER_ERR_TIMEOUT && status_ != SCANNER_ERR_DEVICE_STOPPED @@ -1183,7 +1187,7 @@ void hg_scanner_239::thread_get_dves_image(void) //break; } svdevs_err_.push_back(status_); - VLOG_MINI_1(LOG_LEVEL_WARNING, "\346\211\253\346\217\217\345\244\261\350\264\245, read interrupt\350\277\224\345\233\236\347\212\266\346\200\201\344\270\272\357\274\232%s\n", hg_scanner_err_description(status_)); + //VLOG_MINI_1(LOG_LEVEL_WARNING, "\346\211\253\346\217\217\345\244\261\350\264\245, read interrupt\350\277\224\345\233\236\347\212\266\346\200\201\344\270\272\357\274\232%s\n", hg_scanner_err_description(status_)); //break; //这个时候退出的话消息就还没读完,错误信息先保存下来,只有获取到stop时才退出,如果没获取完退出,可能会导致第二次扫描直接返回扫描完成 //设备返回stop就是告诉我设备已经准备好,可以进行下来操作。 } @@ -1217,10 +1221,10 @@ void hg_scanner_239::thread_get_dves_image(void) // fetch all buffered images and exit ... //while(!is_dev_image_process_done()) - if (img_conf_.resolution_dst > 200 && is_quality_ == IMG_QUALITY) - std::this_thread::sleep_for(std::chrono::milliseconds(5000)); - else - std::this_thread::sleep_for(std::chrono::milliseconds(2000)); + //if (img_conf_.resolution_dst > 200 && is_quality_ == IMG_QUALITY) + // std::this_thread::sleep_for(std::chrono::milliseconds(5000)); + //else + // std::this_thread::sleep_for(std::chrono::milliseconds(2000)); while (get_image_count() > 0) { @@ -1243,9 +1247,9 @@ void hg_scanner_239::thread_get_dves_image(void) } if (count == 0) { - std::lock_guard lock(io_lock_); + //std::lock_guard lock(io_lock_); - LOG_INFO(LOG_LEVEL_DEBUG_INFO, "First message received from USB is 'STOPSCAN'\n"); + //LOG_INFO(LOG_LEVEL_DEBUG_INFO, "First message received from USB is 'STOPSCAN'\n"); // notify_ui_working_status(STATU_DESC_DEVICE_RESET); // reset_ = true; // ret = io_->reset(); @@ -1255,7 +1259,7 @@ void hg_scanner_239::thread_get_dves_image(void) status_ = SCANNER_ERR_OK; int s = get_status(); - VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO, "status after received 'STOPSCAN': 0x%x\n", s); + //VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO, "status after received 'STOPSCAN': 0x%x\n", s); if (count == 0 || (s & 3) == 0) { LOG_INFO(LOG_LEVEL_DEBUG_INFO, "Really stopped ^_^\n"); @@ -1292,11 +1296,11 @@ void hg_scanner_239::thread_get_dves_image(void) else { // error handling ... - VLOG_MINI_4(LOG_LEVEL_DEBUG_INFO, "Read HGEIntInfo: From = %d, Code = %d, Img_Index = %d, status = %s\n", info->From, info->Code, info->Img_Index, hg_scanner_err_name(status_)); + VLOG_MINI_4(LOG_LEVEL_DEBUG_INFO, "Read HGEIntInfo: From = %d, Code = %d, Img_Index = %d, status = %s\n", info->From, info->Code, info->Img_Index, hg_scanner_err_description(status_)); } } - else - VLOG_MINI_2(LOG_LEVEL_DEBUG_INFO, "read %d bytes, sizeof(buf) = %d\n", size, sizeof(buf)); + /*else + VLOG_MINI_2(LOG_LEVEL_DEBUG_INFO, "read %d bytes, sizeof(buf) = %d\n", size, sizeof(buf));*/ this_thread::sleep_for(chrono::milliseconds(10)); } @@ -1311,7 +1315,7 @@ void hg_scanner_239::thread_get_dves_image(void) //} //status_ = b ? SCANNER_ERR_OK : SCANNER_ERR_DEVICE_NO_PAPER; } - VLOG_MINI_2(LOG_LEVEL_DEBUG_INFO, "USB thread exit with code: %s, status = %s\n", hg_scanner_err_name(ret), hg_scanner_err_name(status_)); + VLOG_MINI_2(LOG_LEVEL_DEBUG_INFO, "USB thread exit with code: %s, status = %s\n", hg_scanner_err_name(ret), hg_scanner_err_description(status_)); } void hg_scanner_239::thread_handle_usb_read(void) { @@ -1423,7 +1427,7 @@ int hg_scanner_239::start(void) status_ = ret; VLOG_MINI_3(LOG_LEVEL_WARNING, "(%s)[Thread %s]Send start command = %s\n", hg_log::current_time().c_str(), hg_log::format_current_thread_id().c_str(), hg_scanner_err_name(ret)); } - VLOG_MINI_1(LOG_LEVEL_WARNING, "start result: %s\n", hg_scanner_err_name(ret)); + VLOG_MINI_1(LOG_LEVEL_WARNING, "----------Main start scan status : %s----------\n", hg_scanner_err_description(ret)); return ret; }