From 90c021bc645de4d5e5fd9c47bbfdf226a2171bab Mon Sep 17 00:00:00 2001 From: yangjiaxuan <171295266@qq.com> Date: Thu, 2 Nov 2023 15:31:32 +0800 Subject: [PATCH] =?UTF-8?q?twain=E5=8D=8F=E8=AE=AE=E5=A2=9E=E5=8A=A0?= =?UTF-8?q?=E8=84=8F=E6=B1=A1=E6=A3=80=E6=B5=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- sane/scanner.cpp | 13 +++++++++++++ twain/twain/huagaods.cpp | 3 ++- 2 files changed, 15 insertions(+), 1 deletion(-) diff --git a/sane/scanner.cpp b/sane/scanner.cpp index c5ad8bb..b7632bf 100644 --- a/sane/scanner.cpp +++ b/sane/scanner.cpp @@ -2926,6 +2926,18 @@ COM_API_IMPLEMENT(scanner, bool, get_option_info(int sn, value_type* type, value \ return true; \ } +#define SIMPLE_BOOL_INFO(id, rdo) \ + if (sn == id) \ + { \ + if (type) \ + *type = VAL_TYPE_BOOL; \ + if (limit) \ + *limit = rdo ? VAL_LIMIT_READONLY : VAL_LIMIT_NONE; \ + if (bytes) \ + *bytes = sizeof(int); \ + \ + return true; \ + } SIMPLE_STR_INFO(SANE_OPT_ID_DRIVER_VERSION, true); @@ -2951,6 +2963,7 @@ COM_API_IMPLEMENT(scanner, bool, get_option_info(int sn, value_type* type, value SIMPLE_INT_INFO(SANE_OPT_ID_PID, true); SIMPLE_INT_INFO(SANE_OPT_ID_ROLLER_LIFE, true); SIMPLE_STR_INFO(SANE_OPT_ID_INITIAL_BOOT_TIME, true); + SIMPLE_BOOL_INFO(SANE_OPT_ID_LENS_DIRTY, false); sn = transfer_id(sn); if (sn == -1) diff --git a/twain/twain/huagaods.cpp b/twain/twain/huagaods.cpp index bb7d26c..bab02c9 100644 --- a/twain/twain/huagaods.cpp +++ b/twain/twain/huagaods.cpp @@ -3530,7 +3530,8 @@ void huagao_ds::init_support_caps_ex(void) ADD_SANE_CAP(FOLD_TYPE); ADD_SANE_CAP(COLOR_CORRECTION); ADD_SANE_CAP(DISCARDBLANK); - + ADD_SANE_CAP(LENS_DIRTY); + #define GET_ONLY_CAP(name, ctype, ttype) \ m_query[(CapType)SANE_OPT_ID_##name] = MsgSupport::GetCurrent; \ m_caps[(CapType)SANE_OPT_ID_##name] = [this](Msg msg, Capability& data) -> Result { \