|
|
@ -853,7 +853,7 @@ static const SCANNERID scanner_guid = MAKE_SCANNER_ID(PRODUCT_PID, PRODUCT_VID);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
static std::once_flag oc;
|
|
|
|
static std::once_flag oc;
|
|
|
|
huagao_ds::huagao_ds() : cur_head_(NULL), dpi_(200), xfer_ready_failed_(false), log_all_triple_(false), scanner_status_(SCANNER_STATUS_NOT_INIT)
|
|
|
|
huagao_ds::huagao_ds() : cur_head_(NULL), dpi_(200), xfer_ready_failed_(false), log_all_triple_(false), scanner_status_(SCANNER_STATUS_NOT_INIT),count_(-1)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
//std::call_once(oc, [&]() { log4cplus::Initializer(); });
|
|
|
|
//std::call_once(oc, [&]() { log4cplus::Initializer(); });
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -1742,7 +1742,17 @@ void huagao_ds::init_support_caps(void)
|
|
|
|
return badValue();
|
|
|
|
return badValue();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
int ret = SCANNER_ERR_OK;
|
|
|
|
int ret = SCANNER_ERR_OK;
|
|
|
|
int count = item;
|
|
|
|
int count = count_ = item;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
BYTE dup = 1;
|
|
|
|
|
|
|
|
std::vector<bool> all;
|
|
|
|
|
|
|
|
GET_SANE_OPT(bool, scanner_, ex_duplex, NULL, &all);
|
|
|
|
|
|
|
|
dup = all[sane_opts::RANGE_POS_CURRENT];
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (dup && count >= 2)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
count /= 2;
|
|
|
|
|
|
|
|
}
|
|
|
|
SET_SANE_OPT(ret, scanner_, scan_count, &count);
|
|
|
|
SET_SANE_OPT(ret, scanner_, scan_count, &count);
|
|
|
|
return ret == SCANNER_ERR_OK ? success() : badValue();
|
|
|
|
return ret == SCANNER_ERR_OK ? success() : badValue();
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -1750,6 +1760,16 @@ void huagao_ds::init_support_caps(void)
|
|
|
|
Int16 tmp_count = 0;
|
|
|
|
Int16 tmp_count = 0;
|
|
|
|
GET_SANE_OPT(int, scanner_, scan_count, NULL, &count);
|
|
|
|
GET_SANE_OPT(int, scanner_, scan_count, NULL, &count);
|
|
|
|
tmp_count = count[sane_opts::RANGE_POS_CURRENT];
|
|
|
|
tmp_count = count[sane_opts::RANGE_POS_CURRENT];
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
BYTE dup = 1;
|
|
|
|
|
|
|
|
std::vector<bool> all;
|
|
|
|
|
|
|
|
GET_SANE_OPT(bool, scanner_, ex_duplex, NULL, &all);
|
|
|
|
|
|
|
|
dup = all[sane_opts::RANGE_POS_CURRENT];
|
|
|
|
|
|
|
|
if (dup && tmp_count > 0 && tmp_count < 65535)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
tmp_count *= 2;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
return oneValGetSet<Int16>(msg, data, tmp_count, -1);
|
|
|
|
return oneValGetSet<Int16>(msg, data, tmp_count, -1);
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
@ -2234,14 +2254,35 @@ void huagao_ds::init_support_caps(void)
|
|
|
|
log_attr_access((int)CapType::DuplexEnabled, (int)msg);
|
|
|
|
log_attr_access((int)CapType::DuplexEnabled, (int)msg);
|
|
|
|
if (Msg::Set == msg) {
|
|
|
|
if (Msg::Set == msg) {
|
|
|
|
bool mech = data.currentItem<CapType::DuplexEnabled>();
|
|
|
|
bool mech = data.currentItem<CapType::DuplexEnabled>();
|
|
|
|
|
|
|
|
|
|
|
|
int ret = SCANNER_ERR_OK;
|
|
|
|
int ret = SCANNER_ERR_OK;
|
|
|
|
SET_SANE_OPT(ret, scanner_, ex_duplex, &mech);
|
|
|
|
SET_SANE_OPT(ret, scanner_, ex_duplex, &mech);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
int count = count_;
|
|
|
|
|
|
|
|
if (mech && count_ >= 2)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
count /= 2;
|
|
|
|
|
|
|
|
SET_SANE_OPT(ret, scanner_, scan_count, &count);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
else if (!mech && count_ >= 2)
|
|
|
|
|
|
|
|
SET_SANE_OPT(ret, scanner_, scan_count, &count);
|
|
|
|
|
|
|
|
|
|
|
|
return ret == SCANNER_ERR_OK ? success() : badValue();
|
|
|
|
return ret == SCANNER_ERR_OK ? success() : badValue();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
BYTE dup = 1;
|
|
|
|
BYTE dup = 1;
|
|
|
|
std::vector<bool> all;
|
|
|
|
std::vector<bool> all;
|
|
|
|
GET_SANE_OPT(bool, scanner_, ex_duplex, NULL, &all);
|
|
|
|
GET_SANE_OPT(bool, scanner_, ex_duplex, NULL, &all);
|
|
|
|
dup = all[sane_opts::RANGE_POS_CURRENT];
|
|
|
|
dup = all[sane_opts::RANGE_POS_CURRENT];
|
|
|
|
|
|
|
|
int ret = SCANNER_ERR_OK;
|
|
|
|
|
|
|
|
int count = count_;
|
|
|
|
|
|
|
|
if (dup && count_ >= 2)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
count /= 2;
|
|
|
|
|
|
|
|
SET_SANE_OPT(ret, scanner_, scan_count, &count);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
else if (!dup && count_ >= 2)
|
|
|
|
|
|
|
|
SET_SANE_OPT(ret, scanner_, scan_count, &count)
|
|
|
|
|
|
|
|
|
|
|
|
return CapSupGetAllReset<BYTE, Bool, CapType::DuplexEnabled>(msg, data, dup, Bool(true));
|
|
|
|
return CapSupGetAllReset<BYTE, Bool, CapType::DuplexEnabled>(msg, data, dup, Bool(true));
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|