升级在主线程当中做,会导致主线程阻塞,
This commit is contained in:
parent
1981657a36
commit
28ab768022
|
@ -223,8 +223,8 @@ hg_scanner::hg_scanner(ScannerSerial serial, const char* dev_name, usb_io* io, i
|
||||||
wait_img_.set_debug_info("Image");
|
wait_img_.set_debug_info("Image");
|
||||||
wait_usb_result_.set_debug_info("start");
|
wait_usb_result_.set_debug_info("start");
|
||||||
wait_devsislock_.set_debug_info("Devsislock");
|
wait_devsislock_.set_debug_info("Devsislock");
|
||||||
wait_read_int.set_debug_info("read_int");
|
//wait_read_int.set_debug_info("read_int");
|
||||||
thread_read_int_.reset(new std::thread(&hg_scanner::thread_read_int, this));
|
//thread_read_int_.reset(new std::thread(&hg_scanner::thread_read_int, this));
|
||||||
thread_usb_read_.reset(new std::thread(&hg_scanner::thread_handle_usb, this));
|
thread_usb_read_.reset(new std::thread(&hg_scanner::thread_handle_usb, this));
|
||||||
thread_img_handle_.reset(new std::thread(&hg_scanner::thread_image_handle, this));
|
thread_img_handle_.reset(new std::thread(&hg_scanner::thread_image_handle, this));
|
||||||
|
|
||||||
|
@ -239,8 +239,8 @@ hg_scanner::~hg_scanner()
|
||||||
close(true);
|
close(true);
|
||||||
|
|
||||||
hg_version_free_handle();
|
hg_version_free_handle();
|
||||||
if (thread_read_int_.get() && thread_read_int_->joinable())
|
//if (thread_read_int_.get() && thread_read_int_->joinable())
|
||||||
thread_read_int_->join();
|
// thread_read_int_->join();
|
||||||
if (thread_usb_read_.get() && thread_usb_read_->joinable())
|
if (thread_usb_read_.get() && thread_usb_read_->joinable())
|
||||||
thread_usb_read_->join();
|
thread_usb_read_->join();
|
||||||
if (thread_img_handle_.get() && thread_img_handle_->joinable())
|
if (thread_img_handle_.get() && thread_img_handle_->joinable())
|
||||||
|
@ -345,7 +345,7 @@ void hg_scanner::thread_devslock_handle(void)
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
is_firstopen_ = false;
|
is_firstopen_ = false;
|
||||||
is_read_int = false;
|
//is_read_int = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
//int ret = SCANNER_ERR_OK;
|
//int ret = SCANNER_ERR_OK;
|
||||||
|
@ -376,7 +376,7 @@ void hg_scanner::thread_read_int(void)
|
||||||
}
|
}
|
||||||
if (is_firstopen_)
|
if (is_firstopen_)
|
||||||
{
|
{
|
||||||
wait_devsislock_.notify();
|
//wait_devsislock_.notify();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -3186,8 +3186,10 @@ int hg_scanner::close(bool force)
|
||||||
run_ = false;
|
run_ = false;
|
||||||
wait_usb_.notify();
|
wait_usb_.notify();
|
||||||
wait_img_.notify();
|
wait_img_.notify();
|
||||||
|
|
||||||
|
if (thread_devslock_handle_.get())
|
||||||
wait_devsislock_.notify();
|
wait_devsislock_.notify();
|
||||||
wait_read_int.notify();
|
//wait_read_int.notify();
|
||||||
if(!scan_life_)
|
if(!scan_life_)
|
||||||
{
|
{
|
||||||
std::lock_guard<std::mutex> lock(io_lock_);
|
std::lock_guard<std::mutex> lock(io_lock_);
|
||||||
|
|
|
@ -172,10 +172,10 @@ hg_scanner_239::hg_scanner_239(const char* dev_name, int pid,usb_io* io) : hg_sc
|
||||||
hg_version_init_handle();
|
hg_version_init_handle();
|
||||||
init_version();
|
init_version();
|
||||||
|
|
||||||
//#ifdef OEM_HUAGAO
|
#ifdef OEM_HUAGAO
|
||||||
// wait_devsislock_.notify();
|
wait_devsislock_.notify();
|
||||||
//#endif
|
#endif
|
||||||
wait_read_int.notify();
|
//wait_read_int.notify();
|
||||||
}
|
}
|
||||||
hg_scanner_239::~hg_scanner_239()
|
hg_scanner_239::~hg_scanner_239()
|
||||||
{
|
{
|
||||||
|
|
|
@ -92,7 +92,7 @@ hg_scanner_300::hg_scanner_300(const char* dev_name,int pid, usb_io* io) : hg_sc
|
||||||
init_settings((jsontext3 + jsontext4 + jsontext5).c_str());
|
init_settings((jsontext3 + jsontext4 + jsontext5).c_str());
|
||||||
}
|
}
|
||||||
initdevice();
|
initdevice();
|
||||||
wait_read_int.notify();
|
//wait_read_int.notify();
|
||||||
}
|
}
|
||||||
hg_scanner_300::~hg_scanner_300()
|
hg_scanner_300::~hg_scanner_300()
|
||||||
{}
|
{}
|
||||||
|
@ -314,11 +314,11 @@ int hg_scanner_300::start(void)
|
||||||
|
|
||||||
final_imgs_.clear();
|
final_imgs_.clear();
|
||||||
|
|
||||||
if (is_read_int)
|
//if (is_read_int)
|
||||||
{
|
//{
|
||||||
VLOG_MINI_1(LOG_LEVEL_WARNING, "device status is(%s)\n", STATU_DESC_SCANNER_ERR_DEVICE_DEVS_BOOTING);
|
// VLOG_MINI_1(LOG_LEVEL_WARNING, "device status is(%s)\n", STATU_DESC_SCANNER_ERR_DEVICE_DEVS_BOOTING);
|
||||||
return SCANNER_ERR_DEVICE_DEVS_BOOTING;
|
// return SCANNER_ERR_DEVICE_DEVS_BOOTING;
|
||||||
}
|
//}
|
||||||
ret = get_scan_is_sleep(val);
|
ret = get_scan_is_sleep(val);
|
||||||
if (!val && ret == SCANNER_ERR_OK)
|
if (!val && ret == SCANNER_ERR_OK)
|
||||||
{
|
{
|
||||||
|
@ -729,7 +729,7 @@ int hg_scanner_300::initdevice()
|
||||||
}
|
}
|
||||||
if (status_ != SCANNER_ERR_DEVICE_SLEEPING)
|
if (status_ != SCANNER_ERR_DEVICE_SLEEPING)
|
||||||
{
|
{
|
||||||
/*string fw = get_firmware_version();
|
string fw = get_firmware_version();
|
||||||
if (!fw.empty())
|
if (!fw.empty())
|
||||||
{
|
{
|
||||||
if (fw.substr(4, 6) == "230303")
|
if (fw.substr(4, 6) == "230303")
|
||||||
|
@ -756,8 +756,9 @@ int hg_scanner_300::initdevice()
|
||||||
scanner_path = scanner_path.substr(0, scanner_path.size() - libname.size());
|
scanner_path = scanner_path.substr(0, scanner_path.size() - libname.size());
|
||||||
scanner_path += "update.zip";
|
scanner_path += "update.zip";
|
||||||
set_firmware_upgrade(scanner_path);
|
set_firmware_upgrade(scanner_path);
|
||||||
|
return SCANNER_ERR_OK;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}*/
|
|
||||||
}
|
}
|
||||||
if (status_ != SCANNER_ERR_DEVICE_SLEEPING)
|
if (status_ != SCANNER_ERR_DEVICE_SLEEPING)
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in New Issue