错误信息统一到接口文件函数中

This commit is contained in:
gb 2022-05-30 11:42:16 +08:00
parent 5099ccbcd1
commit 0d0c34dd8e
7 changed files with 76 additions and 174 deletions

View File

@ -70,100 +70,6 @@ hg_scanner::~hg_scanner()
VLOG_MINI_2(LOG_LEVEL_DEBUG_INFO, "%s(%s) destroyed.\n", name_.c_str(), hg_log::format_ptr(this).c_str());
}
std::string hg_scanner::strerr(scanner_err err)
{
RETURN_IF(err, SCANNER_ERR_OK);
RETURN_IF(err, SCANNER_ERR_INVALID_PARAMETER);
RETURN_IF(err, SCANNER_ERR_INSUFFICIENT_MEMORY);
RETURN_IF(err, SCANNER_ERR_ACCESS_DENIED);
RETURN_IF(err, SCANNER_ERR_IO_PENDING);
RETURN_IF(err, SCANNER_ERR_NOT_EXACT);
RETURN_IF(err, SCANNER_ERR_CONFIGURATION_CHANGED);
RETURN_IF(err, SCANNER_ERR_NOT_OPEN);
RETURN_IF(err, SCANNER_ERR_NOT_START);
RETURN_IF(err, SCANNER_ERR_NO_DATA);
RETURN_IF(err, SCANNER_ERR_HAS_DATA_YET);
RETURN_IF(err, SCANNER_ERR_OUT_OF_RANGE);
RETURN_IF(err, SCANNER_ERR_IO);
RETURN_IF(err, SCANNER_ERR_TIMEOUT);
RETURN_IF(err, SCANNER_ERR_CREATE_FILE_FAILED);
RETURN_IF(err, SCANNER_ERR_WRITE_FILE_FAILED);
RETURN_IF(err, SCANNER_ERR_OPENED_BY_OTHER_PROCESS);
// 2USB错误
RETURN_IF(err, SCANNER_ERR_USB_INIT_FAILED);
RETURN_IF(err, SCANNER_ERR_USB_REGISTER_PNP_FAILED);
RETURN_IF(err, SCANNER_ERR_USB_CLAIM_INTERFACE_FAILED);
// 3硬件错误
RETURN_IF(err, SCANNER_ERR_DEVICE_NOT_FOUND);
RETURN_IF(err, SCANNER_ERR_DEVICE_NOT_SUPPORT);
RETURN_IF(err, SCANNER_ERR_DEVICE_BUSY);
RETURN_IF(err, SCANNER_ERR_DEVICE_STOPPED);
RETURN_IF(err, SCANNER_ERR_DEVICE_COVER_OPENNED);
RETURN_IF(err, SCANNER_ERR_DEVICE_NO_PAPER);
RETURN_IF(err, SCANNER_ERR_DEVICE_FEEDING_PAPER);
RETURN_IF(err, SCANNER_ERR_DEVICE_DOUBLE_FEEDING);
RETURN_IF(err, SCANNER_ERR_DEVICE_PAPER_JAMMED);
RETURN_IF(err, SCANNER_ERR_DEVICE_STAPLE_ON);
RETURN_IF(err, SCANNER_ERR_DEVICE_PAPER_SKEW);
RETURN_IF(err, SCANNER_ERR_DEVICE_SIZE_CHECK);
RETURN_IF(err, SCANNER_ERR_DEVICE_DOGEAR);
RETURN_IF(err, SCANNER_ERR_DEVICE_NO_IMAGE);
RETURN_IF(err, SCANNER_ERR_DEVICE_SCANN_ERROR);
char unk[80];
sprintf(unk, "\346\234\252\347\237\245\351\224\231\350\257\257\357\274\2320x%x", err);
return unk;
}
std::string hg_scanner::error_description(scanner_err err)
{
RETURN_DESC_IF(err, SCANNER_ERR_OK);
RETURN_DESC_IF(err, SCANNER_ERR_INVALID_PARAMETER);
RETURN_DESC_IF(err, SCANNER_ERR_INSUFFICIENT_MEMORY);
RETURN_DESC_IF(err, SCANNER_ERR_ACCESS_DENIED);
RETURN_DESC_IF(err, SCANNER_ERR_IO_PENDING);
RETURN_DESC_IF(err, SCANNER_ERR_NOT_EXACT);
RETURN_DESC_IF(err, SCANNER_ERR_CONFIGURATION_CHANGED);
RETURN_DESC_IF(err, SCANNER_ERR_NOT_OPEN);
RETURN_DESC_IF(err, SCANNER_ERR_NOT_START);
RETURN_DESC_IF(err, SCANNER_ERR_NO_DATA);
RETURN_DESC_IF(err, SCANNER_ERR_HAS_DATA_YET);
RETURN_DESC_IF(err, SCANNER_ERR_OUT_OF_RANGE);
RETURN_DESC_IF(err, SCANNER_ERR_IO);
RETURN_DESC_IF(err, SCANNER_ERR_TIMEOUT);
RETURN_DESC_IF(err, SCANNER_ERR_CREATE_FILE_FAILED);
RETURN_DESC_IF(err, SCANNER_ERR_WRITE_FILE_FAILED);
RETURN_DESC_IF(err, SCANNER_ERR_OPENED_BY_OTHER_PROCESS);
// 2USB错误
RETURN_DESC_IF(err, SCANNER_ERR_USB_INIT_FAILED);
RETURN_DESC_IF(err, SCANNER_ERR_USB_REGISTER_PNP_FAILED);
RETURN_DESC_IF(err, SCANNER_ERR_USB_CLAIM_INTERFACE_FAILED);
// 3硬件错误
RETURN_DESC_IF(err, SCANNER_ERR_DEVICE_NOT_FOUND);
RETURN_DESC_IF(err, SCANNER_ERR_DEVICE_NOT_SUPPORT);
RETURN_DESC_IF(err, SCANNER_ERR_DEVICE_BUSY);
RETURN_DESC_IF(err, SCANNER_ERR_DEVICE_STOPPED);
RETURN_DESC_IF(err, SCANNER_ERR_DEVICE_COVER_OPENNED);
RETURN_DESC_IF(err, SCANNER_ERR_DEVICE_NO_PAPER);
RETURN_DESC_IF(err, SCANNER_ERR_DEVICE_FEEDING_PAPER);
RETURN_DESC_IF(err, SCANNER_ERR_DEVICE_DOUBLE_FEEDING);
RETURN_DESC_IF(err, SCANNER_ERR_DEVICE_PAPER_JAMMED);
RETURN_DESC_IF(err, SCANNER_ERR_DEVICE_STAPLE_ON);
RETURN_DESC_IF(err, SCANNER_ERR_DEVICE_PAPER_SKEW);
RETURN_DESC_IF(err, SCANNER_ERR_DEVICE_SIZE_CHECK);
RETURN_DESC_IF(err, SCANNER_ERR_DEVICE_DOGEAR);
RETURN_DESC_IF(err, SCANNER_ERR_DEVICE_NO_IMAGE);
RETURN_DESC_IF(err, SCANNER_ERR_DEVICE_SCANN_ERROR);
char unk[80];
sprintf(unk, "\346\234\252\347\237\245\351\224\231\350\257\257\357\274\2320x%x", err);
return unk;
}
std::string hg_scanner::temporary_file(char* tail, char* head)
{
std::string path("/tmp/");
@ -825,7 +731,7 @@ void hg_scanner::working_done(void*)
}
else
{
VLOG_MINI_2(LOG_LEVEL_DEBUG_INFO, "scanned %d picture(s) and finished with error %s.\n", final_img_index_, hg_scanner::strerr((scanner_err)status_).c_str());
VLOG_MINI_2(LOG_LEVEL_DEBUG_INFO, "scanned %d picture(s) and finished with error %s.\n", final_img_index_, hg_scanner_err_name(status_));
}
test_1_paper_ = false;
@ -975,7 +881,7 @@ int hg_scanner::setting_color_mode(void* data)
is_auto_matic_color = image_prc_param_.bits.color_mode == COLOR_MODE_AUTO_MATCH ? true :false; // 等于COLOR_MODE_AUTO_MATCH 的时候颜色模式需要变为2 彩色模式图像参数和硬件参数都如此
VLOG_MINI_4(LOG_LEVEL_DEBUG_INFO, "Change color mode from %s to %s = %s color is =%s\n", color_mode_string(old).c_str(), (char*)data, hg_scanner::strerr((scanner_err)ret).c_str(),str.c_str());
VLOG_MINI_4(LOG_LEVEL_DEBUG_INFO, "Change color mode from %s to %s = %s color is =%s\n", color_mode_string(old).c_str(), (char*)data, hg_scanner_err_name(ret),str.c_str());
if(ret == SCANNER_ERR_NOT_EXACT)
strcpy((char*)data, str.c_str());
@ -999,7 +905,7 @@ int hg_scanner::setting_multi_out_type(void *data)
bool exact = check_range(setting_map_[HG_BASE_SETTING_INDEX_MULTI_OUT], str);
int color;
image_prc_param_.bits.multi_out = match_best_multi_out(str,NULL);
VLOG_MINI_3(LOG_LEVEL_DEBUG_INFO, "set multi_out type from %s to %s = %s\n", multi_out_string(image_prc_param_.bits.multi_out).c_str(), (char*)data, hg_scanner::strerr((scanner_err)ret).c_str());
VLOG_MINI_3(LOG_LEVEL_DEBUG_INFO, "set multi_out type from %s to %s = %s\n", multi_out_string(image_prc_param_.bits.multi_out).c_str(), (char*)data, hg_scanner_err_name(ret));
if (image_prc_param_.bits.multi_out == MULTI_GRAY_AND_BW)
color = COLOR_MODE_256_GRAY;
@ -1105,7 +1011,7 @@ int hg_scanner::setting_paper(void* data)
else if (!exact)
ret = SCANNER_ERR_NOT_EXACT;
VLOG_MINI_3(LOG_LEVEL_DEBUG_INFO, "Change paper from %s to %s = %s\n", paper_string(old).c_str(), (char*)data, hg_scanner::strerr((scanner_err)ret).c_str());
VLOG_MINI_3(LOG_LEVEL_DEBUG_INFO, "Change paper from %s to %s = %s\n", paper_string(old).c_str(), (char*)data, hg_scanner_err_name(ret));
if(ret == SCANNER_ERR_NOT_EXACT)
strcpy((char*)data, paper.c_str());
@ -1119,7 +1025,7 @@ int hg_scanner::setting_paper_check(void* data)
bool use = *((bool*)data);
int ret = on_paper_check_changed(use);
VLOG_MINI_2(LOG_LEVEL_DEBUG_INFO, "Change paper size-checking %s = %s\n", *((bool*)data) ? "enabled" : "disabled", hg_scanner::strerr((scanner_err)ret).c_str());
VLOG_MINI_2(LOG_LEVEL_DEBUG_INFO, "Change paper size-checking %s = %s\n", *((bool*)data) ? "enabled" : "disabled", hg_scanner_err_name(ret));
*((bool*)data) = use;
return ret;
@ -1130,7 +1036,7 @@ int hg_scanner::setting_page(void* data)
bool exact = check_range(setting_map_[HG_BASE_SETTING_INDEX_PAGE], val);
int ret = exact ? SCANNER_ERR_OK : SCANNER_ERR_NOT_EXACT;
VLOG_MINI_3(LOG_LEVEL_DEBUG_INFO, "Change page from %s to %s = %s\n", page_string(image_prc_param_.bits.page).c_str(), (char*)data, hg_scanner::strerr((scanner_err)ret).c_str());
VLOG_MINI_3(LOG_LEVEL_DEBUG_INFO, "Change page from %s to %s = %s\n", page_string(image_prc_param_.bits.page).c_str(), (char*)data, hg_scanner_err_name(ret));
image_prc_param_.bits.page = match_best_page(val, NULL);
if (!exact)
strcpy((char*)data, val.c_str());
@ -1165,7 +1071,7 @@ int hg_scanner::setting_resolution(void* data)
else if (sub)
ret = sub;
VLOG_MINI_3(LOG_LEVEL_DEBUG_INFO, "Change resolution from %d to %d = %s\n", old, *((int*)data), hg_scanner::strerr((scanner_err)ret).c_str());
VLOG_MINI_3(LOG_LEVEL_DEBUG_INFO, "Change resolution from %d to %d = %s\n", old, *((int*)data), hg_scanner_err_name(ret));
*((int*)data) = resolution_;
return ret;
@ -1444,7 +1350,7 @@ int hg_scanner::setting_text_direction(void* data)
int ret = exact ? SCANNER_ERR_OK : SCANNER_ERR_NOT_EXACT;
VLOG_MINI_3(LOG_LEVEL_DEBUG_INFO, "Change text direction from '%s' to '%s' = %s\n", text_direction_string(image_prc_param_.bits.text_direction).c_str()
, (char*)data, hg_scanner::strerr((scanner_err)ret).c_str());
, (char*)data, hg_scanner_err_name(ret));
image_prc_param_.bits.text_direction = match_best_text_direction(str, NULL);
if (!exact)
strcpy((char*)data, str.c_str());
@ -1566,7 +1472,7 @@ int hg_scanner::setting_img_quality(void *data)
bool exact = check_range(setting_map_[HG_BASE_SETTING_INDEX_IMG_QUALITY], str);
int ret = exact ? SCANNER_ERR_OK : SCANNER_ERR_NOT_EXACT;
VLOG_MINI_3(LOG_LEVEL_DEBUG_INFO, "Change quality from '%s' to '%s' = %s\n", is_img_quality(is_quality_).c_str()
, (char*)data, hg_scanner::strerr((scanner_err)ret).c_str());
, (char*)data, hg_scanner_err_name(ret));
is_quality_ = match_best_img_quality(str,NULL);
@ -1693,7 +1599,7 @@ int hg_scanner::on_scann_error(int err)
unsigned int e = err;
return ui_ev_cb_((scanner_handle)this, SANE_EVENT_ERROR, (void*)hg_scanner::strerr((scanner_err)err).c_str(), &e, NULL);
return ui_ev_cb_((scanner_handle)this, SANE_EVENT_ERROR, (void*)hg_scanner_err_name(err), &e, NULL);
}
int hg_scanner::try_third_app_handle_start(bool& handled)
{
@ -2111,7 +2017,7 @@ int hg_scanner::set_setting(int setting_no, void* data, int len)
else
name = std::string("\350\256\276\347\275\256\351\241\271") + sn;
name.insert(0, "\350\256\276\347\275\256 \"");
name += "\" \345\200\274\345\244\261\350\264\245: " + hg_scanner::strerr((scanner_err)ret);
name += std::string("\" \345\200\274\345\244\261\350\264\245: ") + hg_scanner_err_name(ret);
notify_ui_working_status(name.c_str());
}
@ -2273,7 +2179,7 @@ int hg_scanner::get_image_info(SANE_Parameters* ii)
ret = SCANNER_ERR_OK;
}
}
VLOG_MINI_4(LOG_LEVEL_DEBUG_INFO, "Get image info(%d * %d * %d) = %s\n", ii->pixels_per_line, ii->lines, imh.bits, hg_scanner::strerr((scanner_err)ret).c_str());
VLOG_MINI_4(LOG_LEVEL_DEBUG_INFO, "Get image info(%d * %d * %d) = %s\n", ii->pixels_per_line, ii->lines, imh.bits, hg_scanner_err_name(ret));
return ret;
}

