This commit is contained in:
13038267101 2022-10-18 16:23:30 +08:00
commit 1b5f51516f
2 changed files with 21 additions and 1 deletions

View File

@ -84,6 +84,7 @@ int hg_scanner_mgr::ver_build_ = 0;
int hg_scanner_mgr::ver_patch_ = 1;
std::string hg_scanner_mgr::pe_path_("");
std::string hg_scanner_mgr::pe_name_("");
bool hg_scanner_mgr::read_over_with_eof_ = true;
hg_scanner_mgr::hg_scanner_mgr() : same_ind_(1)
{
@ -147,6 +148,24 @@ void hg_scanner_mgr::set_exe_name(const char* path, const char* name)
{
hg_scanner_mgr::pe_path_ = path ? path : "";
hg_scanner_mgr::pe_name_ = name ? name : "";
if (name && *name)
{
std::string eof(hg_log::ini_get("read_eof", name));
if (eof.empty())
hg_scanner_mgr::read_over_with_eof_ = STRICMP(name, "simple-scan") != 0 && STRICMP(name, "scanimage") != 0;
else
hg_scanner_mgr::read_over_with_eof_ = eof != "0";
}
else
{
std::string eof(hg_log::ini_get("read_eof", "first"));
if (eof.empty())
hg_scanner_mgr::read_over_with_eof_ = true;
else
hg_scanner_mgr::read_over_with_eof_ = eof != "0";
}
VLOG_MINI_1(LOG_LEVEL_ALL, "read image data end with EOF: %s\n", hg_scanner_mgr::read_over_with_eof_ ? "true" : "false");
}
std::string hg_scanner_mgr::get_pe_name(std::string* path)
{
@ -609,7 +628,7 @@ scanner_err hg_scanner_mgr::hg_scanner_open(scanner_handle* h, const char* name,
if (scanner)
{
scanner->set_ui_callback(&hg_scanner_mgr::ui_default_callback, hg_scanner_mgr::async_io_enabled_);
scanner->set_read_over_with_no_data(STRICMP(hg_scanner_mgr::pe_name_.c_str(), "xsane") == 0);
scanner->set_read_over_with_no_data(hg_scanner_mgr::read_over_with_eof_);
}
std::lock_guard<std::mutex> lock(mutex_dev_);

View File

@ -66,6 +66,7 @@ class hg_scanner_mgr
static std::string pe_path_;
static std::string pe_name_;
static bool read_over_with_eof_;
static int ver_major_;
static int ver_minor_;