调整G439 校正问题

This commit is contained in:
13038267101 2023-12-18 08:50:55 +08:00
parent e2abedf820
commit f0c1287ddb
3 changed files with 79 additions and 44 deletions

View File

@ -1147,7 +1147,7 @@ void hg_scanner_239::thread_correction(void)
{
StopWatch sw;
unsigned char buf[64];
//setting3399::HGEIntInfo* info = (setting3399::HGEIntInfo*)buf;
setting3399::HGEIntInfo* info = (setting3399::HGEIntInfo*)buf;
int size = sizeof(buf);
int ret = SCANNER_ERR_OK;
@ -1158,20 +1158,17 @@ void hg_scanner_239::thread_correction(void)
memset(buf, 0, sizeof(buf));
{
std::lock_guard<std::mutex> lock(io_lock_);
io_->set_timeout(2000);
ret = io_->read_interrupt(buf, &size);
io_->set_timeout(1000);
printf("size:%d\r\n",size);
}
if (ret == SCANNER_ERR_TIMEOUT)
{
if (autoFaltFinish || sw.elapsed_s() > 60)
if (sw.elapsed_s() > 60)
{
is_auto_falt = false;
status_ = SCANNER_ERR_DEVICE_AUTO_FAIL_OVER;
//notify_ui_working_status(hg_log::lang_load(ID_STATU_DESC_SCANNER_ERR_DEVICE_FAIL_OUTTIME), SANE_EVENT_ERROR, ret); // 通信超时
VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO, "校正是否真正结束: %s\n", autoFaltFinish ? "true" : "false");
VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO, "设备校正超时 '%s'\n", hg_scanner_err_name(status_));
break;
}
@ -1180,36 +1177,35 @@ void hg_scanner_239::thread_correction(void)
}
if (size == sizeof(buf))
{
setting3399::HGEIntInfo info = *(setting3399::HGEIntInfo*)&buf;
if (setting3399::AutoCorrect == info.From)
//setting3399::HGEIntInfo info = *(setting3399::HGEIntInfo*)&buf;
if (setting3399::AutoCorrect == info->From)
{
std::lock_guard<std::mutex> lock(io_lock_);
status_ == SCANNER_ERR_DEVICE_AUTO_FAIL_INFO;
sw.reset();
std::string sinfo;
int len = info.Img_Index;
int len = info->Img_Index;
sinfo.resize(len);
{
std::lock_guard<std::mutex> lock(io_lock_);
ret = io_->read_bulk(&sinfo[0], &len);
}
io_->read_bulk(&sinfo[0],&len);
char buf[2048];
strcpy(buf, sinfo.c_str());
notify_ui_working_status(buf, SANE_EVENT_STATUS, status_);
printf("%s\r\n", sinfo.c_str());
if (ret)
{
status_ = ret;
VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO, "设备校正失败 io 错误返回码return Code: %d \n",ret);
break;
}
notify_ui_working_status(sinfo.c_str(), SANE_EVENT_STATUS, status_);
if (info.Code == 4)
if ((info->Code == 4 )|| (NULL != strstr(sinfo.c_str(), "******Correct Done******")))
{
is_auto_falt = false;
status_ = SCANNER_ERR_DEVICE_AUTO_FAIL_OVER;
VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO, "固件层判断校正结束返回码return Code: %d \n", info.Code);
//notify_ui_working_status(buf, SANE_EVENT_STATUS, status_);
VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO, "固件层判断校正结束返回码return Code: %d \n", info->Code);
break;
}
if (NULL != strstr(sinfo.c_str(), "******Correct Done******"))
{
VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO, "Recived : ******Correct Done****** , return Code: %d \n", info.Code);
autoFaltFinish = true;
}
//break;
}
}

View File