View File

@ -319,8 +319,6 @@ public:
hg_scanner(ScannerSerial serial, const char* dev_name, usb_io* io);
virtual ~hg_scanner();
static std::string strerr(scanner_err err);
static std::string error_description(scanner_err err);
static std::string temporary_file(char* tail = NULL, char* head = NULL);
static int save_2_tempory_file(std::shared_ptr<std::vector<char>> data, std::string* path_file, unsigned int index = 0);

View File

@ -397,7 +397,7 @@ void hg_scanner_200::thread_handle_usb_read(void)
else
{
// notify_ui_working_status(hg_scanner::error_description((scanner_err)prev_err).c_str(), SANE_EVENT_ERROR, prev_err);
VLOG_MINI_1(LOG_LEVEL_WARNING, "-x-x-x-: USB thread error: %s\n", hg_scanner::strerr((scanner_err)prev_err).c_str());
VLOG_MINI_1(LOG_LEVEL_WARNING, "-x-x-x-: USB thread error: %s\n", hg_scanner_err_name(prev_err));
}
prev_err = ret;
}
@ -450,7 +450,7 @@ int hg_scanner_200::start(void)
ret = writeusb(usb);
io_->set_timeout(500);
VLOG_MINI_1(LOG_LEVEL_WARNING, "device start is.(%s)\n", hg_scanner::strerr((scanner_err)ret).c_str());
VLOG_MINI_1(LOG_LEVEL_WARNING, "device start is.(%s)\n", hg_scanner_err_name(ret));
if(ret == SCANNER_ERR_OK)
{
@ -833,7 +833,7 @@ int hg_scanner_200::writedown_device_configuration(bool type,HGSCANCONF_DSP *d)
len = sizeof(USBCB);
ret = io_->write_bulk(&usbcb,&len);
VLOG_MINI_1(LOG_LEVEL_WARNING, "writedown_device_configuration is .(%s)\n", hg_scanner::strerr((scanner_err)ret).c_str());
VLOG_MINI_1(LOG_LEVEL_WARNING, "writedown_device_configuration is .(%s)\n", hg_scanner_err_name(ret));
return ret;
}

View File

@ -438,12 +438,12 @@ std::string hg_scanner_239::control_fetch(int addr, int val, int size)
ret = io_->read_bulk(&data[0], &l);
if (ret)
{
VLOG_MINI_3(LOG_LEVEL_DEBUG_INFO, "control_fetch(%d, %d) - read_bulk = %s\n", addr, val, hg_scanner::strerr((scanner_err)ret).c_str());
VLOG_MINI_3(LOG_LEVEL_DEBUG_INFO, "control_fetch(%d, %d) - read_bulk = %s\n", addr, val, hg_scanner_err_name(ret));
data.clear();
}
}
else
VLOG_MINI_3(LOG_LEVEL_DEBUG_INFO, "control_fetch(%d, %d) = %s\n", addr, val, hg_scanner::strerr((scanner_err)ret).c_str());
VLOG_MINI_3(LOG_LEVEL_DEBUG_INFO, "control_fetch(%d, %d) = %s\n", addr, val, hg_scanner_err_name(ret));
return data;
}
@ -473,7 +473,7 @@ int hg_scanner_239::clr_roller_num(void)
return val;
else
{
VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO, "clr_roller_num = %s\n", hg_scanner::strerr((scanner_err)ret).c_str());
VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO, "clr_roller_num = %s\n", hg_scanner_err_name(ret));
return -1;
}
}
@ -486,7 +486,7 @@ int hg_scanner_239::get_sleep_time(void)
return val;
else
{
VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO, "get_sleep_time = %s\n", hg_scanner::strerr((scanner_err)ret).c_str());
VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO, "get_sleep_time = %s\n", hg_scanner_err_name(ret));
return -1;
}
}
@ -497,7 +497,7 @@ int hg_scanner_239::get_scan_mode(void)
if (ret)
{
VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO, "get scan mode error: %s\n", hg_scanner::strerr((scanner_err)ret).c_str());
VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO, "get scan mode error: %s\n", hg_scanner_err_name(ret));
status_ = ret;
return -1;
@ -512,7 +512,7 @@ int hg_scanner_239::get_status(void)
if (ret)
{
VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO, "get status error: %s\n", hg_scanner::strerr((scanner_err)ret).c_str());
VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO, "get status error: %s\n", hg_scanner_err_name(ret));
status_ = ret;
return -1;
@ -527,7 +527,7 @@ bool hg_scanner_239::is_dev_tx(void)
if (ret)
{
VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO, "is_dev_tx() error: %s\n", hg_scanner::strerr((scanner_err)ret).c_str());
VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO, "is_dev_tx() error: %s\n", hg_scanner_err_name(ret));
status_ = ret;
return false;
@ -542,7 +542,7 @@ bool hg_scanner_239::is_dev_image_process_done(void)
if (ret)
{
VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO, "is_dev_image_process_done() error: %s\n", hg_scanner::strerr((scanner_err)ret).c_str());
VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO, "is_dev_image_process_done() error: %s\n", hg_scanner_err_name(ret));
status_ = ret;
return true;
@ -558,7 +558,7 @@ bool hg_scanner_239::is_dev_image_keep_last_paper(void)
if (ret)
{
VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO, "is_dev_image_keep_last_paper() error: %s\n", hg_scanner::strerr((scanner_err)ret).c_str());
VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO, "is_dev_image_keep_last_paper() error: %s\n", hg_scanner_err_name(ret));
status_ = ret;
return true;
@ -575,7 +575,7 @@ int hg_scanner_239::get_scanned_count(void)
return val;
else
{
VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO, "get_scanned_count = %s\n", hg_scanner::strerr((scanner_err)ret).c_str());
VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO, "get_scanned_count = %s\n", hg_scanner_err_name(ret));
return -1;
}
}
@ -584,7 +584,7 @@ int hg_scanner_239::get_image_count(void)
int val = 0,
ret = read_register(SR_IM_COUNT, &val);
VLOG_MINI_2(LOG_LEVEL_DEBUG_INFO, "get_image_count() = %d, error: %s\n", val, hg_scanner::strerr((scanner_err)ret).c_str());
VLOG_MINI_2(LOG_LEVEL_DEBUG_INFO, "get_image_count() = %d, error: %s\n", val, hg_scanner_err_name(ret));
if (ret == SCANNER_ERR_OK)
return val;
@ -600,7 +600,7 @@ int hg_scanner_239::get_front_data_size(void)
return val;
else
{
VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO, "get_front_data_size = %s\n", hg_scanner::strerr((scanner_err)ret).c_str());
VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO, "get_front_data_size = %s\n", hg_scanner_err_name(ret));
return -1;
}
}
@ -743,7 +743,7 @@ int hg_scanner_239::get_device_paperon_stautus(void)
// ret = write_register(SR_CONFIG_SCAN_PARAM, dev_conf_.value);
// VLOG_MINI_2(LOG_LEVEL_DEBUG_INFO, "Writedown scanner configuration(0x%x) = %s\n", dev_conf_.value, hg_scanner::strerr((scanner_err)ret).c_str());
// VLOG_MINI_2(LOG_LEVEL_DEBUG_INFO, "Writedown scanner configuration(0x%x) = %s\n", dev_conf_.value, hg_scanner_err_name(ret));
// return ret;
// }
@ -757,7 +757,7 @@ int hg_scanner_239::writedown_device_configuration(HGSCANCONF *dev_conf)
ret = write_register(SR_CONFIG_SCAN_PARAM, dev_conf->value);
VLOG_MINI_2(LOG_LEVEL_DEBUG_INFO, "Writedown scanner configuration(0x%x) = %s\n", dev_conf->value, hg_scanner::strerr((scanner_err)ret).c_str());
VLOG_MINI_2(LOG_LEVEL_DEBUG_INFO, "Writedown scanner configuration(0x%x) = %s\n", dev_conf->value, hg_scanner_err_name(ret));
return ret;
}
@ -964,7 +964,7 @@ int hg_scanner_239::pop_first_image(void)
{
int ret = write_register(SR_IM_POP, 1);
VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO, "popup first image = %s\n", hg_scanner::strerr((scanner_err)ret).c_str());
VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO, "popup first image = %s\n", hg_scanner_err_name(ret));
return ret;
}
@ -1028,7 +1028,7 @@ int hg_scanner_239::read_one_image_from_usb(void)
}
if (ret == SCANNER_ERR_OK)
{
VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO, "Read image from USB = %s\n", hg_scanner::strerr((scanner_err)ret).c_str());
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)
{
@ -1040,7 +1040,7 @@ int hg_scanner_239::read_one_image_from_usb(void)
else
{
char msg[128];
sprintf(msg, "Read image data from USB err: %s\n", hg_scanner::strerr((scanner_err)ret).c_str());
sprintf(msg, "Read image data from USB err: %s\n", hg_scanner_err_name(ret));
LOG_INFO(LOG_LEVEL_DEBUG_INFO, msg);
notify_ui_working_status(msg);
notify_ui_working_status(STATU_DESC_SCANNER_ERR_TIMEOUT, SANE_EVENT_ERROR);
@ -1429,7 +1429,7 @@ void hg_scanner_239::thread_handle_usb_read(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::strerr((scanner_err)status_).c_str());
VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO, "status from interrupt point is '%s'\n", hg_scanner_err_name(status_));
if (status_ != SCANNER_ERR_OK && status_ != SCANNER_ERR_TIMEOUT && status_ != SCANNER_ERR_DEVICE_STOPPED)
{
@ -1450,7 +1450,7 @@ void hg_scanner_239::thread_handle_usb_read(void)
}
status_ = st;
}
VLOG_MINI_1(LOG_LEVEL_WARNING, "扫描失败, read interrupt返回状态为%s\n", hg_scanner::error_description((scanner_err)status_).c_str());
VLOG_MINI_1(LOG_LEVEL_WARNING, "扫描失败, read interrupt返回状态为%s\n", hg_scanner_err_description(status_));
//notify_ui_working_status(("扫描失败 " + hg_scanner::error_description((scanner_err)status_)).c_str(), SANE_EVENT_ERROR, status_);
break;
}
@ -1474,7 +1474,7 @@ void hg_scanner_239::thread_handle_usb_read(void)
if (ret == SCANNER_ERR_INSUFFICIENT_MEMORY)
stop();
status_ = ret = SCANNER_ERR_USER_CANCELED;
VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO, "用户取消操作 '%s'\n", hg_scanner::strerr((scanner_err)status_).c_str());
VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO, "用户取消操作 '%s'\n", hg_scanner_err_name(status_));
break;
}
}
@ -1528,7 +1528,7 @@ void hg_scanner_239::thread_handle_usb_read(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::strerr((scanner_err)status_).c_str());
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_));
}
}
else
@ -1536,7 +1536,7 @@ void hg_scanner_239::thread_handle_usb_read(void)
this_thread::sleep_for(chrono::milliseconds(10));
}
VLOG_MINI_2(LOG_LEVEL_DEBUG_INFO, "USB thread exit with code: %s, status = %s\n", hg_scanner::strerr((scanner_err)ret).c_str(), hg_scanner::strerr((scanner_err)status_).c_str());
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_));
}
int hg_scanner_239::start(void)
@ -1593,17 +1593,17 @@ int hg_scanner_239::start(void)
if (ret)
{
VLOG_MINI_1(LOG_LEVEL_WARNING, "Write down image process parameters fail is(%s), the result will be unpredictable.\n", hg_scanner::strerr((scanner_err)ret).c_str());
VLOG_MINI_1(LOG_LEVEL_WARNING, "Write down image process parameters fail is(%s), the result will be unpredictable.\n", hg_scanner_err_name(ret));
std::string info(STATU_DESC_REWRITE_CONFIGURATION);
info += "失败:" + hg_scanner::strerr((scanner_err)ret);
info += std::string("\345\244\261\350\264\245\357\274\232") + hg_scanner_err_name(ret);
notify_ui_working_status(info.c_str(), SANE_EVENT_ERROR, ret);
}
if (ret != SCANNER_ERR_OK)
{
VLOG_MINI_1(LOG_LEVEL_WARNING, "start status01 is(%s), the result will be unpredictable.\n", hg_scanner::strerr((scanner_err)ret).c_str());
VLOG_MINI_1(LOG_LEVEL_WARNING, "start status01 is(%s), the result will be unpredictable.\n", hg_scanner_err_name(ret));
return ret;
}
ret = get_scanner_paperon();
@ -1617,7 +1617,7 @@ int hg_scanner_239::start(void)
ret = write_command(SC_START);
VLOG_MINI_1(LOG_LEVEL_WARNING, "start status02 is(%s), the result will be unpredictable.\n", hg_scanner::strerr((scanner_err)ret).c_str());
VLOG_MINI_1(LOG_LEVEL_WARNING, "start status02 is(%s), the result will be unpredictable.\n", hg_scanner_err_name(ret));
io_->set_timeout(1000);
if (ret == SCANNER_ERR_OK)
{
@ -1630,7 +1630,7 @@ int hg_scanner_239::start(void)
else
{
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::strerr((scanner_err)ret).c_str());
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));
}
return ret;
@ -1663,7 +1663,7 @@ int hg_scanner_239::start(void)
// ii->lines = imh.height;
// }
// }
// VLOG_MINI_4(LOG_LEVEL_DEBUG_INFO, "Get image info(%d * %d * %d) = %s\n", ii->pixels_per_line, ii->lines, imh.bits, hg_scanner::strerr((scanner_err)ret).c_str());
// VLOG_MINI_4(LOG_LEVEL_DEBUG_INFO, "Get image info(%d * %d * %d) = %s\n", ii->pixels_per_line, ii->lines, imh.bits, hg_scanner_err_name(ret));
//
// return ret;
//}
@ -1762,7 +1762,7 @@ int hg_scanner_239::get_roller_num(void)
return val;
else
{
VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO, "get_roller_num = %s\n", hg_scanner::strerr((scanner_err)ret).c_str());
VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO, "get_roller_num = %s\n", hg_scanner_err_name(ret));
return -1;
}
}
@ -1826,7 +1826,7 @@ int hg_scanner_239::get_sleep_time(SANE_Power* getime)
*getime = (SANE_Power)val;
else
{
VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO, "get_sleep_time = %s\n", hg_scanner::strerr((scanner_err)ret).c_str());
VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO, "get_sleep_time = %s\n", hg_scanner_err_name(ret));
return -1;
}
}
@ -1835,7 +1835,7 @@ int hg_scanner_239::set_sleep_time(int setsleepime)
{
int ret = write_register(SR_SET_SLEEPTIME, setsleepime);
VLOG_MINI_2(LOG_LEVEL_DEBUG_INFO, "set sleep time to %d = %s\n", setsleepime, hg_scanner::strerr((scanner_err)ret).c_str());
VLOG_MINI_2(LOG_LEVEL_DEBUG_INFO, "set sleep time to %d = %s\n", setsleepime, hg_scanner_err_name(ret));
return ret;
}
@ -1873,7 +1873,7 @@ int hg_scanner_239::get_scanner_paperon(SANE_Bool* paperon)
}
else
{
VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO, "get_scanner_paperon = %s\n", hg_scanner::strerr((scanner_err)ret).c_str());
VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO, "get_scanner_paperon = %s\n", hg_scanner_err_name(ret));
return -1;
}
return ret;

