fix BUG-264:超时错误不再改为正常

This commit is contained in:
gb 2022-08-18 14:50:43 +08:00
parent 2b651d7f69
commit f1e43a197f
5 changed files with 28 additions and 24 deletions

View File

@ -1155,11 +1155,7 @@ int hg_scanner_239::read_one_image_from_usb(SANE_Image_Statu statu)
}
else
{
char msg[128];
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);
VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO, "Read image data from USB err: %s\n", hg_scanner_err_name(ret));
}
}
}

View File

@ -1125,11 +1125,7 @@ int hg_scanner_439::read_one_image_from_usb(void)
}
else
{
char msg[128];
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);
VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO, "Read image data from USB err: %s\n", hg_scanner_err_name(ret));
}
}
}

View File

@ -12,6 +12,7 @@
#include "hg_scanner_239.h"
#include "hg_scanner_300.h"
#include "hg_scanner_400.h"
#include "hg_scanner_302.h"
#include "hg_scanner_402.h"
/// <summary>
@ -41,7 +42,7 @@ g_supporting_devices[] = {
{0x2903, 0x7000, SCANNER_NAME_HW_7000, "HW-74x0WA", "", &hg_scanner_mgr::create_scanner_g400}
, {0x2903, 0x7002, SCANNER_NAME_HW_7002, "HW-7002", "", &hg_scanner_mgr::create_scanner_g402}
, {0x2903, 0x1000, SCANNER_NAME_HW_1060A, "HW-1060A", "", &hg_scanner_mgr::create_scanner_g300}
, {0x2903, 0x1002, SCANNER_NAME_HW_1060A, "HW-1060A", "", &hg_scanner_mgr::create_scanner_g402}
, {0x2903, 0x1002, SCANNER_NAME_HW_1060A, "HW-1060A", "", &hg_scanner_mgr::create_scanner_g302}
, {0x2903, 0x8000, SCANNER_NAME_HW_8090F, "HW-8090F", "", &hg_scanner_mgr::create_scanner_g239}
, {0x2903, 0x9000, SCANNER_NAME_HW_9110F, "HW-9110F", "", &hg_scanner_mgr::create_scanner_g239}
, {0x2903, 0x7039, SCANNER_NAME_HW_7039F, "HW-7039F", "", &hg_scanner_mgr::create_scanner_g239}
@ -55,7 +56,7 @@ g_supporting_devices[] = {
, {0x3072, 0x339, SCANNER_NAME_HG_G339, "GScanO1003399", "", &hg_scanner_mgr::create_scanner_empty}
, {0x3072, 0x439, SCANNER_NAME_HG_G439, "GScanO1003399", "", &hg_scanner_mgr::create_scanner_g239}
, {0x064B, 0x7823, SCANNER_NAME_HG_G200, "GScanO200", "", &hg_scanner_mgr::create_scanner_empty}
, {0x3072, 0x302, SCANNER_NAME_HG_G300, "GScanO400", "", &hg_scanner_mgr::create_scanner_g402}
, {0x3072, 0x302, SCANNER_NAME_HG_G300, "GScanO400", "", &hg_scanner_mgr::create_scanner_g302}
, {0x3072, 0x402, SCANNER_NAME_HG_G402, "GScanO4003399", "", &hg_scanner_mgr::create_scanner_g402}
#endif
};
@ -168,6 +169,15 @@ hg_scanner* hg_scanner_mgr::create_scanner_g300(const char* name, usb_io* io, sc
return dynamic_cast<hg_scanner*>(s);
}
hg_scanner* hg_scanner_mgr::create_scanner_g302(const char* name, usb_io* io, scanner_handle* h)
{
hg_scanner_302* s = new hg_scanner_302(name, 0x402, io); // image_process needs PID 402, we should add 302 ...
if (h)
*h = s;
return dynamic_cast<hg_scanner*>(s);
}
hg_scanner* hg_scanner_mgr::create_scanner_g400(const char* name, usb_io* io, scanner_handle* h)
{
hg_scanner_400* s = new hg_scanner_400(name, 0x400, io);

View File

@ -1,4 +1,4 @@
#pragma once
#pragma once
#include "../../sdk/hginclude/huagaoxxx_warraper_ex.h"
#include "usb_manager.h"
@ -8,21 +8,21 @@
#include <mutex>
////////////////////////////////////////////////////////////////////////////////////////
// 设备需要支持的特性 (2022-02-24)
// 设备需要支持的特性 (2022-02-24)
//
// 1、每台设备应该有唯一的序列号并可读取用以精确定位连接到计算机上的每一台设备
// 方便多台设备连接到计算机上时,插拔后实现机器状态(配置参数)的自动恢复
// 1、每台设备应该有唯一的序列号并可读取用以精确定位连接到计算机上的每一台设备
// 方便多台设备连接到计算机上时,插拔后实现机器状态(配置参数)的自动恢复
//
// 2、设备启动后应该由设备上的驱动进行默认参数的设置以支持按键扫描功能由设备主动发起的扫描
// 2、设备启动后应该由设备上的驱动进行默认参数的设置以支持按键扫描功能由设备主动发起的扫描
//
// 3、设备的所有配置参数都应该可读以满足用户对设备实时状态的监控
// 3、设备的所有配置参数都应该可读以满足用户对设备实时状态的监控
//
// 4、设备要支持“reset”命令以使设备在发生软硬件错误时尽可能通过软件方式重置到正常状态
// 4、设备要支持“reset”命令以使设备在发生软硬件错误时尽可能通过软件方式重置到正常状态
//
// 5、可以考虑在每一段数据的前面添加数据头信息以表明这段数据的属性状态数据、图片数据……
// 为支持异步IO特性奠定基础
// 5、可以考虑在每一段数据的前面添加数据头信息以表明这段数据的属性状态数据、图片数据……
// 为支持异步IO特性奠定基础
//
// 6、设备的基本通信设备类型……信息访问需要保持健壮不能因为上位机的通信异常导致信息错乱
// 6、设备的基本通信设备类型……信息访问需要保持健壮不能因为上位机的通信异常导致信息错乱
//
////////////////////////////////////////////////////////////////////////////////////////
@ -92,6 +92,7 @@ public:
static hg_scanner* create_scanner_g100(const char* name, usb_io* io, scanner_handle* h);
static hg_scanner* create_scanner_g239(const char* name, usb_io* io, scanner_handle* h);
static hg_scanner* create_scanner_g300(const char* name, usb_io* io, scanner_handle* h);
static hg_scanner* create_scanner_g302(const char* name, usb_io* io, scanner_handle* h);
static hg_scanner* create_scanner_g400(const char* name, usb_io* io, scanner_handle* h);
static hg_scanner* create_scanner_g402(const char* name, usb_io* io, scanner_handle* h);

View File

@ -896,8 +896,9 @@ int usb_io::read_bulk(void* buf, int* len)
if (err == LIBUSB_ERROR_TIMEOUT && *len == total)
{
int old = to_;
if(to_ < 10 * 1000)
to_ *= 1.5f;
err = LIBUSB_SUCCESS;
//err = LIBUSB_SUCCESS;
VLOG_MINI_2(LOG_LEVEL_DEBUG_INFO, " Read full length, we consider it as success, and increament timeout from %d to %d\n", old, to_);
}
}