From 890d4a1c787fc520c33f58b04839b546776ae242 Mon Sep 17 00:00:00 2001 From: gb <741021719@qq.com> Date: Wed, 23 Aug 2023 10:22:31 +0800 Subject: [PATCH] add get version of driver API --- hgsane/main.c | 5 +++++ hgsane/sane_hg_mdw.cpp | 13 +++++++++++++ 2 files changed, 18 insertions(+) diff --git a/hgsane/main.c b/hgsane/main.c index 0eebb09..c5f8e21 100644 --- a/hgsane/main.c +++ b/hgsane/main.c @@ -25,6 +25,7 @@ extern SANE_Status inner_sane_init_ex(SANE_Int* version_code, sane_callback cb, extern SANE_Status inner_sane_io_control(SANE_Handle h, unsigned long code, void* data, unsigned* len); extern const char* inner_sane_err_desc(SANE_Status err); extern SANE_Status inner_sane_read_ext(SANE_Img_Ext_Info* ext_info, SANE_Int* len); +extern SANE_Status inner_sane_ex_get_driver_version(SANE_Int* hh, SANE_Int* hl, SANE_Int* lh, SANE_Int* ll); /// /// 导出接口 @@ -114,3 +115,7 @@ SANE_Status sane_read_ext_info(SANE_Img_Ext_Info* ext_info, SANE_Int* len) { return inner_sane_read_ext(ext_info, len); } +SANE_Status sane_ex_get_driver_version(SANE_Int* hh, SANE_Int* hl, SANE_Int* lh, SANE_Int* ll) +{ + return inner_sane_ex_get_driver_version(hh, hl, lh, ll); +} diff --git a/hgsane/sane_hg_mdw.cpp b/hgsane/sane_hg_mdw.cpp index 0fe4d27..b21f76a 100644 --- a/hgsane/sane_hg_mdw.cpp +++ b/hgsane/sane_hg_mdw.cpp @@ -2628,6 +2628,19 @@ extern "C" { // avoid compiler exporting name in C++ style !!! { return SANE_STATUS_UNSUPPORTED; } + SANE_Status inner_sane_ex_get_driver_version(SANE_Int* hh, SANE_Int* hl, SANE_Int* lh, SANE_Int* ll) + { + if (hh) + *hh = VERSION_MAJOR; + if (hl) + *hl = VERSION_MINOR; + if (lh) + *lh = VERSION_YEAR; + if (ll) + *ll = GET_BUILD_VER; + + return SANE_STATUS_GOOD; + } void sanei_debug_msg(int level, int max_level, const char* be, const char* fmt, va_list ap) {