View File

@ -395,7 +395,7 @@ void hg_scanner_300::thread_handle_usb_read(void)
USBCB usb = {START_COMMAND, img_conf_.scannum, 0};
ret = writeusb(usb);
io_->set_timeout(500);
VLOG_MINI_1(LOG_LEVEL_WARNING, "device start is.(%s)\n", hg_scanner::strerr((scanner_err)ret).c_str());
VLOG_MINI_1(LOG_LEVEL_WARNING, "device start is.(%s)\n", hg_scanner_err_name(ret));
if(ret == SCANNER_ERR_OK)
{
@ -798,7 +798,7 @@ int hg_scanner_300::writedown_device_configuration(bool type,HGSCANCONF_G400 *d)
len = sizeof(USBCB);
ret = io_->write_bulk(&usbcb,&len);
VLOG_MINI_1(LOG_LEVEL_WARNING, "writedown_device_configuration is .(%s)\n", hg_scanner::strerr((scanner_err)ret).c_str());
VLOG_MINI_1(LOG_LEVEL_WARNING, "writedown_device_configuration is .(%s)\n", hg_scanner_err_name(ret));
return ret;
}

View File

@ -392,7 +392,7 @@ int hg_scanner_400::start(void)
USBCB usb = {START_COMMAND, img_conf_.scannum, 0};
ret = writeusb(usb);
io_->set_timeout(1000);
VLOG_MINI_1(LOG_LEVEL_WARNING, "device start is.(%s)\n", hg_scanner::strerr((scanner_err)ret).c_str());
VLOG_MINI_1(LOG_LEVEL_WARNING, "device start is.(%s)\n", hg_scanner_err_name(ret));
if(ret == SCANNER_ERR_OK)
{
@ -414,14 +414,14 @@ int hg_scanner_400::stop(void)
if (status_ == SCANNER_ERR_DEVICE_BUSY)
{
VLOG_MINI_1(LOG_LEVEL_WARNING, "stop !but device is busy ,so sleep 2s(%s)\n", hg_scanner::strerr((scanner_err)status_).c_str());
VLOG_MINI_1(LOG_LEVEL_WARNING, "stop !but device is busy ,so sleep 2s(%s)\n", hg_scanner_err_name(status_));
std::this_thread::sleep_for(std::chrono::milliseconds(2000));
}
user_cancel_ = true;
if (ret == SCANNER_ERR_OK)
{
status_ = SCANNER_ERR_DEVICE_STOPPED;
VLOG_MINI_1(LOG_LEVEL_WARNING, "stop device:(%s)\n", hg_scanner::strerr((scanner_err)status_).c_str());
VLOG_MINI_1(LOG_LEVEL_WARNING, "stop device:(%s)\n", hg_scanner_err_name(status_));
}
notify_ui_working_status("取消扫描", SANE_EVENT_STATUS, status_);
final_imgs_.Clear();
@ -565,7 +565,7 @@ void hg_scanner_400::image_process(std::shared_ptr<std::vector<char>>& buffer)
{
ret = hg_imgproc::fillhole(handle);
//printf("填穿孔开启\r\n");
//VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO, "填穿孔开启:%s\n",hg_scanner::strerr((scanner_err)ret).c_str());
//VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO, "填穿孔开启:%s\n",hg_scanner_err_name(ret));
}
/////////////////////////////////////111111111111111111111111111//////////////////////////////////
@ -575,32 +575,32 @@ void hg_scanner_400::image_process(std::shared_ptr<std::vector<char>>& buffer)
{
ret = hg_imgproc::discardBlank(handle);
printf("丢弃空白页开启\r\n");
//VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO, "丢弃空白页开启:%s\n",hg_scanner::strerr((scanner_err)ret).c_str());
//VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO, "丢弃空白页开启:%s\n",hg_scanner_err_name(ret));
}
if(img_conf_.fadeback)
{
hg_imgproc::fadeback(handle,img_conf_.fadebackrange,param.double_side);
//printf("背景除色开启\r\n");
//VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO, "背景除色开启:%s\n",hg_scanner::strerr((scanner_err)ret).c_str());
//VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO, "背景除色开启:%s\n",hg_scanner_err_name(ret));
}
if (img_conf_.resolution_dst != img_conf_.resolution_native)
{
hg_imgproc::resolution_change(handle);
//printf("dpi改变开启\r\n");
//VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO, "dpi改变开启:%s\n",hg_scanner::strerr((scanner_err)ret).c_str());
//VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO, "dpi改变开启:%s\n",hg_scanner_err_name(ret));
}
if (img_conf_.cropRect.enable && !img_conf_.is_autocrop)
{
hg_imgproc::croprect(handle);
//printf("手动裁图开启\r\n");
//VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO, "手动裁图开启:%s\n",hg_scanner::strerr((scanner_err)ret).c_str());
//VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO, "手动裁图开启:%s\n",hg_scanner_err_name(ret));
}
if (img_conf_.filter != ColorFilter::FILTER_NONE && (img_conf_.pixtype == COLOR_MODE_BLACK_WHITE || img_conf_.pixtype == COLOR_MODE_256_GRAY))
{
printf("除色开启\r\n");
hg_imgproc::channel(handle);
//VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO, "除色开启:%s\n",hg_scanner::strerr((scanner_err)ret).c_str());
//VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO, "除色开启:%s\n",hg_scanner_err_name(ret));
}
/////////////////////////////////////2222222222222222222222222222222222222//////////////////////////////////
int tableLength ;//= sizeof(custom_gamma_val_->table)/sizeof(custom_gamma_val_->table[0]);
@ -644,7 +644,7 @@ void hg_scanner_400::image_process(std::shared_ptr<std::vector<char>>& buffer)
{
hg_imgproc::answerSheetFilterRed(handle);
//printf("答题卡出红开启\r\n");
//VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO, "答题卡出红开启:%s\n",hg_scanner::strerr((scanner_err)ret).c_str());
//VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO, "答题卡出红开启:%s\n",hg_scanner_err_name(ret));
}
if (img_conf_.refuseInflow)
{
@ -667,7 +667,7 @@ void hg_scanner_400::image_process(std::shared_ptr<std::vector<char>>& buffer)
{
hg_imgproc::colorCorrection(handle);
//printf("颜色校正开启\r\n");
//VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO, "颜色校正开启:%s\n",hg_scanner::strerr((scanner_err)ret).c_str());
//VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO, "颜色校正开启:%s\n",hg_scanner_err_name(ret));
}
if ((img_conf_.imageRotateDegree != TEXT_DIRECTION_0 || img_conf_.is_backrotate180) && (!img_conf_.is_autotext))
{
@ -678,25 +678,25 @@ void hg_scanner_400::image_process(std::shared_ptr<std::vector<char>>& buffer)
{
hg_imgproc::textureRemove(handle);
//printf("除摩尔纹开启\r\n");
//VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO, "除摩尔纹开启:%s\n",hg_scanner::strerr((scanner_err)ret).c_str());
//VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO, "除摩尔纹开启:%s\n",hg_scanner_err_name(ret));
}
if (img_conf_.detachnoise.is_detachnoise)
{
hg_imgproc::nosieDetach(handle);
//printf("噪点优化开启\r\n");
//VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO, "噪点优化开启:%s\n",hg_scanner::strerr((scanner_err)ret).c_str());
//VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO, "噪点优化开启:%s\n",hg_scanner_err_name(ret));
}
if (img_conf_.pixtype == COLOR_MODE_BLACK_WHITE)
{
hg_imgproc::errorextention(handle);
//printf("黑白图处理开启\r\n");
//VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO, "黑白图处理开启:%s\n",hg_scanner::strerr((scanner_err)ret).c_str());
//VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO, "黑白图处理开启:%s\n",hg_scanner_err_name(ret));
}
if (img_conf_.en_fold)
{
hg_imgproc::fold(handle);
//printf("对折开启\r\n");
//VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO, "对折开启:%s\n",hg_scanner::strerr((scanner_err)ret).c_str());
//VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO, "对折开启:%s\n",hg_scanner_err_name(ret));
}
///////////////////////////////////
@ -705,7 +705,7 @@ void hg_scanner_400::image_process(std::shared_ptr<std::vector<char>>& buffer)
{
err = hg_imgproc::multi_out_red(handle);
//printf("多流出红开启\r\n");
//VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO, "多流出红开启:%s\n",hg_scanner::strerr((scanner_err)ret).c_str());
//VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO, "多流出红开启:%s\n",hg_scanner_err_name(ret));
}
if (img_conf_.sharpen)
@ -728,7 +728,7 @@ void hg_scanner_400::image_process(std::shared_ptr<std::vector<char>>& buffer)
,img_conf_.is_duplex);
//VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO, "图像拆分开启:%s\n",hg_scanner::strerr((scanner_err)ret).c_str());
//VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO, "图像拆分开启:%s\n",hg_scanner_err_name(ret));
}
if (!image_prc_param_.bits.split || !image_prc_param_.bits.rid_red || !image_prc_param_.bits.multi_out)
@ -736,7 +736,7 @@ void hg_scanner_400::image_process(std::shared_ptr<std::vector<char>>& buffer)
if(img_conf_.automaticcolor)
{
ret = hg_imgproc::auto_matic_color(handle,img_conf_.automaticcolortype);
//VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO, "颜色自动识别模式开启:%s\n",hg_scanner::strerr((scanner_err)ret).c_str());
//VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO, "颜色自动识别模式开启:%s\n",hg_scanner_err_name(ret));
}
}
if (img_conf_.is_autotext)
@ -796,7 +796,7 @@ int hg_scanner_400::writedown_device_configuration(bool type,HGSCANCONF_G400 *d)
len = sizeof(USBCB);
ret = io_->write_bulk(&usbcb,&len);
VLOG_MINI_1(LOG_LEVEL_WARNING, "writedown_device_configuration is .(%s)\n", hg_scanner::strerr((scanner_err)ret).c_str());
VLOG_MINI_1(LOG_LEVEL_WARNING, "writedown_device_configuration is .(%s)\n", hg_scanner_err_name(ret));
return ret;
}
@ -1185,7 +1185,7 @@ std::string hg_scanner_400::get_firmware_version()
std::lock_guard<std::mutex> lock(io_lock_);
ret = io_->read_bulk(buf, &len);
}
VLOG_MINI_2(LOG_LEVEL_DEBUG_INFO, "get serial num = %s, serial num = %s\n", hg_scanner::strerr((scanner_err)ret).c_str(), buf);
VLOG_MINI_2(LOG_LEVEL_DEBUG_INFO, "get serial num = %s, serial num = %s\n", hg_scanner_err_name(ret), buf);
return buf;
}

