diff --git a/code/base/test_base.cpp b/code/base/test_base.cpp index d19de01..ca5e3a8 100644 --- a/code/base/test_base.cpp +++ b/code/base/test_base.cpp @@ -510,19 +510,6 @@ public: { helper->register_sane_callback(sane_ex_callback, NULL); init_test_map_(); - std::string fw1(get_firmware_version()); - if (fw1.size() > 5) - { - if ("G1" == fw1.substr(0, 2)) - fw_ = 1; - else if ("G2" == fw1.substr(0, 2)) - fw_ = 2; - else if ("G3" == fw1.substr(0, 2)) - fw_ = 3; - else if ("G4" == fw1.substr(0, 2)) - fw_ = 4; - } - int a = 0; } ~test() {} @@ -573,7 +560,24 @@ public: } int set_test(const wchar_t* name,const wchar_t* oper) { - + + if (wcscmp(name, HGPDTTOOLDB_NAME_SET_JSON_SN) == 0 + || wcscmp(name, HGPDTTOOLDB_NAME_GET_DEVICE_CONFIG) == 0 + || wcscmp(name, HGPDTTOOLDB_NAME_CONFIGURE_SPEED_MODE) == 0) + { + std::string fw1(get_firmware_version()); + if (fw1.empty()) + { + if ("G1" == fw1.substr(0, 2)) + fw_ = 1; + else if ("G2" == fw1.substr(0, 2)) + fw_ = 2; + else if ("G3" == fw1.substr(0, 2)) + fw_ = 3; + else if ("G4" == fw1.substr(0, 2)) + fw_ = 4; + } + } if (!name) return SCANNER_ERR_NO_DATA; set_test_name_ = name; @@ -988,18 +992,18 @@ public: SANE_DISTORTION_VAL dis = { 0 }; while (ret == SCANNER_ERR_OK) { - if (is_distortion_get_image ) + if (is_distortion_get_image) { ret = helper_->io_control(IO_CTRL_CODE_GET_DISTORTION_CHECK_VAL, &dis, &llen); break; } - else if (cnt == 10) + else if (cnt == 30) break; Sleep(1000); cnt++; } - if (dis.h > 0) + if (dis.h > 0 && dis.h < 10) { helper_->test_callback(set_test_name_.c_str(), ui_helper::TEST_EVENT_DISTORTION_VAL, (void *)&dis, true); }