Merge branch 'dev' of http://192.168.10.5:8099/sane/code_device into dev
This commit is contained in:
commit
00f56eab54
|
@ -173,7 +173,7 @@ void shared_memory::init(void)
|
|||
first_ = !(GetLastError() == ERROR_ALREADY_EXISTS);
|
||||
obj_ = (void*)h;
|
||||
#else
|
||||
int obj = shmget(key_, bytes_, IPC_EXCL | IPC_CREAT | 0600);
|
||||
int obj = shmget(key_, bytes_, IPC_EXCL | IPC_CREAT | 0666);
|
||||
if (obj < 0)
|
||||
{
|
||||
unsigned int* v = (unsigned int*)&key_;
|
||||
|
|
|
@ -864,6 +864,9 @@ scanner_err hg_scanner_mgr::hg_scanner_get_parameter(scanner_handle h, const cha
|
|||
else
|
||||
return SCANNER_ERR_ACCESS_DENIED;
|
||||
}
|
||||
else if (strcmp(SANE_STD_OPT_NAME_CUSTOM_GAMMA, name) == 0)
|
||||
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)
|
||||
return SCANNER_ERR_DEVICE_NOT_SUPPORT;
|
||||
|
@ -943,6 +946,8 @@ scanner_err hg_scanner_mgr::hg_scanner_set_parameter(scanner_handle h, const cha
|
|||
|
||||
return SCANNER_ERR_ACCESS_DENIED;
|
||||
}
|
||||
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);
|
||||
}
|
||||
|
||||
return (scanner_err)SCAN_PTR(h)->set_setting(name, data, len);
|
||||
|
|
|
@ -394,6 +394,8 @@ namespace local_utility
|
|||
FIX_ID_TO_NAME(DEVICE_IP_ADDR, 255);
|
||||
FIX_ID_TO_NAME(DEVICE_MAC_ADDR, 255);
|
||||
|
||||
FIX_ID_TO_NAME(CUSTOM_GAMMA, sizeof(SANE_Gamma));
|
||||
|
||||
return "";
|
||||
}
|
||||
|
||||
|
@ -1357,17 +1359,21 @@ bool hg_sane_middleware::get_current_value(scanner_handle handle, const void* op
|
|||
|
||||
if(!name.empty())
|
||||
{
|
||||
char buf[256] = { 0 };
|
||||
long len = sizeof(buf) - 1;
|
||||
char *buf = new char[l + 4];
|
||||
long len = l;
|
||||
bool ret = false;
|
||||
|
||||
memcpy(buf, value, l);
|
||||
buf[l] = 0;
|
||||
if (hg_scanner_get_parameter(handle, name.c_str(), buf, &len) == SCANNER_ERR_OK)
|
||||
{
|
||||
setv(buf, len, value);
|
||||
|
||||
return true;
|
||||
ret = true;
|
||||
}
|
||||
delete[] buf;
|
||||
|
||||
return false;
|
||||
return ret;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1732,7 +1738,11 @@ SANE_Status hg_sane_middleware::set_option(SANE_Handle h, const void* option, SA
|
|||
else
|
||||
{
|
||||
SANE_Int id = -1;
|
||||
find_stored_descriptor(handle, option, &id);
|
||||
SANE_Option_Descriptor* desc = find_stored_descriptor(handle, option);
|
||||
if (desc &&
|
||||
(desc->type == SANE_TYPE_BUTTON || desc->type == SANE_TYPE_GROUP))
|
||||
return SANE_STATUS_UNSUPPORTED;
|
||||
|
||||
if (dev->std_opt && dev->std_opt->is_known_option(id))
|
||||
{
|
||||
dev->std_opt->get_value(h, id, value);
|
||||
|
@ -1744,7 +1754,24 @@ SANE_Status hg_sane_middleware::set_option(SANE_Handle h, const void* option, SA
|
|||
|
||||
return ret;
|
||||
}
|
||||
else
|
||||
else if (action == SANE_ACTION_GET_DEFAULT_VALUE)
|
||||
{
|
||||
SANE_Option_Descriptor* desc = find_stored_descriptor(handle, option);
|
||||
if (desc &&
|
||||
(desc->type == SANE_TYPE_BUTTON || desc->type == SANE_TYPE_GROUP))
|
||||
return SANE_STATUS_UNSUPPORTED;
|
||||
|
||||
int len = 0;
|
||||
void* val = get_default_value(handle, option, &len);
|
||||
if (!val)
|
||||
return SANE_STATUS_UNSUPPORTED;
|
||||
|
||||
memcpy(value, val, len);
|
||||
local_utility::free_memory(val);
|
||||
|
||||
return SANE_STATUS_GOOD;
|
||||
}
|
||||
else if(action == SANE_ACTION_SET_AUTO || action == SANE_ACTION_SET_VALUE)
|
||||
{
|
||||
SANE_Int id = -1;
|
||||
SANE_Option_Descriptor* desc = find_stored_descriptor(handle, option, &id);
|
||||
|
@ -1891,6 +1918,8 @@ SANE_Status hg_sane_middleware::set_option(SANE_Handle h, const void* option, SA
|
|||
|
||||
return status;
|
||||
}
|
||||
|
||||
return SANE_STATUS_INVAL;
|
||||
}
|
||||
bool hg_sane_middleware::get_cur_value(SANE_Handle handle, void* option, void* value, SANE_Value_Type* type)
|
||||
{
|
||||
|
|
Loading…
Reference in New Issue