View File

@ -2,8 +2,6 @@
#include "../wrapper/hg_log.h"
#include <iostream>
#include "hg_scanner.h" // for hg_scanner::strerr
#define IF_CLASS(code, cls) \
if(code == cls) \
return #cls;
@ -497,7 +495,7 @@ void usb_manager::enum_endpoints(libusb_device* device, USBTRANSENDP* endp)
else
s = &ep->out; // = (conf->interface[j].altsetting[k].endpoint[l].bEndpointAddress & 3) | LIBUSB_ENDPOINT_OUT;
// NOTE: 这里应该尽量将输入输出端口统一到同一个接口上来,目前未做,只取第一个
// NOTE: 这里应该尽é‡<EFBFBD>将输入输出端å<EFBFBD>£ç»Ÿä¸€åˆ°å<EFBFBD>Œä¸€ä¸ªæŽ¥å<EFBFBD>£ä¸Šæ<EFBFBD>¥ï¼Œç®å‰<EFBFBD>未å<EFBFBD>šï¼Œå<EFBFBD>ªå<EFBFBD>第一ä¸?
if (s->port == usb_manager::uninit_uint8)
{
s->port = conf->interface[j].altsetting[k].endpoint[l].bEndpointAddress & (LIBUSB_ENDPOINT_IN | LIBUSB_ENDPOINT_OUT | 3);
@ -562,7 +560,7 @@ int usb_manager::open(libusb_device* device, usb_io** usbio, std::string* msg)
if (msg)
*msg = usb->init_error_msg();
usb->release();
VLOG_MINI_3(LOG_LEVEL_DEBUG_INFO, "Open %04x:%04x failed: %s\n", dev.vid, dev.pid, hg_scanner::strerr((scanner_err)err).c_str());
VLOG_MINI_3(LOG_LEVEL_DEBUG_INFO, "Open %04x:%04x failed: %s\n", dev.vid, dev.pid, hg_scanner_err_name(err));
return err;
}
@ -781,7 +779,7 @@ void usb_io::open(void)
}
last_err_ = usb_manager::usb_error_2_hg_err(ret);
VLOG_MINI_4(LOG_LEVEL_FATAL, "Open USB%u.%u-%s failed: %s\n", HIBYTE(dev_info_.ver), LOBYTE(dev_info_.ver) / 0x10, hg_log::format_ptr(dev_info_.device).c_str(), libusb_error_name(ret));
init_err_msg_ = hg_scanner::error_description((scanner_err)last_err_);
init_err_msg_ = hg_scanner_err_description(last_err_);
handle_ = NULL;
}
}
@ -792,7 +790,7 @@ bool usb_io::on_io_error(scanner_err err, usb_manager::USBSIMPLEX* endp)
if (err == SCANNER_ERR_TIMEOUT)
{
//因为在发送img参数出现timeout暂时禁用
//å ä¸ºåœ¨å<EFBFBD>é€<EFBFBD>imgå<EFBFBD>数出现timeout,æšæ—¶ç¦<EFBFBD>ç”?
// //LOG_INFO(LOG_LEVEL_DEBUG_INFO, "Operation timeout\n");
// libusb_clear_halt(handle_, endp->port);
@ -918,8 +916,8 @@ int usb_io::write_bulk(void* buf, int* len)
err = usb_manager::usb_error_2_hg_err(libusb_bulk_transfer(handle_, endpoints_.bulk.out.port, data, *len, &t, to_));
//VLOG_MINI_6(LOG_LEVEL_DEBUG_INFO, "First write port %x bulk %d/%d = %s(timeout = %d, packet size = %x)\n", endpoints_.bulk.out.port, t, *len, hg_scanner::strerr((scanner_err)err).c_str(), to_, endpoints_.bulk.out.max_packet);
// printf("First write port %x bulk %d/%d = %s(timeout = %d, packet size = %x)\n", endpoints_.bulk.out.port, t, *len, hg_scanner::strerr((scanner_err)err).c_str(), to_, endpoints_.bulk.out.max_packet);
//VLOG_MINI_6(LOG_LEVEL_DEBUG_INFO, "First write port %x bulk %d/%d = %s(timeout = %d, packet size = %x)\n", endpoints_.bulk.out.port, t, *len, hg_scanner_err_name((scanner_err)err).c_str(), to_, endpoints_.bulk.out.max_packet);
// printf("First write port %x bulk %d/%d = %s(timeout = %d, packet size = %x)\n", endpoints_.bulk.out.port, t, *len, hg_scanner_err_name((scanner_err)err).c_str(), to_, endpoints_.bulk.out.max_packet);
if (!on_io_error((scanner_err)err, &endpoints_.bulk.out))
{
*len = t;
@ -937,7 +935,7 @@ int usb_io::write_bulk(void* buf, int* len)
err = usb_manager::usb_error_2_hg_err(libusb_bulk_transfer(handle_, endpoints_.bulk.out.port, data, *len - total, &t, to_));
total += t;
}
//VLOG_MINI_3(LOG_LEVEL_DEBUG_INFO, "Last write bulk %d/%d = %s\n", total, *len, hg_scanner::strerr((scanner_err)err).c_str());
//VLOG_MINI_3(LOG_LEVEL_DEBUG_INFO, "Last write bulk %d/%d = %s\n", total, *len, hg_scanner_err_name((scanner_err)err).c_str());
*len = total;
last_err_ = err;