@ -34,6 +34,7 @@ static struct
std::string rsc; // USB resource, version-addr. e.g. "USB2.0-1"
hg_scanner* (* create_scanner)(const char*, usb_io*, scanner_handle*);
}
#define OEM_NEUTRAL
g_supporting_devices[] = {
#ifdef OEM_LISICHENG
#ifdef LISICHENG_SPECIAL
@ -80,17 +81,28 @@ g_supporting_devices[] = {
{0x32ec, 0x0200, SANNNER_NAME_ZG_Q7110,"Q7110", "", & hg_scanner_mgr::create_scanner_g239}
, {0x32ec, 0x0210, SANNNER_NAME_ZG_Q1070, "Q1070", "", &hg_scanner_mgr::create_scanner_g402}
#elif defined(OEM_NEUTRAL)
{0x3072, PID_AND_NAME(100, SCANNER_NAME_HGNEU_G100), "G100", "",& hg_scanner_mgr::create_scanner_g100}
, {0x3072, PID_AND_NAME(139, SCANNER_NAME_HGNEU_G100), "G100", "", &hg_scanner_mgr::create_scanner_g239}
, {0x3072, PID_AND_NAME(200, SCANNER_NAME_HGNEU_G200), "G200", "", &hg_scanner_mgr::create_scanner_g100}
, {0x3072, PID_AND_NAME(239, SCANNER_NAME_HGNEU_G200), "G200", "", &hg_scanner_mgr::create_scanner_g239}
, {0x3072, PID_AND_NAME(300, SCANNER_NAME_HGNEU_G300), "G300", "", &hg_scanner_mgr::create_scanner_g300}
, {0x3072, PID_AND_NAME(302, SCANNER_NAME_HGNEU_G300), "G300", "", &hg_scanner_mgr::create_scanner_g302}
, {0x3072, PID_AND_NAME(339, SCANNER_NAME_HGNEU_G300), "G300", "", &hg_scanner_mgr::create_scanner_empty}
, {0x3072, PID_AND_NAME(400, SCANNER_NAME_HGNEU_G400), "G400", "", &hg_scanner_mgr::create_scanner_g400}
, {0x3072, PID_AND_NAME(402, SCANNER_NAME_HGNEU_G400), "G400", "", &hg_scanner_mgr::create_scanner_g402}
, {0x3072, PID_AND_NAME(439, SCANNER_NAME_HGNEU_G400), "G400", "", &hg_scanner_mgr::create_scanner_g439}
, {0x064B, PID_AND_NAME(7823,SCANNER_NAME_HGNEU_G200), "G200", "", &hg_scanner_mgr::create_scanner_g100}
{0x3072, PID_AND_NAME(100, SCANNER_NAME_HG_G100), "G100", "",& hg_scanner_mgr::create_scanner_g100}
, {0x3072, PID_AND_NAME(139, SCANNER_NAME_HG_G100), "G100", "", &hg_scanner_mgr::create_scanner_g239}
, {0x3072, PID_AND_NAME(200, SCANNER_NAME_HG_G200), "G200", "", &hg_scanner_mgr::create_scanner_g100}
, {0x3072, PID_AND_NAME(239, SCANNER_NAME_HG_G200), "G200", "", &hg_scanner_mgr::create_scanner_g239}
, {0x3072, PID_AND_NAME(300, SCANNER_NAME_HG_G300), "G300", "", &hg_scanner_mgr::create_scanner_g300}
, {0x3072, PID_AND_NAME(302, SCANNER_NAME_HG_G300), "G300", "", &hg_scanner_mgr::create_scanner_g302}
, {0x3072, PID_AND_NAME(339, SCANNER_NAME_HG_G300), "G300", "", &hg_scanner_mgr::create_scanner_empty}
, {0x3072, PID_AND_NAME(400, SCANNER_NAME_HG_G400), "G400", "", &hg_scanner_mgr::create_scanner_g400}
, {0x3072, PID_AND_NAME(402, SCANNER_NAME_HG_G400), "G400", "", &hg_scanner_mgr::create_scanner_g402}
, {0x3072, PID_AND_NAME(439, SCANNER_NAME_HG_G400), "G400", "", &hg_scanner_mgr::create_scanner_g439}
, {0x3072, PID_AND_NAME(306, SCANNER_NAME_HG_G300), "G300", "", &hg_scanner_mgr::create_scanner_g306}
, {0x064B, PID_AND_NAME(7823,SCANNER_NAME_HG_G300), "G300", "", &hg_scanner_mgr::create_scanner_g300}
, {0x064B, PID_AND_NAME(7823,SCANNER_NAME_HG_G200), "G200", "", &hg_scanner_mgr::create_scanner_g100}
, {0x064B, PID_AND_NAME(7823,SCANNER_NAME_HG_G300), "G400", "", &hg_scanner_mgr::create_scanner_g400}
, {0x31c9, PID_AND_NAME(8426, SCANNER_NAME_LSC_G42S), "G4245F", "",& hg_scanner_mgr::create_scanner_g300}
, {0x31c9, PID_AND_NAME(8626, SCANNER_NAME_LSC_G62S), "G6290U", "", &hg_scanner_mgr::create_scanner_g239}
, {0x31c9, PID_AND_NAME(8200, SCANNER_NAME_LSC_G42S), "G42S", "",& hg_scanner_mgr::create_scanner_g300}
, {0x31c9, PID_AND_NAME(8420, SCANNER_NAME_LSC_G42S), "G42S", "", &hg_scanner_mgr::create_scanner_g300}
, {0x31c9, PID_AND_NAME(8429, SCANNER_NAME_LSC_G42S), "G42S", "", &hg_scanner_mgr::create_scanner_empty}
@ -100,16 +112,41 @@ g_supporting_devices[] = {
, {0x31c9, PID_AND_NAME(8629, SCANNER_NAME_LSC_G62S), "G62S", "", &hg_scanner_mgr::create_scanner_g239}
, {0x31c9, PID_AND_NAME(8730, SCANNER_NAME_LSC_G73S), "G73S", "", &hg_scanner_mgr::create_scanner_g100}
, {0x31c9, PID_AND_NAME(8739, SCANNER_NAME_LSC_G73S), "G73S", "", &hg_scanner_mgr::create_scanner_g239}
, {0x32ec, 0x0200, SANNNER_NAME_ZG_Q7110,"", "",& hg_scanner_mgr::create_scanner_g239}
, {0x32ec, 0x0210, SANNNER_NAME_ZG_Q1070, "", "", &hg_scanner_mgr::create_scanner_g402}
, {0X05DA, 0x9220, SCANNER_NAME_ZJ_6570, "S6570", "",&hg_scanner_mgr::create_scanner_g439}
, {0x2903, 0x1000, SCANNER_NAME_HW_1000, SCANNER_NAME_HW_1000, "",& hg_scanner_mgr::create_scanner_g300} // "HW-1060A"
, {0x2903, 0x1002, SCANNER_NAME_HW_1002, SCANNER_NAME_HW_1002, "", &hg_scanner_mgr::create_scanner_g302} // "HW-1060A"
, {0x2903, 0x7000, SCANNER_NAME_HW_7000, SCANNER_NAME_HW_7000, "", &hg_scanner_mgr::create_scanner_g400} // "HW-74x0WA"
, {0x2903, 0x7002, SCANNER_NAME_HW_7002, SCANNER_NAME_HW_7002, "", &hg_scanner_mgr::create_scanner_g402} // "HW-7002"
, {0x2903, 0x7039, SCANNER_NAME_HW_7039, SCANNER_NAME_HW_7039, "", &hg_scanner_mgr::create_scanner_g439} // "HW-7039F"
, {0x2903, 0x8000, SCANNER_NAME_HW_8000, SCANNER_NAME_HW_8000, "", &hg_scanner_mgr::create_scanner_g239} // "HW-8090F"
, {0x2903, 0x9000, SCANNER_NAME_HW_9000, SCANNER_NAME_HW_9000, "", &hg_scanner_mgr::create_scanner_g239} // "HW-9110E"
, {0x3072, 0x0303, SCANNER_NAME_CT_4520, SCANNER_NAME_CT_4520, "",& hg_scanner_mgr::create_scanner_g300}
, {0x3072, 0x0403, SCANNER_NAME_CT_138, SCANNER_NAME_CT_138, "", &hg_scanner_mgr::create_scanner_g439}
, {0x3072, 0x0138, SCANNER_NAME_CT_138, SCANNER_NAME_CT_138, "", &hg_scanner_mgr::create_scanner_g239}
, {0x3072, 0x0238, SCANNER_NAME_CT_138, SCANNER_NAME_CT_138, "", &hg_scanner_mgr::create_scanner_g239}
, {0x3308, 0x0138, SCANNER_NAME_CT_138, SCANNER_NAME_CT_138, "", &hg_scanner_mgr::create_scanner_g239}
, {0x3308, 0x0238, SCANNER_NAME_CT_238, SCANNER_NAME_CT_238, "", &hg_scanner_mgr::create_scanner_g239}
, {0x3308, 0x6006, SCANNER_NAME_CT_9020, SCANNER_NAME_CT_9020, "", &hg_scanner_mgr::create_scanner_g239}
, {0x3308, 0x6005, SCANNER_NAME_CT_4520, SCANNER_NAME_CT_4520, "", &hg_scanner_mgr::create_scanner_g300}
, {0X05DA, 0x9220, SCANNER_NAME_ZJ_6570, "S6570", "",& hg_scanner_mgr::create_scanner_g439}
, {0X05DA, 0x9222, SCANNER_NAME_ZJ_8790, "S8790", "",&hg_scanner_mgr::create_scanner_g239}
, {0X05DA, 0x9223, SCANNER_NAME_ZJ_500DC, "S500DC", "",&hg_scanner_mgr::create_scanner_g239}
, {0x3308, 0x6006, SCANNER_NAME_CT_9020, SCANNER_NAME_CT_9020, "",& hg_scanner_mgr::create_scanner_g239}
, {0x3308, 0x6005, SCANNER_NAME_CT_4520, SCANNER_NAME_CT_4520, "", &hg_scanner_mgr::create_scanner_g300}
, {0x3308, 0x0238, SCANNER_NAME_CT_138, SCANNER_NAME_CT_138, "", &hg_scanner_mgr::create_scanner_g239}
, {0x3308, 0x0138, SCANNER_NAME_CT_238, SCANNER_NAME_CT_238, "", &hg_scanner_mgr::create_scanner_g239}
, {0x3072, 0x0303, SCANNER_NAME_CT_4520, SCANNER_NAME_CT_4520, "", &hg_scanner_mgr::create_scanner_g300}
, {0x32ec, 0x0200, SANNNER_NAME_ZG_Q7110,"Q7110", "",& hg_scanner_mgr::create_scanner_g239}
, {0x32ec, 0x0210, SANNNER_NAME_ZG_Q1070, "Q1070", "", &hg_scanner_mgr::create_scanner_g402}
, { 0x300E, PID_AND_NAME(401C, SANNER_NAME_DL_S3000), "S3000", "", &hg_scanner_mgr::create_scanner_g239 }
, { 0x300E, PID_AND_NAME(4020, SANNER_NAME_DL_S3400), "S3000", "", &hg_scanner_mgr::create_scanner_g239 }
, { 0x300E, PID_AND_NAME(4015, SANNER_NAME_DL_S2000), "S2000", "", &hg_scanner_mgr::create_scanner_g300 }
, { 0x300E, PID_AND_NAME(4019, SANNER_NAME_DL_DL9000), "DL9000", "", &hg_scanner_mgr::create_scanner_g439 }
#elif defined(OEM_DELI)
{0x300E, PID_AND_NAME(401C, SANNER_NAME_DL_S3000), "S3000", "", &hg_scanner_mgr::create_scanner_g239}
, {0x300E, PID_AND_NAME(4020, SANNER_NAME_DL_S3400), "S3000", "", &hg_scanner_mgr::create_scanner_g239}

View File

@ -281,6 +281,7 @@ extern "C"
RETURN_IF(err, SCANNER_ERR_DEVICE_DEVS_BOOTING);
RETURN_IF(err, SCANNER_ERR_DEVICE_UNKNOWN_STATUS);
RETURN_IF(err, SCANNER_ERR_DEVICE_LENS_DIRTY);
RETURN_IF(err, SCANNER_ERR_DEVICE_AUTO_FAIL_OVER);
if (err == SCANNER_ERR_LANG_PAK_LOST)
return "SCANNER_ERR_LANG_PAK_LOST";
@ -360,6 +361,7 @@ extern "C"
RETURN_DESC_IF(err, SCANNER_ERR_DEVICE_DEVS_BOOTING);
RETURN_DESC_IF(err, SCANNER_ERR_DEVICE_UNKNOWN_STATUS);
RETURN_DESC_IF(err, SCANNER_ERR_DEVICE_LENS_DIRTY);
RETURN_DESC_IF(err, SCANNER_ERR_DEVICE_AUTO_FAIL_OVER);
if (err == SCANNER_ERR_LANG_PAK_LOST)
return "SCANNER_ERR_LANG_PAK_LOST";