make AutoScan an empty protocol - fix bug-732

This commit is contained in:
gb 2023-11-27 17:02:32 +08:00
parent ef545cca20
commit fc972c5c41
1 changed files with 8 additions and 6 deletions

View File

@ -2553,19 +2553,21 @@ void huagao_ds::init_support_caps(void)
{ {
m_query[CapType::AutoScan] = msgSupportGetAllSetReset; m_query[CapType::AutoScan] = msgSupportGetAllSetReset;
m_caps[CapType::AutoScan] = [this](Msg msg, Capability& data)->Result { m_caps[CapType::AutoScan] = [this](Msg msg, Capability& data)->Result {
// HaoFenShu - an empty protocol, 2023-11-27
log_attr_access((int)CapType::AutoScan, (int)msg); log_attr_access((int)CapType::AutoScan, (int)msg);
if (Msg::Set == msg || Msg::Reset == msg) { if (Msg::Set == msg || Msg::Reset == msg) {
bool val = false; bool val = false;
if(Msg::Set == msg) if(Msg::Set == msg)
val = (bool)data.currentItem<CapType::AutoScan>(); val = (bool)data.currentItem<CapType::AutoScan>();
int ret = SANE_STATUS_GOOD; //int ret = SANE_STATUS_GOOD;
m_autoscan = val; m_autoscan = val;
SET_SANE_OPT_EX(ret, scanner_, scan_when_paper_on, &val); //SET_SANE_OPT_EX(ret, scanner_, scan_when_paper_on, &val);
return ret == SANE_STATUS_GOOD ? success() : badValue(); //return ret == SANE_STATUS_GOOD ? success() : badValue();
return success();
} }
std::vector<bool> all; //std::vector<bool> all;
GET_SANE_OPT_EX(bool, scanner_, scan_when_paper_on, NULL, &all); //GET_SANE_OPT_EX(bool, scanner_, scan_when_paper_on, NULL, &all);
m_autoscan = (bool)all[sane_opts::RANGE_POS_CURRENT]; //m_autoscan = (bool)all[sane_opts::RANGE_POS_CURRENT];
//return oneValGetSet<Bool>(msg, data, (Bool)all[sane_opts::RANGE_POS_CURRENT], 0); //return oneValGetSet<Bool>(msg, data, (Bool)all[sane_opts::RANGE_POS_CURRENT], 0);
//data = Capability::createOneValue<Bool>(CapType::AutoScan, (BYTE)all[sane_opts::RANGE_POS_CURRENT]); //data = Capability::createOneValue<Bool>(CapType::AutoScan, (BYTE)all[sane_opts::RANGE_POS_CURRENT]);
//return success(); //return success();