This commit is contained in:
13038267101 2023-06-17 16:53:53 +08:00
commit 640c0c0617
2 changed files with 24 additions and 4 deletions

View File

@ -908,7 +908,9 @@ scanner_err hg_scanner_mgr::hg_scanner_get_parameter(scanner_handle h, const cha
return (scanner_err)SCAN_PTR(h)->device_io_control(IO_CTRL_CODE_GET_CUSTOM_GAMMA, data, (unsigned int*)len);
if (strcmp(SANE_STD_OPT_NAME_LOGIN, name) == 0 ||
strcmp(SANE_STD_OPT_NAME_LOGOUT, name) == 0)
strcmp(SANE_STD_OPT_NAME_LOGOUT, name) == 0 ||
strcmp(SANE_STD_OPT_NAME_TRANSFORM_IMAGE_FORMAT, name) == 0 ||
strcmp(SANE_STD_OPT_NAME_FREE_BUFFER, name) == 0)
return SCANNER_ERR_DEVICE_NOT_SUPPORT;
if (strcmp(SANE_STD_OPT_NAME_ROLLER_LIFE, name) == 0)
@ -1002,6 +1004,20 @@ scanner_err hg_scanner_mgr::hg_scanner_set_parameter(scanner_handle h, const cha
}
else if (strcmp(SANE_STD_OPT_NAME_CUSTOM_GAMMA, name) == 0)
return (scanner_err)SCAN_PTR(h)->device_io_control(IO_CTRL_CODE_SET_CUSTOM_GAMMA, data, (unsigned int*)len);
else if (strcmp(SANE_STD_OPT_NAME_TRANSFORM_IMAGE_FORMAT, name) == 0)
{
return (scanner_err)SCAN_PTR(h)->device_io_control(IO_CTRL_CODE_CONVERT_IMAGE_FORMAT, data, (unsigned int*)len);
}
else if (strcmp(SANE_STD_OPT_NAME_FREE_BUFFER, name) == 0)
{
void* ptr = data ? *(void**)data : nullptr;
scanner_err ret = (scanner_err)SCAN_PTR(h)->device_io_control(IO_CTRL_CODE_FREE_MEMORY, ptr, (unsigned int*)len);
if (data)
*(void**)data = nullptr;
return ret;
}
}
return (scanner_err)SCAN_PTR(h)->set_setting(name, data, len);

View File

@ -400,6 +400,8 @@ namespace local_utility
FIX_ID_TO_NAME(ROLLER_LIFE, sizeof(SANE_Int));
FIX_ID_TO_NAME(CUSTOM_GAMMA, sizeof(SANE_Gamma));
FIX_ID_TO_NAME(TRANSFORM_IMAGE_FORMAT, sizeof(SANE_ImageFormatConvert));
FIX_ID_TO_NAME(FREE_BUFFER, sizeof(void*));
//FIX_ID_TO_NAME(LANGUAGE, 128);
return "";
@ -532,7 +534,7 @@ hg_sane_middleware::hg_sane_middleware(void) : opt_0_(nullptr), init_ok_(false)
if (lang_get_cur_code_page() != DEFAULT_CODE_PAGE)
lang_refresh_language();
// register_language_changed_notify(&hg_sane_middleware::language_changed, true); - called when reload_option
register_language_changed_notify(&hg_sane_middleware::language_changed, true);
#if !defined(WIN32) && !defined(_WIN64)
char path[512] = { 0 };
@ -1977,7 +1979,8 @@ SANE_Status hg_sane_middleware::set_option(SANE_Handle h, const void* option, SA
{
VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO, "the setting '%s' affects other options value, RELOAD ...\n", desc_title.c_str());
//on_SCANNER_ERR_CONFIGURATION_CHANGED(dev);
reload_options(handle);
if(dev->fixed_id.count(SANE_OPT_ID_LANGUAGE) && dev->fixed_id[SANE_OPT_ID_LANGUAGE] != id) // language reload by callback already
reload_options(handle);
err = (scanner_err)SANE_INFO_RELOAD_OPTIONS;
}
else if(err == SCANNER_ERR_RELOAD_IMAGE_PARAM)
@ -1989,7 +1992,8 @@ SANE_Status hg_sane_middleware::set_option(SANE_Handle h, const void* option, SA
{
VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO, "the setting '%s' affects image parameter and options, APP should re-get image info and reload options...\n", desc_title.c_str());
//on_SCANNER_ERR_CONFIGURATION_CHANGED(dev);
reload_options(handle);
if (dev->fixed_id.count(SANE_OPT_ID_LANGUAGE) && dev->fixed_id[SANE_OPT_ID_LANGUAGE] != id) // language reload by callback already
reload_options(handle);
err = (scanner_err)(SANE_INFO_RELOAD_PARAMS | SANE_INFO_RELOAD_OPTIONS);
}
else if (err == SCANNER_ERR_ACCESS_DENIED)