驱动日志操作,取消必须打开设备的前置条件

This commit is contained in:
gb 2023-07-29 14:24:06 +08:00
parent b489122048
commit e1ea8bbc14
1 changed files with 16 additions and 0 deletions

View File

@ -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);