diff --git a/hgdriver/hgdev/hg_scanner_239.cpp b/hgdriver/hgdev/hg_scanner_239.cpp index 238cd6c..890107c 100644 --- a/hgdriver/hgdev/hg_scanner_239.cpp +++ b/hgdriver/hgdev/hg_scanner_239.cpp @@ -1653,7 +1653,7 @@ int hg_scanner_239::get_sleep_time(int& getime) getime = val; save_sleeptime_type_ = true; } - VLOG_MINI_2(LOG_LEVEL_DEBUG_INFO, "get_sleep_time %d= %s\n", val,hg_scanner_err_name(ret)); + VLOG_MINI_2(LOG_LEVEL_DEBUG_INFO, "get_sleep_time = %d with %s\n", val,hg_scanner_err_name(ret)); return ret; } diff --git a/hgsane/sane_hg_mdw.cpp b/hgsane/sane_hg_mdw.cpp index 3db50c6..1353359 100644 --- a/hgsane/sane_hg_mdw.cpp +++ b/hgsane/sane_hg_mdw.cpp @@ -1143,7 +1143,7 @@ bool hg_sane_middleware::get_current_value(scanner_handle handle, int option, vo return ret; } -void* hg_sane_middleware::get_default_value(scanner_handle handle, int option, int* bytes) +void* hg_sane_middleware::get_default_value(scanner_handle handle, int option, int* bytes, bool log) { std::string val(get_option_json(handle, option)); void* data = nullptr; @@ -1163,7 +1163,10 @@ void* hg_sane_middleware::get_default_value(scanner_handle handle, int option, i memcpy(data, &v, sizeof(v)); if (bytes) *bytes = sizeof(SANE_Bool); - VLOG_MINI_3(LOG_LEVEL_DEBUG_INFO, "option %d(%s) default value is: %s\n", option, title.c_str(), v ? "true" : "false"); + if (log) + { + VLOG_MINI_3(LOG_LEVEL_DEBUG_INFO, "option %d(%s) default value is: %s\n", option, title.c_str(), v ? "true" : "false"); + } } else if (val == "int") { @@ -1174,7 +1177,10 @@ void* hg_sane_middleware::get_default_value(scanner_handle handle, int option, i memcpy(data, &v, sizeof(v)); if (bytes) *bytes = sizeof(v); - VLOG_MINI_3(LOG_LEVEL_DEBUG_INFO, "option %d(%s) default value is: %d\n", option, title.c_str(), v); + if (log) + { + VLOG_MINI_3(LOG_LEVEL_DEBUG_INFO, "option %d(%s) default value is: %d\n", option, title.c_str(), v); + } } else if (val == "float") { @@ -1187,7 +1193,10 @@ void* hg_sane_middleware::get_default_value(scanner_handle handle, int option, i *bytes = sizeof(sd); memcpy(data, &sd, sizeof(sd)); - VLOG_MINI_3(LOG_LEVEL_DEBUG_INFO, "option %d(%s) default value is: %f\n", option, title.c_str(), v); + if (log) + { + VLOG_MINI_3(LOG_LEVEL_DEBUG_INFO, "option %d(%s) default value is: %f\n", option, title.c_str(), v); + } } else if (val == "string") { @@ -1203,7 +1212,10 @@ void* hg_sane_middleware::get_default_value(scanner_handle handle, int option, i strcpy((char*)data, val.c_str()); if (bytes) *bytes = val.length(); - VLOG_MINI_3(LOG_LEVEL_DEBUG_INFO, "option %d(%s) default value is: %s\n", option, title.c_str(), (char*)data); + if (log) + { + VLOG_MINI_3(LOG_LEVEL_DEBUG_INFO, "option %d(%s) default value is: %s\n", option, title.c_str(), (char*)data); + } } else { @@ -1562,14 +1574,14 @@ bool hg_sane_middleware::get_cur_value(SANE_Handle handle, int option, void* val return get_current_value(h, option, value, type); } -void* hg_sane_middleware::get_def_value(SANE_Handle handle, int option, int* bytes) +void* hg_sane_middleware::get_def_value(SANE_Handle handle, int option, int* bytes, bool log) { scanner_handle h = find_openning_device(handle); if (!h) return NULL; - return get_default_value(h, option, bytes); + return get_default_value(h, option, bytes, log); } SANE_Status hg_sane_middleware::io_control(SANE_Handle h, unsigned long code, void* data, unsigned* len) { diff --git a/hgsane/sane_hg_mdw.h b/hgsane/sane_hg_mdw.h index 99f586c..1cebd70 100644 --- a/hgsane/sane_hg_mdw.h +++ b/hgsane/sane_hg_mdw.h @@ -83,7 +83,7 @@ class hg_sane_middleware void reload_current_value(scanner_handle handle, std::vector* changed = NULL); bool get_current_value(scanner_handle handle, int option, void* value, SANE_Value_Type* type = NULL); - void* get_default_value(scanner_handle handle, int option, int* bytes = nullptr); // caller should call local_utility::free_memory to free the returned value + void* get_default_value(scanner_handle handle, int option, int* bytes = nullptr, bool log = false); // caller should call local_utility::free_memory to free the returned value /// /// 关联项处理 @@ -189,7 +189,7 @@ public: SANE_Option_Descriptor* get_option_descriptor(SANE_Handle h, SANE_Int option); SANE_Status set_option(SANE_Handle h, SANE_Int option, SANE_Action action, void* value, SANE_Int* after_do); bool get_cur_value(SANE_Handle handle, int option, void* value, SANE_Value_Type* type = NULL); // SANE_type - void* get_def_value(SANE_Handle handle, int option, int* bytes = nullptr); // caller should call local_utility::free_memory to free the returned value, SANE_type + void* get_def_value(SANE_Handle handle, int option, int* bytes = nullptr, bool log = false); // caller should call local_utility::free_memory to free the returned value, SANE_type // extension ... SANE_Status io_control(SANE_Handle h, unsigned long code, void* data, unsigned* len);