kopia lustrzana https://gitlab.com/sane-project/backends
test backend checks for options that have not been loaded before being controlled
rodzic
7ef8119579
commit
8733651c4b
|
@ -1,3 +1,6 @@
|
|||
2008-06-26 m. allan noah <kitno455 a t gmail d o t com>
|
||||
* backend/test.[ch]: check for options being controlled before loading
|
||||
|
||||
2008-06-25 Nicolas Martin <nicols-guest at users.alioth.debian.org>
|
||||
* backend/pixma_imageclass.c:
|
||||
Patch from Sam Varshavchik to deal with libusb 64 read issue,
|
||||
|
|
|
@ -295,6 +295,8 @@ init_options (Test_Device * test_device)
|
|||
od->constraint.range = 0;
|
||||
test_device->val[opt_num_opts].w = num_options;
|
||||
|
||||
test_device->loaded[opt_num_opts] = 1;
|
||||
|
||||
/* opt_mode_group */
|
||||
od = &test_device->opt[opt_mode_group];
|
||||
od->name = "";
|
||||
|
@ -1821,6 +1823,8 @@ sane_get_option_descriptor (SANE_Handle handle, SANE_Int option)
|
|||
return 0;
|
||||
}
|
||||
|
||||
test_device->loaded[option] = 1;
|
||||
|
||||
return &test_device->opt[option];
|
||||
}
|
||||
|
||||
|
@ -1861,6 +1865,12 @@ sane_control_option (SANE_Handle handle, SANE_Int option, SANE_Action action,
|
|||
return SANE_STATUS_INVAL;
|
||||
}
|
||||
|
||||
if (!test_device->loaded[option])
|
||||
{
|
||||
DBG (1, "sane_control_option: option not loaded\n");
|
||||
return SANE_STATUS_INVAL;
|
||||
}
|
||||
|
||||
if (!SANE_OPTION_IS_ACTIVE (test_device->opt[option].cap))
|
||||
{
|
||||
DBG (1, "sane_control_option: option is inactive\n");
|
||||
|
@ -2297,12 +2307,22 @@ sane_control_option (SANE_Handle handle, SANE_Int option, SANE_Action action,
|
|||
DBG (1, "sane_control_option: trying unexpected action %d\n", action);
|
||||
return SANE_STATUS_INVAL;
|
||||
}
|
||||
|
||||
if (info)
|
||||
*info = myinfo;
|
||||
|
||||
if(myinfo & SANE_INFO_RELOAD_OPTIONS){
|
||||
SANE_Int i = 0;
|
||||
for(i=1;i<num_options;i++){
|
||||
test_device->loaded[i] = 0;
|
||||
}
|
||||
}
|
||||
|
||||
DBG (4, "sane_control_option: finished, info=%s %s %s \n",
|
||||
myinfo & SANE_INFO_INEXACT ? "inexact" : "",
|
||||
myinfo & SANE_INFO_RELOAD_PARAMS ? "reload_parameters" : "",
|
||||
myinfo & SANE_INFO_RELOAD_OPTIONS ? "reload_options" : "");
|
||||
|
||||
return SANE_STATUS_GOOD;
|
||||
}
|
||||
|
||||
|
|
|
@ -124,6 +124,7 @@ typedef struct Test_Device
|
|||
SANE_Device sane;
|
||||
SANE_Option_Descriptor opt[num_options];
|
||||
Option_Value val[num_options];
|
||||
SANE_Bool loaded[num_options];
|
||||
SANE_Parameters params;
|
||||
SANE_String name;
|
||||
SANE_Pid reader_pid;
|
||||
|
|
Ładowanie…
Reference in New Issue