kopia lustrzana https://gitlab.com/sane-project/backends
- move to configuration framework
- fix GPO value confusion - don't reset ASIC anymore - some HP2400/G2410 tidbitsmerge-requests/1/head
rodzic
72894d1e98
commit
9f60fdf955
|
@ -1,3 +1,10 @@
|
|||
2008-06-03 St<53>phane Voltz <stef.dev@free.fr>
|
||||
* backend/genesys.c backend/genesys_gl646.c backend/genesys_devices.c:
|
||||
- move to configuration framework
|
||||
- fix GL646 GPO value usage
|
||||
- HP2400/G2410 tidbits
|
||||
- don't reset ASIC anymore
|
||||
|
||||
2008-08-27 m. allan noah <kitno455 a t gmail d o t com>
|
||||
* doc/descriptions/fujitsu.desc: mark fi-6230 and fi-6240 complete
|
||||
|
||||
|
|
|
@ -3535,13 +3535,13 @@ genesys_warmup_lamp (Genesys_Device * dev)
|
|||
fixes the communication with scanner . Put usb timeout to a friendly
|
||||
value first, so that 'recovery' doesn't take too long */
|
||||
sanei_usb_set_timeout (2 * 1000);
|
||||
status =
|
||||
/* status =
|
||||
sanei_genesys_read_data_from_scanner (dev, first_line, total_size);
|
||||
if (status != SANE_STATUS_GOOD)
|
||||
{
|
||||
RIE (sanei_genesys_read_data_from_scanner
|
||||
(dev, first_line, total_size));
|
||||
}
|
||||
} */
|
||||
/* back to normal time out */
|
||||
sanei_usb_set_timeout (30 * 1000);
|
||||
RIE (dev->model->cmd_set->end_scan (dev, local_reg, SANE_FALSE));
|
||||
|
@ -3687,7 +3687,7 @@ genesys_start_scan (Genesys_Device * dev)
|
|||
else
|
||||
{
|
||||
/* Go home */
|
||||
/* too: check we can drop this since we cannot have the
|
||||
/* TODO: check we can drop this since we cannot have the
|
||||
scanner's head wandering here */
|
||||
if (dev->model->flags & GENESYS_FLAG_USE_PARK)
|
||||
status = dev->model->cmd_set->park_head (dev, dev->reg, 1);
|
||||
|
@ -5029,17 +5029,59 @@ attach_one_device (SANE_String_Const devname)
|
|||
return SANE_STATUS_GOOD;
|
||||
}
|
||||
|
||||
/* configuration framework functions */
|
||||
static SANE_Status config_attach_genesys (SANEI_Config * config,
|
||||
const char *devname)
|
||||
{
|
||||
/* no options yet for this backend */
|
||||
config=config;
|
||||
|
||||
/* the devname has been processed and is ready to be used
|
||||
* directly. Since the backend is an USB only one, we can
|
||||
* call sanei_usb_attach_matching_devices straight */
|
||||
sanei_usb_attach_matching_devices (devname, attach_one_device);
|
||||
|
||||
return SANE_STATUS_GOOD;
|
||||
}
|
||||
|
||||
/* probes for scanner to attach to the backend */
|
||||
static SANE_Status probe_genesys_devices(void)
|
||||
{
|
||||
SANEI_Config config;
|
||||
SANE_Status status;
|
||||
|
||||
DBG (DBG_proc, "probe_genesys_devices: start\n");
|
||||
|
||||
new_dev = 0;
|
||||
new_dev_len = 0;
|
||||
new_dev_alloced = 0;
|
||||
|
||||
/* set configuration options structure : no option for this backend */
|
||||
config.descriptors = NULL;
|
||||
config.values = NULL;
|
||||
config.count = 0;
|
||||
|
||||
/* generic configure and attach function */
|
||||
status = sanei_configure_attach (GENESYS_CONFIG_FILE, &config,
|
||||
config_attach_genesys);
|
||||
|
||||
if (new_dev_alloced > 0)
|
||||
{
|
||||
new_dev_len = new_dev_alloced = 0;
|
||||
free (new_dev);
|
||||
}
|
||||
|
||||
DBG (DBG_proc, "probe_genesys_devices: exit\n");
|
||||
|
||||
return status;
|
||||
}
|
||||
|
||||
/* -------------------------- SANE API functions ------------------------- */
|
||||
|
||||
SANE_Status
|
||||
sane_init (SANE_Int * version_code, SANE_Auth_Callback authorize)
|
||||
{
|
||||
SANE_Char line[PATH_MAX];
|
||||
SANE_Char *word;
|
||||
SANE_String_Const cp;
|
||||
SANE_Int linenumber;
|
||||
FILE *fp;
|
||||
SANE_Status status;
|
||||
|
||||
DBG_INIT ();
|
||||
DBG (DBG_init, "SANE Genesys backend version %d.%d build %d from %s\n",
|
||||
|
@ -5050,27 +5092,9 @@ sane_init (SANE_Int * version_code, SANE_Auth_Callback authorize)
|
|||
|
||||
DBG (DBG_proc, "sane_init: authorize %s null\n", authorize ? "!=" : "==");
|
||||
|
||||
/* init usb use */
|
||||
sanei_usb_init ();
|
||||
|
||||
num_devices = 0;
|
||||
first_dev = 0;
|
||||
first_handle = 0;
|
||||
devlist = 0;
|
||||
new_dev = 0;
|
||||
new_dev_len = 0;
|
||||
new_dev_alloced = 0;
|
||||
|
||||
fp = sanei_config_open (GENESYS_CONFIG_FILE);
|
||||
if (!fp)
|
||||
{
|
||||
/* default to /dev/usb/scanner instead of insisting on config file */
|
||||
DBG (DBG_warn, "sane_init: couldn't open config file `%s': %s. Using "
|
||||
"/dev/usb/scanner directly\n", GENESYS_CONFIG_FILE,
|
||||
strerror (errno));
|
||||
attach ("/dev/usb/scanner", 0, SANE_FALSE);
|
||||
return SANE_STATUS_GOOD;
|
||||
}
|
||||
|
||||
|
||||
DBG (DBG_info, "sane_init: %s endian machine\n",
|
||||
#ifdef WORDS_BIGENDIAN
|
||||
"big"
|
||||
|
@ -5079,56 +5103,18 @@ sane_init (SANE_Int * version_code, SANE_Auth_Callback authorize)
|
|||
#endif
|
||||
);
|
||||
|
||||
linenumber = 0;
|
||||
DBG (DBG_info, "sane_init: reading config file `%s'\n",
|
||||
GENESYS_CONFIG_FILE);
|
||||
while (sanei_config_read (line, sizeof (line), fp))
|
||||
{
|
||||
word = 0;
|
||||
linenumber++;
|
||||
/* set up to no devices at first */
|
||||
num_devices = 0;
|
||||
first_dev = 0;
|
||||
first_handle = 0;
|
||||
devlist = 0;
|
||||
|
||||
cp = sanei_config_get_string (line, &word);
|
||||
if (!word || cp == line)
|
||||
{
|
||||
DBG (DBG_io,
|
||||
"sane_init: config file line %d: ignoring empty line\n",
|
||||
linenumber);
|
||||
if (word)
|
||||
free (word);
|
||||
continue;
|
||||
}
|
||||
if (word[0] == '#')
|
||||
{
|
||||
DBG (DBG_io,
|
||||
"sane_init: config file line %d: ignoring comment line\n",
|
||||
linenumber);
|
||||
free (word);
|
||||
continue;
|
||||
}
|
||||
/* cold-plug case :detection of allready connected scanners */
|
||||
status = probe_genesys_devices();
|
||||
|
||||
/* else */
|
||||
{
|
||||
new_dev_len = 0;
|
||||
DBG (DBG_info,
|
||||
"sane_init: config file line %d: trying to attach `%s'\n",
|
||||
linenumber, line);
|
||||
sanei_usb_attach_matching_devices (line, attach_one_device);
|
||||
if (word)
|
||||
free (word);
|
||||
word = 0;
|
||||
}
|
||||
}
|
||||
|
||||
if (new_dev_alloced > 0)
|
||||
{
|
||||
new_dev_len = new_dev_alloced = 0;
|
||||
free (new_dev);
|
||||
}
|
||||
|
||||
fclose (fp);
|
||||
DBG (DBG_proc, "sane_init: exit\n");
|
||||
|
||||
return SANE_STATUS_GOOD;
|
||||
return status;
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -5163,6 +5149,9 @@ sane_get_devices (const SANE_Device *** device_list, SANE_Bool local_only)
|
|||
DBG (DBG_proc, "sane_get_devices: start: local_only = %s\n",
|
||||
local_only == SANE_TRUE ? "true" : "false");
|
||||
|
||||
/* hot-plug case :detection of newly connected scanners */
|
||||
probe_genesys_devices();
|
||||
|
||||
if (devlist)
|
||||
free (devlist);
|
||||
|
||||
|
|
|
@ -251,7 +251,7 @@ static Genesys_Gpo Gpo[] = {
|
|||
,
|
||||
/* MD5345/MD6471 */
|
||||
{
|
||||
{0x30, 0x00}
|
||||
{0x30, 0x18}
|
||||
, /* bits 11-12 are for bipolar V-ref input voltage */
|
||||
{0xa0, 0x18}
|
||||
,
|
||||
|
@ -576,7 +576,7 @@ static Genesys_Model hp2400c_model = {
|
|||
NULL,
|
||||
|
||||
{1200, 600, 300, 150, 75, 0}, /* possible x-resolutions */
|
||||
{2400, 1200, 600, 300, 150, 75, 0}, /* possible y-resolutions */
|
||||
{1200, 600, 300, 150, 75, 0}, /* possible y-resolutions */
|
||||
{16, 8, 0}, /* possible depths in gray mode */
|
||||
{16, 8, 0}, /* possible depths in color mode */
|
||||
|
||||
|
@ -607,7 +607,6 @@ static Genesys_Model hp2400c_model = {
|
|||
GENESYS_FLAG_UNTESTED /* not fully working yet */
|
||||
| GENESYS_FLAG_REPARK
|
||||
| GENESYS_FLAG_14BIT_GAMMA
|
||||
| GENESYS_FLAG_SEARCH_START
|
||||
| GENESYS_FLAG_MUST_WAIT
|
||||
| GENESYS_FLAG_DARK_CALIBRATION
|
||||
| GENESYS_FLAG_OFFSET_CALIBRATION
|
||||
|
|
|
@ -1190,6 +1190,9 @@ gl646_set_fe (Genesys_Device * dev, u_int8_t set)
|
|||
return SANE_STATUS_UNSUPPORTED;
|
||||
}
|
||||
|
||||
status = sanei_genesys_read_register (dev, 0x70, &val);
|
||||
DBG (DBG_proc, "gl646_set_fe: R70=0x%02d\n", val);
|
||||
|
||||
if (set == AFE_INIT)
|
||||
{
|
||||
DBG (DBG_proc, "gl646_set_fe(): setting DAC %u\n",
|
||||
|
@ -1231,7 +1234,10 @@ gl646_set_fe (Genesys_Device * dev, u_int8_t set)
|
|||
return status;
|
||||
}
|
||||
|
||||
/* todo : base this test on cfg reg3 or a CCD family flag to be created */
|
||||
status = sanei_genesys_read_register (dev, 0x70, &val);
|
||||
DBG (DBG_proc, "gl646_set_fe: R70=0x%02d\n", val);
|
||||
|
||||
/* TODO : base this test on cfg reg3 or a CCD family flag to be created */
|
||||
/*if (dev->model->ccd_type!=CCD_HP2300 && dev->model->ccd_type!=CCD_HP2400) */
|
||||
{
|
||||
status = sanei_genesys_fe_write_data (dev, 0x00, dev->frontend.reg[0]);
|
||||
|
@ -2616,8 +2622,8 @@ gl646_init_regs_for_shading (Genesys_Device * dev)
|
|||
/* set all available bits */
|
||||
if (dev->model->motor_type == MOTOR_5345)
|
||||
{
|
||||
dev->calib_reg[reg_0x66].value = 0x30;
|
||||
dev->calib_reg[reg_0x67].value = dev->gpo.enable[1];
|
||||
dev->calib_reg[reg_0x66].value = dev->gpo.value[0];
|
||||
dev->calib_reg[reg_0x67].value = dev->gpo.value[1];
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -3036,43 +3042,44 @@ gl646_init_regs_for_scan (Genesys_Device * dev)
|
|||
* this crudly for now, it might also come from the way slopes table
|
||||
* are generated, we may consider switching to the newer and more
|
||||
* accurate method */
|
||||
DBG (DBG_info, "gl646_init_regs_for_scan: move=%d steps/yres=%d (XXX STEF XXX)\n", move, dev->settings.yres);
|
||||
DBG (DBG_info, "gl646_init_regs_for_scan: move=%d steps/yres=%d\n", move,
|
||||
dev->settings.yres);
|
||||
if (dev->model->motor_type == MOTOR_5345)
|
||||
{
|
||||
switch(dev->settings.yres)
|
||||
{
|
||||
case 2400:
|
||||
move += 50;
|
||||
break;
|
||||
case 1200:
|
||||
move += 100;
|
||||
break;
|
||||
case 600:
|
||||
move -= 150;
|
||||
break;
|
||||
case 500:
|
||||
move -= 150;
|
||||
break;
|
||||
case 400:
|
||||
move -= 100;
|
||||
break;
|
||||
case 300:
|
||||
case 250:
|
||||
case 200:
|
||||
break;
|
||||
case 150:
|
||||
move += 100;
|
||||
break;
|
||||
case 100:
|
||||
move += 120;
|
||||
break;
|
||||
case 50:
|
||||
move += 100;
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
{
|
||||
switch (dev->settings.yres)
|
||||
{
|
||||
case 2400:
|
||||
move += 50;
|
||||
break;
|
||||
case 1200:
|
||||
move += 100;
|
||||
break;
|
||||
case 600:
|
||||
move -= 150;
|
||||
break;
|
||||
case 500:
|
||||
move -= 150;
|
||||
break;
|
||||
case 400:
|
||||
move -= 100;
|
||||
break;
|
||||
case 300:
|
||||
case 250:
|
||||
case 200:
|
||||
break;
|
||||
case 150:
|
||||
move += 100;
|
||||
break;
|
||||
case 100:
|
||||
move += 120;
|
||||
break;
|
||||
case 50:
|
||||
move += 100;
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
/* add tl_y to base movement */
|
||||
/* move += (dev->settings.tl_y * dev->motor.optical_ydpi) / MM_PER_INCH; */
|
||||
|
@ -3132,7 +3139,7 @@ gl646_init_regs_for_scan (Genesys_Device * dev)
|
|||
}
|
||||
else
|
||||
dev->reg[reg_0x65].value = 0x3f;
|
||||
dev->reg[reg_0x67].value = dev->gpo.enable[1];
|
||||
dev->reg[reg_0x67].value = dev->gpo.value[1];
|
||||
|
||||
/* prepares data reordering */
|
||||
|
||||
|
@ -4086,8 +4093,8 @@ gl646_init_regs_for_warmup (Genesys_Device * dev,
|
|||
local_reg[reg_0x63].value = 0x00; /* (3Dh+3Eh+3Fh)/LPeriod for one-table mode,(21h+1Fh)/LPeriod */
|
||||
local_reg[reg_0x64].value = 0x00; /* motor PWM frequency */
|
||||
|
||||
local_reg[reg_0x66].value = dev->gpo.enable[0] & 0x10;
|
||||
local_reg[reg_0x67].value = dev->gpo.enable[1];
|
||||
local_reg[reg_0x66].value = dev->gpo.value[0] & 0x10;
|
||||
local_reg[reg_0x67].value = dev->gpo.value[1];
|
||||
local_reg[reg_0x68].value = dev->gpo.enable[0];
|
||||
local_reg[reg_0x69].value = dev->gpo.enable[1];
|
||||
|
||||
|
@ -4206,8 +4213,8 @@ gl646_repark_head (Genesys_Device * dev)
|
|||
local_reg[reg_0x65].value = 0x3f;
|
||||
|
||||
/* todo : maybe move thes in init once for all */
|
||||
local_reg[reg_0x66].value = dev->gpo.enable[0] & 0x10;
|
||||
local_reg[reg_0x67].value = dev->gpo.enable[1];
|
||||
local_reg[reg_0x66].value = dev->gpo.value[0] & 0x10;
|
||||
local_reg[reg_0x67].value = dev->gpo.value[1];
|
||||
local_reg[reg_0x68].value = dev->gpo.enable[0];
|
||||
local_reg[reg_0x69].value = dev->gpo.enable[1];
|
||||
local_reg[reg_0x6a].value = 0x7f;
|
||||
|
@ -4442,7 +4449,7 @@ gl646_init (Genesys_Device * dev)
|
|||
VALUE_INIT, INDEX, 1, &val));
|
||||
|
||||
/* ASIC reset */
|
||||
RIE (sanei_genesys_write_register (dev, 0x0e, 0x00));
|
||||
/* XXX STEF XXX RIE (sanei_genesys_write_register (dev, 0x0e, 0x00)); */
|
||||
usleep (10000UL); /* sleep 100 ms */
|
||||
|
||||
/* Write initial registers */
|
||||
|
@ -4460,6 +4467,10 @@ gl646_init (Genesys_Device * dev)
|
|||
/* fix for timeouts at init */
|
||||
if (dev->model->ccd_type == CCD_5345)
|
||||
{
|
||||
|
||||
status = sanei_genesys_read_register (dev, 0x70, &val);
|
||||
DBG (DBG_proc, "gl646_init: R70=0x%02d\n", val);
|
||||
|
||||
sanei_usb_set_timeout (2 * 1000);
|
||||
/* we read data without any pending scan to trigger timeout */
|
||||
status = dev->model->cmd_set->bulk_read_data (dev, 0x45, data, 64);
|
||||
|
|
Ładowanie…
Reference in New Issue