G402增加INT端点返回的错误代码转换

This commit is contained in:
gb 2022-08-02 16:32:46 +08:00
parent 1f8c93e105
commit e1c22f4bba
3 changed files with 38 additions and 3 deletions

View File

@ -1545,7 +1545,7 @@ void hg_scanner_239::thread_handle_usb_read(void)
}
status_ = st;
}
VLOG_MINI_1(LOG_LEVEL_WARNING, "扫描失败, read interrupt返回状态为%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_));
//notify_ui_working_status(("扫描失败 " + hg_scanner::error_description((scanner_err)status_)).c_str(), SANE_EVENT_ERROR, status_);
break;
}

View File

@ -1159,7 +1159,7 @@ int hg_scanner_402::pop_first_image(void)
return ret;
}
int hg_scanner_402::read_one_image_from_usb(void)
int hg_scanner_402::read_one_image_from_usb(SANE_Image_Statu statu)
{
int r = 0,
total = get_front_data_size(),
@ -1185,6 +1185,7 @@ int hg_scanner_402::read_one_image_from_usb(void)
return SCANNER_ERR_INSUFFICIENT_MEMORY;
// write reading command
buf->set_image_statu(statu);
ret = write_register(SR_IM_TX, 1);
if (ret == SCANNER_ERR_OK)
@ -1589,6 +1590,40 @@ void hg_scanner_402::thread_handle_usb_read(void)
to_cnt = 0;
if (size == sizeof(buf))
{
ret = settings402::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 (ret != SCANNER_ERR_OK && ret != SCANNER_ERR_TIMEOUT && ret != SCANNER_ERR_DEVICE_STOPPED)
{
if (!is_dev_image_process_done())
{
int st = ret, count = 0, statu = last_usb_image_statu(st);
while (!is_dev_image_process_done())
std::this_thread::sleep_for(std::chrono::milliseconds(30));
while ((count = get_image_count()) > 0)
{
int s = SANE_Image_Statu_OK;
if (count <= 2)
{
if (image_prc_param_.bits.page == PAGE_SINGLE)
s = count == 1 ? statu : s;
else
s = statu;
}
ret = read_one_image_from_usb((SANE_Image_Statu)s);
count++;
if (ret != SCANNER_ERR_OK
&& ret != SCANNER_ERR_CREATE_FILE_FAILED
&& ret != SCANNER_ERR_WRITE_FILE_FAILED)
break;
}
status_ = st;
}
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;
}
switch (info->From)
{
case IMG:

View File

@ -53,7 +53,7 @@ class hg_scanner_402 : public hg_scanner
int writedown_image_configuration(void);
int pop_first_image(void);
int read_one_image_from_usb(void);
int read_one_image_from_usb(SANE_Image_Statu statu = SANE_Image_Statu_OK);
void discard_all_images(void);
protected: