- add a 'sensornumber' option to override sensor detection

merge-requests/1/head
Stéphane Voltz 2008-10-02 19:54:52 +00:00
rodzic 5de0ac3014
commit 0214a5091b
4 zmienionych plików z 47 dodań i 8 usunięć

Wyświetl plik

@ -1,3 +1,7 @@
2008-10-02 Stéphane Voltz <stef.dev@free.fr>
* backend/rts8891.c backend/rts8891.h backend/rts8891_low.h:
add a 'sensornumber' option to override detected sensor model
2008-10-02 m. allan noah <kitno455 a t gmail d o t com>
* doc/descriptions-external/epkowa.desc:
- iscan 2.12.0 updates from olaf.meeuwissen@avasys.jp

Wyświetl plik

@ -118,7 +118,7 @@
/* #define FAST_INIT 1 */
#define BUILD 6
#define BUILD 7
#define MOVE_DPI 100
@ -166,21 +166,28 @@ static SANE_Range x_range = {
static SANE_Range y_range = {
SANE_FIX (0.0), /* minimum */
SANE_FIX (299.0), /* maximum */
SANE_FIX (0.0) /* quantization */
SANE_FIX (0.0) /* no quantization */
};
/* model number ranges from 0 to 2, must be cvhnaged if
/* model number ranges from 0 to 2, must be changed if
* Rts8891_USB_Device_Entry changes */
static const SANE_Range model_range = {
0, /* minimum */
2, /* maximum */
0 /* quantization */
0 /* no quantization */
};
/* sensor number ranges from 0 to SENSOR_TYPE_MAX, must be changed if */
static const SANE_Range sensor_range = {
0, /* minimum */
SENSOR_TYPE_MAX, /* maximum */
0 /* no quantization */
};
static const SANE_Range u8_range = {
0, /* minimum */
255, /* maximum */
0 /* quantization */
0 /* no quantization */
};
static const SANE_Range threshold_percentage_range = {
@ -2236,6 +2243,7 @@ probe_rts8891_devices (void)
/* sharing is on by default and no model option */
rtscfg.allowsharing = SANE_TRUE;
rtscfg.modelnumber = -1;
rtscfg.sensornumber = -1;
/* initialize configuration options */
options[CFG_MODEL_NUMBER] =
@ -2263,6 +2271,20 @@ probe_rts8891_devices (void)
options[CFG_ALLOW_SHARING]->constraint_type = SANE_CONSTRAINT_NONE;
values[CFG_ALLOW_SHARING] = &rtscfg.allowsharing;
/* sensor type override */
options[CFG_SENSOR_NUMBER] =
(SANE_Option_Descriptor *) malloc (sizeof (SANE_Option_Descriptor));
options[CFG_SENSOR_NUMBER]->name = "sensornumber";
options[CFG_SENSOR_NUMBER]->desc =
"user provided scanner's internal sensor number";
options[CFG_SENSOR_NUMBER]->type = SANE_TYPE_INT;
options[CFG_SENSOR_NUMBER]->unit = SANE_UNIT_NONE;
options[CFG_SENSOR_NUMBER]->size = sizeof (SANE_Word);
options[CFG_SENSOR_NUMBER]->cap = SANE_CAP_SOFT_SELECT;
options[CFG_SENSOR_NUMBER]->constraint_type = SANE_CONSTRAINT_RANGE;
options[CFG_SENSOR_NUMBER]->constraint.range = &sensor_range;
values[CFG_SENSOR_NUMBER] = &rtscfg.sensornumber;
/* set configuration options structure */
config.descriptors = options;
config.values = values;
@ -2437,6 +2459,9 @@ attach_rts8891 (const char *devicename)
device->start_time.tv_sec = 0;
#endif
/* in case autodection au sensor doesn't work, use the given override */
device->sensor = rtscfg.sensornumber;
/* copy configuration settings to device */
device->conf.modelnumber = dn;
device->conf.allowsharing = rtscfg.allowsharing;
@ -3434,9 +3459,14 @@ initialize_device (struct Rts8891_Device *dev)
DBG (DBG_io, "initialize_device: lamp status=0x%02x\n", dev->regs[0x8e]);
/* sensor type the one for 4470c sold with XPA is slightly different
* than those sold bare, for this modelwe allways start with xpa type sensor,
* and change it later if we detect black scans in find_origin() */
dev->sensor = device->model->sensor;
* than those sold bare, for this model we allways start with xpa type sensor,
* and change it later if we detect black scans in find_origin(). In case the
* attach function set up the sensor type, we don't modify it */
if(dev->sensor == -1)
{
dev->sensor = device->model->sensor;
}
DBG (DBG_info, "sane_start: initial sensor type is %d\n", dev->sensor);
DBG (DBG_info, "initialize_device: reg[8e]=0x%02x\n", dev->regs[0x8e]);
/* detects if warming up is needed */

Wyświetl plik

@ -113,6 +113,7 @@ enum Rts8891_Option
enum Umax_PP_Configure_Option
{
CFG_MODEL_NUMBER = 0, /* first option number must be zero */
CFG_SENSOR_NUMBER, /* first option number must be zero */
CFG_ALLOW_SHARING,
NUM_CFG_OPTIONS /* MUST be last */
};

Wyświetl plik

@ -75,6 +75,7 @@
#define SENSOR_TYPE_XPA 1 /* sensor for hp4470 sold with XPA */
#define SENSOR_TYPE_4400 2 /* sensor for hp4400 */
#define SENSOR_TYPE_4400_BARE 3 /* sensor for hp4400 */
#define SENSOR_TYPE_MAX 3 /* maximum sensor number value */
/* Forward typedefs */
typedef struct Rts8891_Device Rts8891_Device;
@ -143,6 +144,9 @@ typedef struct Rts8891_Config
/**< index number in device table to override detection */
SANE_Word modelnumber;
/**< id of the snedor type, must match SENSOR_TYPE_* defines */
SANE_Word sensornumber;
/**< if true, use release/acquire to allow the same device
* to be used by several frontends */
SANE_Bool allowsharing;