diff --git a/hgsane/sane_hg_mdw.cpp b/hgsane/sane_hg_mdw.cpp index 272fde2..7a8029e 100644 --- a/hgsane/sane_hg_mdw.cpp +++ b/hgsane/sane_hg_mdw.cpp @@ -1768,6 +1768,22 @@ SANE_Option_Descriptor* hg_sane_middleware::get_option_descriptor(SANE_Handle h, } SANE_Status hg_sane_middleware::set_option(SANE_Handle h, const void* option, SANE_Action action, void* value, SANE_Int* after_do) { + if ((IS_PTR_NUMBER(option) && (int)option == SANE_OPT_ID_DRIVER_LOG) || + (!IS_PTR_NUMBER(option) && strcmp((const char*)option, SANE_STD_OPT_NAME_DRIVER_LOG) == 0)) + { + // omit value of 'h' ... + long id = SANE_OPT_ID_DRIVER_LOG, + l = 0; + std::string name(local_utility::un_json_option_name(id, (int*)&l)); + + if (action == SANE_ACTION_GET_VALUE) + return local_utility::scanner_err_2_sane_statu(hg_scanner_get_parameter(h, SANE_STD_OPT_NAME_DRIVER_LOG, (char*)value, &l)); + else if (action == SANE_ACTION_SET_VALUE) + return local_utility::scanner_err_2_sane_statu(hg_scanner_set_parameter(h, SANE_STD_OPT_NAME_DRIVER_LOG, (char*)value, &l)); + else + return SANE_STATUS_INVAL; + } + LPDEVINST dev = nullptr; scanner_handle handle = find_openning_device(h, false, &dev);