调整判断无纸状态出现奔溃
This commit is contained in:
parent
83e1c026a8
commit
b6065a4a3d
|
@ -1271,7 +1271,8 @@ void hg_scanner_239::thread_handle_usb_read(void)
|
|||
}
|
||||
if (status_ == SCANNER_ERR_DEVICE_STOPPED)
|
||||
{
|
||||
status_ = ret = get_scanner_paperon();
|
||||
SANE_Bool b = false;
|
||||
status_ = ret = get_scanner_paperon(&b);
|
||||
}
|
||||
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_));
|
||||
}
|
||||
|
|
|
@ -95,7 +95,7 @@ public:
|
|||
virtual int set_sleep_time(int setsleepime); //设置功耗模式(休眠)
|
||||
virtual int get_dogear_distance(void); //获取折角检测最小距离阈值
|
||||
virtual int set_dogear_distance(void); //设置折角检测最小距离阈值
|
||||
virtual int get_scanner_paperon(SANE_Bool* paperon = NULL);//获取设备有无纸张
|
||||
virtual int get_scanner_paperon(SANE_Bool* paperon);//获取设备有无纸张
|
||||
virtual int set_scan_when_paper_on(void); //获取是否为检测到进纸盘上有纸即开始扫描
|
||||
virtual int get_scan_when_paper_on(void); //设置是否为检测到进纸盘上有纸即开始扫描
|
||||
virtual int get_scan_with_hole(void); //获取是否为带孔扫描
|
||||
|
|
|
@ -112,7 +112,6 @@ using namespace std;
|
|||
#define __stdcall
|
||||
#endif
|
||||
|
||||
static int num=0;
|
||||
#define SAFE_DELETE(p){ \
|
||||
if (NULL != (p)) {delete []p; \
|
||||
(p) = NULL; \
|
||||
|
|
|
@ -35,18 +35,18 @@ static struct
|
|||
}
|
||||
g_supporting_devices[] = {
|
||||
#ifdef OEM_LISICHENG
|
||||
{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}
|
||||
, {0x31c9, PID_AND_NAME(8520, SCANNER_NAME_LSC_G52S), "G52S", "",&hg_scanner_mgr::create_scanner_g400}
|
||||
, {0x31c9, PID_AND_NAME(8529, SCANNER_NAME_LSC_G52S), "G52S", "",&hg_scanner_mgr::create_scanner_g239}
|
||||
, {0x31c9, PID_AND_NAME(8620, SCANNER_NAME_LSC_G62S), "G62S", "",&hg_scanner_mgr::create_scanner_g100}
|
||||
, {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(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}
|
||||
, {0x31c9, PID_AND_NAME(8520, SCANNER_NAME_LSC_G52S), "G52S", "", &hg_scanner_mgr::create_scanner_g400}
|
||||
, {0x31c9, PID_AND_NAME(8529, SCANNER_NAME_LSC_G52S), "G52S", "", &hg_scanner_mgr::create_scanner_g239}
|
||||
, {0x31c9, PID_AND_NAME(8620, SCANNER_NAME_LSC_G62S), "G62S", "", &hg_scanner_mgr::create_scanner_g100}
|
||||
, {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}
|
||||
|
||||
#elif defined(OEM_HANWANG)
|
||||
{0x2903, 0x1000, SCANNER_NAME_HW_1000, SCANNER_NAME_HW_1000, "",& hg_scanner_mgr::create_scanner_g300} // "HW-1060A"
|
||||
{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"
|
||||
|
@ -54,22 +54,22 @@ g_supporting_devices[] = {
|
|||
, {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"
|
||||
#elif defined(OEM_CANGTIAN)
|
||||
{0x3072, 0x0303, SCANNER_NAME_CT_303, SCANNER_NAME_CT_303, "",& hg_scanner_mgr::create_scanner_g300}
|
||||
{0x3072, 0x0303, SCANNER_NAME_CT_303, SCANNER_NAME_CT_303, "", &hg_scanner_mgr::create_scanner_g300}
|
||||
, {0x3072, 0x0404, SCANNER_NAME_CT_404, SCANNER_NAME_CT_404, "", &hg_scanner_mgr::create_scanner_g239}
|
||||
, {0x3072, 0x0238, SCANNER_NAME_CT_138, SCANNER_NAME_CT_138, "", &hg_scanner_mgr::create_scanner_g239}
|
||||
, {0x3072, 0x0138, SCANNER_NAME_CT_238, SCANNER_NAME_CT_238, "", &hg_scanner_mgr::create_scanner_g239}
|
||||
#else
|
||||
{0x3072, PID_AND_NAME(100, SCANNER_NAME_HG_G100), "G100", "",& 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(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_g239}
|
||||
, {0x064B, PID_AND_NAME(7823,SCANNER_NAME_HG_G200), "G200", "",&hg_scanner_mgr::create_scanner_g100}
|
||||
, {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_g239}
|
||||
, {0x064B, PID_AND_NAME(7823,SCANNER_NAME_HG_G200), "G200", "", &hg_scanner_mgr::create_scanner_g100}
|
||||
#endif
|
||||
};
|
||||
static std::string g_vendor = COMPANY_NAME;
|
||||
|
|
|
@ -281,7 +281,16 @@ namespace local_utility
|
|||
}
|
||||
int ui_cb(scanner_handle dev, int code, void* data, unsigned int* len, void* unused)
|
||||
{
|
||||
std::lock_guard<std::mutex> lck(cb_lock_);
|
||||
sane_callback cb_ui = NULL;
|
||||
void* cb_ui_parm = NULL;
|
||||
SANE_Auth_Callback cb_auth = NULL;
|
||||
|
||||
{
|
||||
std::lock_guard<std::mutex> lck(cb_lock_);
|
||||
cb_ui = cb_ui_;
|
||||
cb_ui_parm = cb_ui_parm_;
|
||||
cb_auth_ = cb_auth;
|
||||
}
|
||||
|
||||
if (SANE_EVENT_SUPPORT_ASYNC_IO == code)
|
||||
return cb_ui_ ? SCANNER_ERR_OK : SCANNER_ERR_DEVICE_NOT_SUPPORT;
|
||||
|
@ -290,14 +299,14 @@ namespace local_utility
|
|||
|
||||
// VLOG_MINI_1(LOG_LEVEL_ALL, "sane callback invoked of event %s\n", sane_event((SANE_Event)code).c_str());
|
||||
|
||||
if (cb_ui_)
|
||||
if (cb_ui)
|
||||
{
|
||||
return cb_ui_(h, code, data, len, cb_ui_parm_);
|
||||
return cb_ui(h, code, data, len, cb_ui_parm);
|
||||
}
|
||||
else if (cb_auth_ && code == SANE_EVENT_NEED_AUTH)
|
||||
else if (cb_auth && code == SANE_EVENT_NEED_AUTH)
|
||||
{
|
||||
SANEAUTH* auth = (SANEAUTH*)data;
|
||||
cb_auth_(auth->resource, auth->name, auth->pwd);
|
||||
cb_auth(auth->resource, auth->name, auth->pwd);
|
||||
}
|
||||
|
||||
return 0;
|
||||
|
|
Loading…
Reference in New Issue