kopia lustrzana https://gitlab.com/sane-project/backends
genesys: Return errors as exceptions from *init_scan_regs()
rodzic
153602308c
commit
c843e3e83d
|
@ -1163,9 +1163,8 @@ static void gl124_init_optical_regs_scan(Genesys_Device* dev, const Genesys_Sens
|
|||
*
|
||||
* this function sets up the scanner to scan in normal or single line mode
|
||||
*/
|
||||
static SANE_Status
|
||||
gl124_init_scan_regs(Genesys_Device * dev, const Genesys_Sensor& sensor, Genesys_Register_Set* reg,
|
||||
SetupParams& params)
|
||||
static void gl124_init_scan_regs(Genesys_Device* dev, const Genesys_Sensor& sensor,
|
||||
Genesys_Register_Set* reg, SetupParams& params)
|
||||
{
|
||||
DBG_HELPER(dbg);
|
||||
params.assert_valid();
|
||||
|
@ -1374,8 +1373,6 @@ gl124_init_scan_regs(Genesys_Device * dev, const Genesys_Sensor& sensor, Genesys
|
|||
dev->settings.pixels * dev->settings.lines * params.channels * (params.depth / 8);
|
||||
|
||||
DBG(DBG_info, "%s: total bytes to send = %lu\n", __func__, (u_long) dev->total_bytes_to_read);
|
||||
|
||||
return SANE_STATUS_GOOD;
|
||||
}
|
||||
|
||||
static void
|
||||
|
@ -1825,13 +1822,7 @@ gl124_slow_back_home (Genesys_Device * dev, SANE_Bool wait_until_home)
|
|||
SCAN_FLAG_DISABLE_GAMMA |
|
||||
SCAN_FLAG_IGNORE_LINE_DISTANCE;
|
||||
|
||||
status = gl124_init_scan_regs(dev, sensor, &local_reg, params);
|
||||
|
||||
if (status != SANE_STATUS_GOOD)
|
||||
{
|
||||
DBG(DBG_error, "%s: failed to set up registers: %s\n", __func__, sane_strstatus(status));
|
||||
return status;
|
||||
}
|
||||
gl124_init_scan_regs(dev, sensor, &local_reg, params);
|
||||
|
||||
// clear scan and feed count
|
||||
sanei_genesys_write_register(dev, REG0D, REG0D_CLRLNCNT | REG0D_CLRMCNT);
|
||||
|
@ -1940,13 +1931,7 @@ gl124_feed (Genesys_Device * dev, unsigned int steps, int reverse)
|
|||
SCAN_FLAG_DISABLE_BUFFER_FULL_MOVE |
|
||||
SCAN_FLAG_IGNORE_LINE_DISTANCE;
|
||||
|
||||
status = gl124_init_scan_regs(dev, sensor, &local_reg, params);
|
||||
|
||||
if (status != SANE_STATUS_GOOD)
|
||||
{
|
||||
DBG (DBG_error, "%s: failed to set up registers: %s\n", __func__, sane_strstatus (status));
|
||||
return status;
|
||||
}
|
||||
gl124_init_scan_regs(dev, sensor, &local_reg, params);
|
||||
|
||||
/* set exposure to zero */
|
||||
sanei_genesys_set_triple(&local_reg,REG_EXPR,0);
|
||||
|
@ -2046,13 +2031,7 @@ gl124_search_start_position (Genesys_Device * dev)
|
|||
SCAN_FLAG_IGNORE_LINE_DISTANCE |
|
||||
SCAN_FLAG_DISABLE_BUFFER_FULL_MOVE;
|
||||
|
||||
status = gl124_init_scan_regs(dev, sensor, &local_reg, params);
|
||||
|
||||
if (status!=SANE_STATUS_GOOD)
|
||||
{
|
||||
DBG(DBG_error, "%s: failed to init scan registers: %s\n", __func__, sane_strstatus(status));
|
||||
return status;
|
||||
}
|
||||
gl124_init_scan_regs(dev, sensor, &local_reg, params);
|
||||
|
||||
// send to scanner
|
||||
dev->model->cmd_set->bulk_write_register(dev, local_reg);
|
||||
|
@ -2116,7 +2095,6 @@ gl124_init_regs_for_coarse_calibration(Genesys_Device* dev, const Genesys_Sensor
|
|||
Genesys_Register_Set& regs)
|
||||
{
|
||||
DBG_HELPER(dbg);
|
||||
SANE_Status status = SANE_STATUS_GOOD;
|
||||
uint8_t channels;
|
||||
|
||||
/* set line size */
|
||||
|
@ -2144,13 +2122,8 @@ gl124_init_regs_for_coarse_calibration(Genesys_Device* dev, const Genesys_Sensor
|
|||
SCAN_FLAG_FEEDING |
|
||||
SCAN_FLAG_IGNORE_LINE_DISTANCE;
|
||||
|
||||
status = gl124_init_scan_regs(dev, sensor, ®s, params);
|
||||
gl124_init_scan_regs(dev, sensor, ®s, params);
|
||||
|
||||
if (status != SANE_STATUS_GOOD)
|
||||
{
|
||||
DBG(DBG_error, "%s: failed to setup scan: %s\n", __func__, sane_strstatus(status));
|
||||
return status;
|
||||
}
|
||||
sanei_genesys_set_motor_power(regs, false);
|
||||
|
||||
DBG(DBG_info, "%s: optical sensor res: %d dpi, actual res: %d\n", __func__,
|
||||
|
@ -2169,7 +2142,6 @@ gl124_init_regs_for_shading(Genesys_Device * dev, const Genesys_Sensor& sensor,
|
|||
Genesys_Register_Set& regs)
|
||||
{
|
||||
DBG_HELPER(dbg);
|
||||
SANE_Status status = SANE_STATUS_GOOD;
|
||||
int move, resolution, dpihw, factor;
|
||||
|
||||
/* initial calibration reg values */
|
||||
|
@ -2221,16 +2193,13 @@ gl124_init_regs_for_shading(Genesys_Device * dev, const Genesys_Sensor& sensor,
|
|||
SCAN_FLAG_DISABLE_BUFFER_FULL_MOVE |
|
||||
SCAN_FLAG_IGNORE_LINE_DISTANCE;
|
||||
|
||||
status = gl124_init_scan_regs(dev, sensor, ®s, params);
|
||||
|
||||
sanei_genesys_set_motor_power(regs, false);
|
||||
|
||||
if (status != SANE_STATUS_GOOD)
|
||||
{
|
||||
DBG (DBG_error, "%s: failed to setup scan: %s\n", __func__,
|
||||
sane_strstatus (status));
|
||||
return status;
|
||||
try {
|
||||
gl124_init_scan_regs(dev, sensor, ®s, params);
|
||||
} catch (...) {
|
||||
catch_all_exceptions(__func__, [&](){ sanei_genesys_set_motor_power(regs, false); });
|
||||
throw;
|
||||
}
|
||||
sanei_genesys_set_motor_power(regs, false);
|
||||
|
||||
dev->scanhead_position_in_steps += dev->calib_lines + move;
|
||||
|
||||
|
@ -2337,10 +2306,7 @@ gl124_init_regs_for_scan (Genesys_Device * dev, const Genesys_Sensor& sensor)
|
|||
params.color_filter = dev->settings.color_filter;
|
||||
params.flags = flags;
|
||||
|
||||
status = gl124_init_scan_regs(dev, sensor, &dev->reg, params);
|
||||
|
||||
if (status != SANE_STATUS_GOOD)
|
||||
return status;
|
||||
gl124_init_scan_regs(dev, sensor, &dev->reg, params);
|
||||
|
||||
return SANE_STATUS_GOOD;
|
||||
}
|
||||
|
@ -2495,13 +2461,7 @@ move_to_calibration_area (Genesys_Device * dev, const Genesys_Sensor& sensor,
|
|||
SCAN_FLAG_SINGLE_LINE |
|
||||
SCAN_FLAG_IGNORE_LINE_DISTANCE;
|
||||
|
||||
status = gl124_init_scan_regs(dev, sensor, ®s, params);
|
||||
|
||||
if (status != SANE_STATUS_GOOD)
|
||||
{
|
||||
DBG (DBG_error, "%s: failed to setup scan: %s\n", __func__, sane_strstatus (status));
|
||||
return status;
|
||||
}
|
||||
gl124_init_scan_regs(dev, sensor, ®s, params);
|
||||
|
||||
size = pixels * 3;
|
||||
std::vector<uint8_t> line(size);
|
||||
|
@ -2586,13 +2546,7 @@ gl124_led_calibration (Genesys_Device * dev, Genesys_Sensor& sensor, Genesys_Reg
|
|||
SCAN_FLAG_SINGLE_LINE |
|
||||
SCAN_FLAG_IGNORE_LINE_DISTANCE;
|
||||
|
||||
status = gl124_init_scan_regs(dev, sensor, ®s, params);
|
||||
|
||||
if (status != SANE_STATUS_GOOD)
|
||||
{
|
||||
DBG (DBG_error, "%s: failed to setup scan: %s\n", __func__, sane_strstatus (status));
|
||||
return status;
|
||||
}
|
||||
gl124_init_scan_regs(dev, sensor, ®s, params);
|
||||
|
||||
total_size = num_pixels * channels * (depth/8) * 1; /* colors * bytes_per_color * scan lines */
|
||||
std::vector<uint8_t> line(total_size);
|
||||
|
@ -2768,13 +2722,8 @@ gl124_offset_calibration(Genesys_Device * dev, const Genesys_Sensor& sensor,
|
|||
SCAN_FLAG_SINGLE_LINE |
|
||||
SCAN_FLAG_IGNORE_LINE_DISTANCE;
|
||||
|
||||
status = gl124_init_scan_regs(dev, sensor, ®s, params);
|
||||
gl124_init_scan_regs(dev, sensor, ®s, params);
|
||||
|
||||
if (status != SANE_STATUS_GOOD)
|
||||
{
|
||||
DBG(DBG_error, "%s: failed to setup scan: %s\n", __func__, sane_strstatus(status));
|
||||
return status;
|
||||
}
|
||||
sanei_genesys_set_motor_power(regs, false);
|
||||
|
||||
/* allocate memory for scans */
|
||||
|
@ -2939,22 +2888,14 @@ gl124_coarse_gain_calibration(Genesys_Device * dev, const Genesys_Sensor& sensor
|
|||
SCAN_FLAG_IGNORE_LINE_DISTANCE;
|
||||
|
||||
try {
|
||||
status = gl124_init_scan_regs(dev, sensor, ®s, params);
|
||||
gl124_init_scan_regs(dev, sensor, ®s, params);
|
||||
} catch (...) {
|
||||
try {
|
||||
sanei_genesys_set_motor_power(regs, false);
|
||||
} catch (...) {}
|
||||
catch_all_exceptions(__func__, [&](){ sanei_genesys_set_motor_power(regs, false); });
|
||||
throw;
|
||||
}
|
||||
|
||||
sanei_genesys_set_motor_power(regs, false);
|
||||
|
||||
if (status != SANE_STATUS_GOOD)
|
||||
{
|
||||
DBG(DBG_error, "%s: failed to setup scan: %s\n", __func__, sane_strstatus(status));
|
||||
return status;
|
||||
}
|
||||
|
||||
dev->model->cmd_set->bulk_write_register(dev, regs);
|
||||
|
||||
total_size = pixels * channels * (16/bpp) * lines;
|
||||
|
@ -3048,7 +2989,6 @@ gl124_init_regs_for_warmup (Genesys_Device * dev,
|
|||
{
|
||||
DBG_HELPER(dbg);
|
||||
int num_pixels;
|
||||
SANE_Status status = SANE_STATUS_GOOD;
|
||||
|
||||
if (dev == NULL || reg == NULL || channels == NULL || total_size == NULL)
|
||||
return SANE_STATUS_INVAL;
|
||||
|
@ -3074,13 +3014,7 @@ gl124_init_regs_for_warmup (Genesys_Device * dev,
|
|||
SCAN_FLAG_SINGLE_LINE |
|
||||
SCAN_FLAG_IGNORE_LINE_DISTANCE;
|
||||
|
||||
status = gl124_init_scan_regs(dev, sensor, reg, params);
|
||||
|
||||
if (status != SANE_STATUS_GOOD)
|
||||
{
|
||||
DBG(DBG_error, "%s: failed to setup scan: %s\n", __func__, sane_strstatus(status));
|
||||
return status;
|
||||
}
|
||||
gl124_init_scan_regs(dev, sensor, reg, params);
|
||||
|
||||
num_pixels = dev->current_setup.pixels;
|
||||
|
||||
|
|
|
@ -462,8 +462,7 @@ static Motor_Profile motors[]={
|
|||
{0, 0, 0, NULL},
|
||||
};
|
||||
|
||||
static
|
||||
SANE_Status gl124_init_scan_regs(Genesys_Device * dev, const Genesys_Sensor& sensor,
|
||||
static void gl124_init_scan_regs(Genesys_Device* dev, const Genesys_Sensor& sensor,
|
||||
Genesys_Register_Set* reg, SetupParams& params);
|
||||
|
||||
static SANE_Status gl124_start_action (Genesys_Device * dev);
|
||||
|
|
|
@ -1786,14 +1786,10 @@ int scan_step_type=0;
|
|||
return scan_step_type;
|
||||
}
|
||||
|
||||
/* set up registers for an actual scan
|
||||
*
|
||||
* this function sets up the scanner to scan in normal or single line mode
|
||||
*/
|
||||
static
|
||||
SANE_Status
|
||||
gl841_init_scan_regs(Genesys_Device * dev, const Genesys_Sensor& sensor, Genesys_Register_Set * reg,
|
||||
SetupParams& params)
|
||||
// set up registers for an actual scan this function sets up the scanner to scan in normal or single
|
||||
// line mode
|
||||
static void gl841_init_scan_regs(Genesys_Device* dev, const Genesys_Sensor& sensor,
|
||||
Genesys_Register_Set* reg, SetupParams& params)
|
||||
{
|
||||
DBG_HELPER(dbg);
|
||||
params.assert_valid();
|
||||
|
@ -2115,8 +2111,6 @@ dummy \ scanned lines
|
|||
|
||||
DBG(DBG_info, "%s: total bytes to send = %lu\n", __func__, (u_long) dev->total_bytes_to_read);
|
||||
/* END TODO */
|
||||
|
||||
return SANE_STATUS_GOOD;
|
||||
}
|
||||
|
||||
static void gl841_calculate_current_setup(Genesys_Device * dev, const Genesys_Sensor& sensor)
|
||||
|
@ -3128,13 +3122,7 @@ gl841_search_start_position (Genesys_Device * dev)
|
|||
SCAN_FLAG_IGNORE_LINE_DISTANCE |
|
||||
SCAN_FLAG_DISABLE_BUFFER_FULL_MOVE;
|
||||
|
||||
status = gl841_init_scan_regs(dev, sensor, &local_reg, params);
|
||||
|
||||
if(status!=SANE_STATUS_GOOD)
|
||||
{
|
||||
DBG(DBG_error, "%s: failed to init scan registers: %s\n", __func__, sane_strstatus(status));
|
||||
return status;
|
||||
}
|
||||
gl841_init_scan_regs(dev, sensor, &local_reg, params);
|
||||
|
||||
// send to scanner
|
||||
sanei_genesys_bulk_write_register(dev, local_reg);
|
||||
|
@ -3200,7 +3188,6 @@ gl841_init_regs_for_coarse_calibration(Genesys_Device * dev, const Genesys_Senso
|
|||
Genesys_Register_Set& regs)
|
||||
{
|
||||
DBG_HELPER(dbg);
|
||||
SANE_Status status = SANE_STATUS_GOOD;
|
||||
uint8_t channels;
|
||||
|
||||
/* set line size */
|
||||
|
@ -3227,13 +3214,7 @@ gl841_init_regs_for_coarse_calibration(Genesys_Device * dev, const Genesys_Senso
|
|||
SCAN_FLAG_SINGLE_LINE |
|
||||
SCAN_FLAG_IGNORE_LINE_DISTANCE;
|
||||
|
||||
status = gl841_init_scan_regs(dev, sensor, ®s, params);
|
||||
|
||||
if (status != SANE_STATUS_GOOD)
|
||||
{
|
||||
DBG(DBG_error, "%s: failed to setup scan: %s\n", __func__, sane_strstatus(status));
|
||||
return status;
|
||||
}
|
||||
gl841_init_scan_regs(dev, sensor, ®s, params);
|
||||
|
||||
DBG(DBG_info, "%s: optical sensor res: %d dpi, actual res: %d\n", __func__,
|
||||
sensor.optical_res / sensor.ccd_pixels_per_system_pixel(), dev->settings.xres);
|
||||
|
@ -3253,7 +3234,6 @@ gl841_init_regs_for_shading(Genesys_Device * dev, const Genesys_Sensor& sensor,
|
|||
Genesys_Register_Set& regs)
|
||||
{
|
||||
DBG_HELPER_ARGS(dbg, "lines = %d", (int)(dev->calib_lines));
|
||||
SANE_Status status = SANE_STATUS_GOOD;
|
||||
SANE_Int ydpi;
|
||||
float starty=0;
|
||||
|
||||
|
@ -3302,13 +3282,7 @@ gl841_init_regs_for_shading(Genesys_Device * dev, const Genesys_Sensor& sensor,
|
|||
/*SCAN_FLAG_DISABLE_BUFFER_FULL_MOVE |*/
|
||||
SCAN_FLAG_IGNORE_LINE_DISTANCE;
|
||||
|
||||
status = gl841_init_scan_regs(dev, sensor, ®s, params);
|
||||
|
||||
if (status != SANE_STATUS_GOOD)
|
||||
{
|
||||
DBG(DBG_error, "%s: failed to setup scan: %s\n", __func__, sane_strstatus(status));
|
||||
return status;
|
||||
}
|
||||
gl841_init_scan_regs(dev, sensor, ®s, params);
|
||||
|
||||
dev->calib_pixels = dev->current_setup.pixels;
|
||||
dev->scanhead_position_in_steps += dev->calib_lines + starty;
|
||||
|
@ -3331,8 +3305,6 @@ gl841_init_regs_for_scan (Genesys_Device * dev, const Genesys_Sensor& sensor)
|
|||
int move_dpi;
|
||||
float start;
|
||||
|
||||
SANE_Status status = SANE_STATUS_GOOD;
|
||||
|
||||
debug_dump(DBG_info, dev->settings);
|
||||
|
||||
/* channels */
|
||||
|
@ -3429,10 +3401,7 @@ gl841_init_regs_for_scan (Genesys_Device * dev, const Genesys_Sensor& sensor)
|
|||
params.color_filter = dev->settings.color_filter;
|
||||
params.flags = flags;
|
||||
|
||||
status = gl841_init_scan_regs(dev, sensor, &dev->reg, params);
|
||||
|
||||
if (status != SANE_STATUS_GOOD)
|
||||
return status;
|
||||
gl841_init_scan_regs(dev, sensor, &dev->reg, params);
|
||||
|
||||
return SANE_STATUS_GOOD;
|
||||
}
|
||||
|
@ -3536,13 +3505,7 @@ gl841_led_calibration (Genesys_Device * dev, Genesys_Sensor& sensor, Genesys_Reg
|
|||
SCAN_FLAG_IGNORE_LINE_DISTANCE |
|
||||
SCAN_FLAG_USE_OPTICAL_RES;
|
||||
|
||||
status = gl841_init_scan_regs(dev, sensor, ®s, params);
|
||||
|
||||
if (status != SANE_STATUS_GOOD)
|
||||
{
|
||||
DBG(DBG_error, "%s: failed to setup scan: %s\n", __func__, sane_strstatus(status));
|
||||
return status;
|
||||
}
|
||||
gl841_init_scan_regs(dev, sensor, ®s, params);
|
||||
|
||||
sanei_genesys_bulk_write_register(dev, regs);
|
||||
|
||||
|
@ -3739,13 +3702,7 @@ ad_fe_offset_calibration (Genesys_Device * dev, const Genesys_Sensor& sensor,
|
|||
SCAN_FLAG_IGNORE_LINE_DISTANCE |
|
||||
SCAN_FLAG_USE_OPTICAL_RES;
|
||||
|
||||
status = gl841_init_scan_regs(dev, sensor, ®s, params);
|
||||
|
||||
if (status != SANE_STATUS_GOOD)
|
||||
{
|
||||
DBG(DBG_error, "%s: failed to setup scan: %s\n", __func__, sane_strstatus(status));
|
||||
return status;
|
||||
}
|
||||
gl841_init_scan_regs(dev, sensor, ®s, params);
|
||||
|
||||
num_pixels = dev->current_setup.pixels;
|
||||
total_size = num_pixels * 3 * 2 * 1;
|
||||
|
@ -3866,13 +3823,7 @@ gl841_offset_calibration(Genesys_Device * dev, const Genesys_Sensor& sensor,
|
|||
SCAN_FLAG_USE_OPTICAL_RES |
|
||||
SCAN_FLAG_DISABLE_LAMP;
|
||||
|
||||
status = gl841_init_scan_regs(dev, sensor, ®s, params);
|
||||
|
||||
if (status != SANE_STATUS_GOOD)
|
||||
{
|
||||
DBG(DBG_error, "%s: failed to setup scan: %s\n", __func__, sane_strstatus(status));
|
||||
return status;
|
||||
}
|
||||
gl841_init_scan_regs(dev, sensor, ®s, params);
|
||||
|
||||
num_pixels = dev->current_setup.pixels;
|
||||
|
||||
|
@ -4240,13 +4191,7 @@ gl841_coarse_gain_calibration(Genesys_Device * dev, const Genesys_Sensor& sensor
|
|||
SCAN_FLAG_IGNORE_LINE_DISTANCE |
|
||||
SCAN_FLAG_USE_OPTICAL_RES;
|
||||
|
||||
status = gl841_init_scan_regs(dev, sensor, ®s, params);
|
||||
|
||||
if (status != SANE_STATUS_GOOD)
|
||||
{
|
||||
DBG(DBG_error, "%s: failed to setup scan: %s\n", __func__, sane_strstatus(status));
|
||||
return status;
|
||||
}
|
||||
gl841_init_scan_regs(dev, sensor, ®s, params);
|
||||
|
||||
sanei_genesys_bulk_write_register(dev, regs);
|
||||
|
||||
|
@ -4403,13 +4348,7 @@ gl841_init_regs_for_warmup (Genesys_Device * dev,
|
|||
SCAN_FLAG_IGNORE_LINE_DISTANCE |
|
||||
SCAN_FLAG_USE_OPTICAL_RES;
|
||||
|
||||
status = gl841_init_scan_regs(dev, sensor, local_reg, params);
|
||||
|
||||
if (status != SANE_STATUS_GOOD)
|
||||
{
|
||||
DBG(DBG_error, "%s: failed to setup scan: %s\n", __func__, sane_strstatus(status));
|
||||
return status;
|
||||
}
|
||||
gl841_init_scan_regs(dev, sensor, local_reg, params);
|
||||
|
||||
num_pixels = dev->current_setup.pixels;
|
||||
|
||||
|
@ -4590,7 +4529,7 @@ gl841_init (Genesys_Device * dev)
|
|||
SCAN_FLAG_IGNORE_LINE_DISTANCE |
|
||||
SCAN_FLAG_USE_OPTICAL_RES;
|
||||
|
||||
status = gl841_init_scan_regs(dev, sensor, ®s, params);
|
||||
gl841_init_scan_regs(dev, sensor, ®s, params);
|
||||
|
||||
sanei_genesys_bulk_write_register(dev, regs);
|
||||
|
||||
|
@ -4729,13 +4668,7 @@ gl841_search_strip(Genesys_Device * dev, const Genesys_Sensor& sensor,
|
|||
params.color_filter = ColorFilter::RED;
|
||||
params.flags = SCAN_FLAG_DISABLE_SHADING | SCAN_FLAG_DISABLE_GAMMA;
|
||||
|
||||
status = gl841_init_scan_regs(dev, sensor, &local_reg, params);
|
||||
|
||||
if (status != SANE_STATUS_GOOD)
|
||||
{
|
||||
DBG(DBG_error, "%s: failed to setup for scan: %s\n", __func__, sane_strstatus(status));
|
||||
return status;
|
||||
}
|
||||
gl841_init_scan_regs(dev, sensor, &local_reg, params);
|
||||
|
||||
/* set up for reverse or forward */
|
||||
r = sanei_genesys_get_address(&local_reg, 0x02);
|
||||
|
|
|
@ -1350,13 +1350,10 @@ static void gl843_compute_session(Genesys_Device* dev, ScanSession& s,
|
|||
s.computed = true;
|
||||
}
|
||||
|
||||
/* set up registers for an actual scan
|
||||
*
|
||||
* this function sets up the scanner to scan in normal or single line mode
|
||||
*/
|
||||
static SANE_Status gl843_init_scan_regs(Genesys_Device* dev, const Genesys_Sensor& sensor,
|
||||
Genesys_Register_Set* reg,
|
||||
ScanSession& session)
|
||||
// set up registers for an actual scan this function sets up the scanner to scan in normal or single
|
||||
// line mode
|
||||
static void gl843_init_scan_regs(Genesys_Device* dev, const Genesys_Sensor& sensor,
|
||||
Genesys_Register_Set* reg, ScanSession& session)
|
||||
{
|
||||
DBG_HELPER(dbg);
|
||||
session.assert_computed();
|
||||
|
@ -1530,8 +1527,6 @@ static SANE_Status gl843_init_scan_regs(Genesys_Device* dev, const Genesys_Senso
|
|||
}
|
||||
|
||||
DBG(DBG_info, "%s: total bytes to send = %lu\n", __func__, (u_long) dev->total_bytes_to_read);
|
||||
|
||||
return SANE_STATUS_GOOD;
|
||||
}
|
||||
|
||||
static void
|
||||
|
@ -2383,13 +2378,7 @@ gl843_slow_back_home (Genesys_Device * dev, SANE_Bool wait_until_home)
|
|||
SCAN_FLAG_IGNORE_LINE_DISTANCE;
|
||||
gl843_compute_session(dev, session, sensor);
|
||||
|
||||
status = gl843_init_scan_regs(dev, sensor, &local_reg, session);
|
||||
|
||||
if (status != SANE_STATUS_GOOD)
|
||||
{
|
||||
DBG(DBG_error, "%s: failed to set up registers: %s\n", __func__, sane_strstatus(status));
|
||||
return status;
|
||||
}
|
||||
gl843_init_scan_regs(dev, sensor, &local_reg, session);
|
||||
|
||||
// clear scan and feed count
|
||||
sanei_genesys_write_register(dev, REG0D, REG0D_CLRLNCNT | REG0D_CLRMCNT);
|
||||
|
@ -2500,12 +2489,7 @@ gl843_search_start_position (Genesys_Device * dev)
|
|||
SCAN_FLAG_DISABLE_BUFFER_FULL_MOVE;
|
||||
gl843_compute_session(dev, session, sensor);
|
||||
|
||||
status = gl843_init_scan_regs(dev, sensor, &local_reg, session);
|
||||
if (status != SANE_STATUS_GOOD)
|
||||
{
|
||||
DBG(DBG_error, "%s: failed to bulk setup registers: %s\n", __func__, sane_strstatus(status));
|
||||
return status;
|
||||
}
|
||||
gl843_init_scan_regs(dev, sensor, &local_reg, session);
|
||||
|
||||
// send to scanner
|
||||
dev->model->cmd_set->bulk_write_register(dev, local_reg);
|
||||
|
@ -2570,7 +2554,6 @@ gl843_init_regs_for_coarse_calibration(Genesys_Device * dev, const Genesys_Senso
|
|||
Genesys_Register_Set& regs)
|
||||
{
|
||||
DBG_HELPER(dbg);
|
||||
SANE_Status status = SANE_STATUS_GOOD;
|
||||
uint8_t channels;
|
||||
|
||||
/* set line size */
|
||||
|
@ -2604,13 +2587,8 @@ gl843_init_regs_for_coarse_calibration(Genesys_Device * dev, const Genesys_Senso
|
|||
session.params.flags = flags;
|
||||
gl843_compute_session(dev, session, sensor);
|
||||
|
||||
status = gl843_init_scan_regs(dev, sensor, ®s, session);
|
||||
gl843_init_scan_regs(dev, sensor, ®s, session);
|
||||
|
||||
if (status != SANE_STATUS_GOOD)
|
||||
{
|
||||
DBG(DBG_error, "%s: failed to setup scan: %s\n", __func__, sane_strstatus(status));
|
||||
return status;
|
||||
}
|
||||
sanei_genesys_set_motor_power(regs, false);
|
||||
|
||||
DBG(DBG_info, "%s: optical sensor res: %d dpi, actual res: %d\n", __func__,
|
||||
|
@ -2660,12 +2638,7 @@ gl843_feed (Genesys_Device * dev, unsigned int steps)
|
|||
SCAN_FLAG_IGNORE_LINE_DISTANCE;
|
||||
gl843_compute_session(dev, session, sensor);
|
||||
|
||||
status = gl843_init_scan_regs(dev, sensor, &local_reg, session);
|
||||
if (status != SANE_STATUS_GOOD)
|
||||
{
|
||||
DBG(DBG_error, "%s: failed to set up registers: %s\n", __func__, sane_strstatus(status));
|
||||
return status;
|
||||
}
|
||||
gl843_init_scan_regs(dev, sensor, &local_reg, session);
|
||||
|
||||
// clear scan and feed count
|
||||
sanei_genesys_write_register(dev, REG0D, REG0D_CLRLNCNT);
|
||||
|
@ -2725,7 +2698,6 @@ gl843_init_regs_for_shading(Genesys_Device * dev, const Genesys_Sensor& sensor,
|
|||
Genesys_Register_Set& regs)
|
||||
{
|
||||
DBG_HELPER(dbg);
|
||||
SANE_Status status = SANE_STATUS_GOOD;
|
||||
int move, resolution, dpihw, factor;
|
||||
uint16_t strpixel;
|
||||
|
||||
|
@ -2807,17 +2779,11 @@ gl843_init_regs_for_shading(Genesys_Device * dev, const Genesys_Sensor& sensor,
|
|||
session.params.flags = flags;
|
||||
gl843_compute_session(dev, session, calib_sensor);
|
||||
|
||||
status = gl843_init_scan_regs(dev, calib_sensor, ®s, session);
|
||||
gl843_init_scan_regs(dev, calib_sensor, ®s, session);
|
||||
|
||||
// the pixel number may be updated to conform to scanner constraints
|
||||
dev->calib_pixels = dev->current_setup.pixels;
|
||||
|
||||
if (status != SANE_STATUS_GOOD)
|
||||
{
|
||||
DBG(DBG_error, "%s: failed to setup scan: %s\n", __func__, sane_strstatus(status));
|
||||
return status;
|
||||
}
|
||||
|
||||
dev->calib_total_bytes_to_read = dev->read_bytes_left;
|
||||
|
||||
dev->scanhead_position_in_steps += dev->calib_lines + move;
|
||||
|
@ -2842,8 +2808,6 @@ gl843_init_regs_for_scan (Genesys_Device * dev, const Genesys_Sensor& sensor)
|
|||
int move_dpi;
|
||||
float start;
|
||||
|
||||
SANE_Status status = SANE_STATUS_GOOD;
|
||||
|
||||
debug_dump(DBG_info, dev->settings);
|
||||
|
||||
/* channels */
|
||||
|
@ -2926,10 +2890,7 @@ gl843_init_regs_for_scan (Genesys_Device * dev, const Genesys_Sensor& sensor)
|
|||
session.params.flags = flags;
|
||||
gl843_compute_session(dev, session, sensor);
|
||||
|
||||
status = gl843_init_scan_regs(dev, sensor, &dev->reg, session);
|
||||
|
||||
if (status != SANE_STATUS_GOOD)
|
||||
return status;
|
||||
gl843_init_scan_regs(dev, sensor, &dev->reg, session);
|
||||
|
||||
return SANE_STATUS_GOOD;
|
||||
}
|
||||
|
@ -3025,13 +2986,7 @@ gl843_led_calibration (Genesys_Device * dev, Genesys_Sensor& sensor, Genesys_Reg
|
|||
SCAN_FLAG_IGNORE_LINE_DISTANCE;
|
||||
gl843_compute_session(dev, session, calib_sensor);
|
||||
|
||||
status = gl843_init_scan_regs(dev, calib_sensor, ®s, session);
|
||||
|
||||
if (status != SANE_STATUS_GOOD)
|
||||
{
|
||||
DBG(DBG_error, "%s: failed to setup scan: %s\n", __func__, sane_strstatus(status));
|
||||
return status;
|
||||
}
|
||||
gl843_init_scan_regs(dev, calib_sensor, ®s, session);
|
||||
|
||||
dev->model->cmd_set->bulk_write_register(dev, regs);
|
||||
|
||||
|
@ -3269,12 +3224,8 @@ gl843_offset_calibration(Genesys_Device * dev, const Genesys_Sensor& sensor,
|
|||
DBG(DBG_io, "%s: resolution =%d\n", __func__, resolution);
|
||||
DBG(DBG_io, "%s: pixels =%d\n", __func__, pixels);
|
||||
DBG(DBG_io, "%s: black_pixels=%d\n", __func__, black_pixels);
|
||||
status = gl843_init_scan_regs(dev, calib_sensor, ®s, session);
|
||||
if (status != SANE_STATUS_GOOD)
|
||||
{
|
||||
DBG(DBG_error, "%s: failed to setup scan: %s\n", __func__, sane_strstatus(status));
|
||||
return status;
|
||||
}
|
||||
gl843_init_scan_regs(dev, calib_sensor, ®s, session);
|
||||
|
||||
sanei_genesys_set_motor_power(regs, false);
|
||||
|
||||
/* allocate memory for scans */
|
||||
|
@ -3498,22 +3449,14 @@ gl843_coarse_gain_calibration(Genesys_Device * dev, const Genesys_Sensor& sensor
|
|||
pixels = session.output_pixels;
|
||||
|
||||
try {
|
||||
status = gl843_init_scan_regs(dev, calib_sensor, ®s, session);
|
||||
gl843_init_scan_regs(dev, calib_sensor, ®s, session);
|
||||
} catch (...) {
|
||||
try {
|
||||
sanei_genesys_set_motor_power(regs, false);
|
||||
} catch (...) {}
|
||||
catch_all_exceptions(__func__, [&](){ sanei_genesys_set_motor_power(regs, false); });
|
||||
throw;
|
||||
}
|
||||
|
||||
sanei_genesys_set_motor_power(regs, false);
|
||||
|
||||
if (status != SANE_STATUS_GOOD)
|
||||
{
|
||||
DBG(DBG_error, "%s: failed to setup scan: %s\n", __func__, sane_strstatus(status));
|
||||
return status;
|
||||
}
|
||||
|
||||
dev->model->cmd_set->bulk_write_register(dev, regs);
|
||||
|
||||
total_size = dev->read_bytes_left;
|
||||
|
@ -3634,7 +3577,6 @@ gl843_init_regs_for_warmup (Genesys_Device * dev,
|
|||
{
|
||||
DBG_HELPER(dbg);
|
||||
int num_pixels;
|
||||
SANE_Status status = SANE_STATUS_GOOD;
|
||||
int dpihw;
|
||||
int resolution;
|
||||
int factor;
|
||||
|
@ -3674,13 +3616,7 @@ gl843_init_regs_for_warmup (Genesys_Device * dev,
|
|||
SCAN_FLAG_IGNORE_LINE_DISTANCE;
|
||||
gl843_compute_session(dev, session, calib_sensor);
|
||||
|
||||
status = gl843_init_scan_regs(dev, calib_sensor, reg, session);
|
||||
|
||||
if (status != SANE_STATUS_GOOD)
|
||||
{
|
||||
DBG(DBG_error, "%s: failed to setup scan: %s\n", __func__, sane_strstatus(status));
|
||||
return status;
|
||||
}
|
||||
gl843_init_scan_regs(dev, calib_sensor, reg, session);
|
||||
|
||||
sanei_genesys_set_motor_power(*reg, false);
|
||||
dev->model->cmd_set->bulk_write_register(dev, *reg);
|
||||
|
@ -3959,12 +3895,7 @@ gl843_search_strip (Genesys_Device * dev, const Genesys_Sensor& sensor,
|
|||
session.params.flags = SCAN_FLAG_DISABLE_SHADING | SCAN_FLAG_DISABLE_SHADING;
|
||||
gl843_compute_session(dev, session, calib_sensor);
|
||||
|
||||
status = gl843_init_scan_regs(dev, calib_sensor, &local_reg, session);
|
||||
if (status != SANE_STATUS_GOOD)
|
||||
{
|
||||
DBG(DBG_error, "%s: failed to setup for scan: %s\n", __func__, sane_strstatus(status));
|
||||
return status;
|
||||
}
|
||||
gl843_init_scan_regs(dev, calib_sensor, &local_reg, session);
|
||||
|
||||
size = dev->read_bytes_left;
|
||||
std::vector<uint8_t> data(size);
|
||||
|
|
|
@ -1005,13 +1005,10 @@ static void gl846_init_optical_regs_scan(Genesys_Device* dev, const Genesys_Sens
|
|||
r->value = sensor.dummy_pixel;
|
||||
}
|
||||
|
||||
/* set up registers for an actual scan
|
||||
*
|
||||
* this function sets up the scanner to scan in normal or single line mode
|
||||
*/
|
||||
static SANE_Status
|
||||
gl846_init_scan_regs(Genesys_Device * dev, const Genesys_Sensor& sensor, Genesys_Register_Set * reg,
|
||||
SetupParams& params)
|
||||
// set up registers for an actual scan this function sets up the scanner to scan in normal or single
|
||||
// line mode
|
||||
static void gl846_init_scan_regs(Genesys_Device* dev, const Genesys_Sensor& sensor,
|
||||
Genesys_Register_Set* reg, SetupParams& params)
|
||||
{
|
||||
DBG_HELPER(dbg);
|
||||
params.assert_valid();
|
||||
|
@ -1226,8 +1223,6 @@ gl846_init_scan_regs(Genesys_Device * dev, const Genesys_Sensor& sensor, Genesys
|
|||
|
||||
DBG(DBG_info, "%s: total bytes to send = %lu\n", __func__, (u_long) dev->total_bytes_to_read);
|
||||
/* END TODO */
|
||||
|
||||
return SANE_STATUS_GOOD;
|
||||
}
|
||||
|
||||
static void
|
||||
|
@ -1570,13 +1565,8 @@ gl846_slow_back_home (Genesys_Device * dev, SANE_Bool wait_until_home)
|
|||
SCAN_FLAG_DISABLE_GAMMA |
|
||||
SCAN_FLAG_IGNORE_LINE_DISTANCE;
|
||||
|
||||
status = gl846_init_scan_regs(dev, sensor, &local_reg, params);
|
||||
gl846_init_scan_regs(dev, sensor, &local_reg, params);
|
||||
|
||||
if (status != SANE_STATUS_GOOD)
|
||||
{
|
||||
DBG(DBG_error, "%s: failed to set up registers: %s\n", __func__, sane_strstatus(status));
|
||||
return status;
|
||||
}
|
||||
dev->settings.scan_mode=scan_mode;
|
||||
|
||||
// clear scan and feed count
|
||||
|
@ -1683,13 +1673,7 @@ gl846_search_start_position (Genesys_Device * dev)
|
|||
SCAN_FLAG_DISABLE_GAMMA |
|
||||
SCAN_FLAG_IGNORE_LINE_DISTANCE;
|
||||
|
||||
status = gl846_init_scan_regs(dev, sensor, &local_reg, params);
|
||||
|
||||
if (status != SANE_STATUS_GOOD)
|
||||
{
|
||||
DBG(DBG_error, "%s: failed to set up registers: %s\n", __func__, sane_strstatus(status));
|
||||
return status;
|
||||
}
|
||||
gl846_init_scan_regs(dev, sensor, &local_reg, params);
|
||||
|
||||
// send to scanner
|
||||
dev->model->cmd_set->bulk_write_register(dev, local_reg);
|
||||
|
@ -1755,7 +1739,6 @@ gl846_init_regs_for_coarse_calibration(Genesys_Device * dev, const Genesys_Senso
|
|||
Genesys_Register_Set& regs)
|
||||
{
|
||||
DBG_HELPER(dbg);
|
||||
SANE_Status status = SANE_STATUS_GOOD;
|
||||
uint8_t channels;
|
||||
|
||||
/* set line size */
|
||||
|
@ -1782,13 +1765,7 @@ gl846_init_regs_for_coarse_calibration(Genesys_Device * dev, const Genesys_Senso
|
|||
SCAN_FLAG_SINGLE_LINE |
|
||||
SCAN_FLAG_IGNORE_LINE_DISTANCE;
|
||||
|
||||
status = gl846_init_scan_regs(dev, sensor, ®s, params);
|
||||
|
||||
if (status != SANE_STATUS_GOOD)
|
||||
{
|
||||
DBG(DBG_error, "%s: Failed to setup scan: %s\n", __func__, sane_strstatus(status));
|
||||
return status;
|
||||
}
|
||||
gl846_init_scan_regs(dev, sensor, ®s, params);
|
||||
|
||||
DBG(DBG_info, "%s: optical sensor res: %d dpi, actual res: %d\n", __func__,
|
||||
sensor.optical_res / sensor.ccd_pixels_per_system_pixel(), dev->settings.xres);
|
||||
|
@ -1835,13 +1812,7 @@ gl846_feed (Genesys_Device * dev, unsigned int steps)
|
|||
SCAN_FLAG_FEEDING |
|
||||
SCAN_FLAG_IGNORE_LINE_DISTANCE;
|
||||
|
||||
status = gl846_init_scan_regs(dev, sensor, &local_reg, params);
|
||||
|
||||
if (status != SANE_STATUS_GOOD)
|
||||
{
|
||||
DBG(DBG_error, "%s: failed to set up registers: %s\n", __func__, sane_strstatus(status));
|
||||
return status;
|
||||
}
|
||||
gl846_init_scan_regs(dev, sensor, &local_reg, params);
|
||||
|
||||
/* set exposure to zero */
|
||||
sanei_genesys_set_triple(&local_reg,REG_EXPR,0);
|
||||
|
@ -1904,7 +1875,6 @@ gl846_init_regs_for_shading(Genesys_Device * dev, const Genesys_Sensor& sensor,
|
|||
Genesys_Register_Set& regs)
|
||||
{
|
||||
DBG_HELPER(dbg);
|
||||
SANE_Status status = SANE_STATUS_GOOD;
|
||||
float move;
|
||||
|
||||
dev->calib_channels = 3;
|
||||
|
@ -1946,13 +1916,7 @@ gl846_init_regs_for_shading(Genesys_Device * dev, const Genesys_Sensor& sensor,
|
|||
SCAN_FLAG_DISABLE_BUFFER_FULL_MOVE |
|
||||
SCAN_FLAG_IGNORE_LINE_DISTANCE;
|
||||
|
||||
status = gl846_init_scan_regs(dev, sensor, ®s, params);
|
||||
|
||||
if (status != SANE_STATUS_GOOD)
|
||||
{
|
||||
DBG(DBG_error, "%s: failed to setup scan: %s\n", __func__, sane_strstatus(status));
|
||||
return status;
|
||||
}
|
||||
gl846_init_scan_regs(dev, sensor, ®s, params);
|
||||
|
||||
dev->model->cmd_set->bulk_write_register(dev, regs);
|
||||
|
||||
|
@ -2068,10 +2032,7 @@ gl846_init_regs_for_scan (Genesys_Device * dev, const Genesys_Sensor& sensor)
|
|||
params.color_filter = dev->settings.color_filter;
|
||||
params.flags = flags;
|
||||
|
||||
status = gl846_init_scan_regs(dev, sensor, &dev->reg, params);
|
||||
|
||||
if (status != SANE_STATUS_GOOD)
|
||||
return status;
|
||||
gl846_init_scan_regs(dev, sensor, &dev->reg, params);
|
||||
|
||||
return SANE_STATUS_GOOD;
|
||||
}
|
||||
|
@ -2225,13 +2186,7 @@ gl846_led_calibration (Genesys_Device * dev, Genesys_Sensor& sensor, Genesys_Reg
|
|||
SCAN_FLAG_SINGLE_LINE |
|
||||
SCAN_FLAG_IGNORE_LINE_DISTANCE;
|
||||
|
||||
status = gl846_init_scan_regs(dev, sensor, ®s, params);
|
||||
|
||||
if (status != SANE_STATUS_GOOD)
|
||||
{
|
||||
DBG(DBG_error, "%s: failed to setup scan: %s\n", __func__, sane_strstatus(status));
|
||||
return status;
|
||||
}
|
||||
gl846_init_scan_regs(dev, sensor, ®s, params);
|
||||
|
||||
total_size = num_pixels * channels * (depth/8) * 1; /* colors * bytes_per_color * scan lines */
|
||||
std::vector<uint8_t> line(total_size);
|
||||
|
@ -2593,13 +2548,7 @@ gl846_search_strip(Genesys_Device * dev, const Genesys_Sensor& sensor,
|
|||
params.flags = SCAN_FLAG_DISABLE_SHADING |
|
||||
SCAN_FLAG_DISABLE_GAMMA;
|
||||
|
||||
status = gl846_init_scan_regs(dev, sensor, &local_reg, params);
|
||||
|
||||
if (status != SANE_STATUS_GOOD)
|
||||
{
|
||||
DBG(DBG_error, "%s: failed to setup for scan: %s\n", __func__, sane_strstatus(status));
|
||||
return status;
|
||||
}
|
||||
gl846_init_scan_regs(dev, sensor, &local_reg, params);
|
||||
|
||||
/* set up for reverse or forward */
|
||||
r = sanei_genesys_get_address (&local_reg, REG02);
|
||||
|
@ -2862,13 +2811,8 @@ gl846_offset_calibration(Genesys_Device * dev, const Genesys_Sensor& sensor,
|
|||
SCAN_FLAG_SINGLE_LINE |
|
||||
SCAN_FLAG_IGNORE_LINE_DISTANCE;
|
||||
|
||||
status = gl846_init_scan_regs(dev, sensor, ®s, params);
|
||||
gl846_init_scan_regs(dev, sensor, ®s, params);
|
||||
|
||||
if (status != SANE_STATUS_GOOD)
|
||||
{
|
||||
DBG(DBG_error, "%s: failed to setup scan: %s\n", __func__, sane_strstatus(status));
|
||||
return status;
|
||||
}
|
||||
sanei_genesys_set_motor_power(regs, false);
|
||||
|
||||
/* allocate memory for scans */
|
||||
|
@ -3026,19 +2970,13 @@ gl846_coarse_gain_calibration(Genesys_Device * dev, const Genesys_Sensor& sensor
|
|||
SCAN_FLAG_IGNORE_LINE_DISTANCE;
|
||||
|
||||
try {
|
||||
status = gl846_init_scan_regs(dev, sensor, ®s, params);
|
||||
gl846_init_scan_regs(dev, sensor, ®s, params);
|
||||
} catch (...) {
|
||||
try {
|
||||
sanei_genesys_set_motor_power(regs, false);
|
||||
} catch (...) {}
|
||||
catch_all_exceptions(__func__, [&](){ sanei_genesys_set_motor_power(regs, false); });
|
||||
throw;
|
||||
}
|
||||
|
||||
if (status != SANE_STATUS_GOOD)
|
||||
{
|
||||
DBG(DBG_error, "%s: failed to setup scan: %s\n", __func__, sane_strstatus(status));
|
||||
return status;
|
||||
}
|
||||
sanei_genesys_set_motor_power(regs, false);
|
||||
|
||||
dev->model->cmd_set->bulk_write_register(dev, regs);
|
||||
|
||||
|
|
|
@ -342,7 +342,7 @@
|
|||
*
|
||||
* this function sets up the scanner to scan in normal or single line mode
|
||||
*/
|
||||
static SANE_Status gl846_init_scan_regs(Genesys_Device * dev, const Genesys_Sensor& sensor,
|
||||
static void gl846_init_scan_regs(Genesys_Device* dev, const Genesys_Sensor& sensor,
|
||||
Genesys_Register_Set* reg, SetupParams& params);
|
||||
|
||||
/* Send the low-level scan command */
|
||||
|
|
|
@ -1019,14 +1019,10 @@ static void gl847_init_optical_regs_scan(Genesys_Device* dev, const Genesys_Sens
|
|||
r->value = sensor.dummy_pixel;
|
||||
}
|
||||
|
||||
/* set up registers for an actual scan
|
||||
*
|
||||
* this function sets up the scanner to scan in normal or single line mode
|
||||
*/
|
||||
static SANE_Status
|
||||
gl847_init_scan_regs(Genesys_Device * dev, const Genesys_Sensor& sensor, Genesys_Register_Set * reg,
|
||||
SetupParams& params)
|
||||
|
||||
// set up registers for an actual scan this function sets up the scanner to scan in normal or single
|
||||
// line mode
|
||||
static void gl847_init_scan_regs(Genesys_Device* dev, const Genesys_Sensor& sensor,
|
||||
Genesys_Register_Set* reg, SetupParams& params)
|
||||
{
|
||||
DBG_HELPER(dbg);
|
||||
params.assert_valid();
|
||||
|
@ -1241,8 +1237,6 @@ gl847_init_scan_regs(Genesys_Device * dev, const Genesys_Sensor& sensor, Genesys
|
|||
|
||||
DBG(DBG_info, "%s: total bytes to send = %lu\n", __func__, (u_long) dev->total_bytes_to_read);
|
||||
/* END TODO */
|
||||
|
||||
return SANE_STATUS_GOOD;
|
||||
}
|
||||
|
||||
static void
|
||||
|
@ -1626,13 +1620,7 @@ gl847_slow_back_home (Genesys_Device * dev, SANE_Bool wait_until_home)
|
|||
SCAN_FLAG_DISABLE_GAMMA |
|
||||
SCAN_FLAG_IGNORE_LINE_DISTANCE;
|
||||
|
||||
status = gl847_init_scan_regs(dev, sensor, &local_reg, params);
|
||||
|
||||
if (status != SANE_STATUS_GOOD)
|
||||
{
|
||||
DBG(DBG_error, "%s: failed to set up registers: %s\n", __func__, sane_strstatus(status));
|
||||
return status;
|
||||
}
|
||||
gl847_init_scan_regs(dev, sensor, &local_reg, params);
|
||||
|
||||
dev->settings.scan_mode = scan_mode;
|
||||
|
||||
|
@ -1740,13 +1728,7 @@ gl847_search_start_position (Genesys_Device * dev)
|
|||
SCAN_FLAG_DISABLE_GAMMA |
|
||||
SCAN_FLAG_IGNORE_LINE_DISTANCE;
|
||||
|
||||
status = gl847_init_scan_regs(dev, sensor, &local_reg, params);
|
||||
|
||||
if (status != SANE_STATUS_GOOD)
|
||||
{
|
||||
DBG(DBG_error, "%s: failed to set up registers: %s\n", __func__, sane_strstatus(status));
|
||||
return status;
|
||||
}
|
||||
gl847_init_scan_regs(dev, sensor, &local_reg, params);
|
||||
|
||||
// send to scanner
|
||||
dev->model->cmd_set->bulk_write_register(dev, local_reg);
|
||||
|
@ -1812,7 +1794,6 @@ gl847_init_regs_for_coarse_calibration(Genesys_Device * dev, const Genesys_Senso
|
|||
Genesys_Register_Set& regs)
|
||||
{
|
||||
DBG_HELPER(dbg);
|
||||
SANE_Status status = SANE_STATUS_GOOD;
|
||||
uint8_t channels;
|
||||
|
||||
/* set line size */
|
||||
|
@ -1839,13 +1820,7 @@ gl847_init_regs_for_coarse_calibration(Genesys_Device * dev, const Genesys_Senso
|
|||
SCAN_FLAG_SINGLE_LINE |
|
||||
SCAN_FLAG_IGNORE_LINE_DISTANCE;
|
||||
|
||||
status = gl847_init_scan_regs(dev, sensor, ®s, params);
|
||||
|
||||
if (status != SANE_STATUS_GOOD)
|
||||
{
|
||||
DBG(DBG_error, "%s: Failed to setup scan: %s\n", __func__, sane_strstatus(status));
|
||||
return status;
|
||||
}
|
||||
gl847_init_scan_regs(dev, sensor, ®s, params);
|
||||
|
||||
DBG(DBG_info, "%s: optical sensor res: %d dpi, actual res: %d\n", __func__,
|
||||
sensor.optical_res / sensor.ccd_pixels_per_system_pixel(), dev->settings.xres);
|
||||
|
@ -1891,13 +1866,7 @@ gl847_feed (Genesys_Device * dev, unsigned int steps)
|
|||
SCAN_FLAG_FEEDING |
|
||||
SCAN_FLAG_IGNORE_LINE_DISTANCE;
|
||||
|
||||
status = gl847_init_scan_regs(dev, sensor, &local_reg, params);
|
||||
|
||||
if (status != SANE_STATUS_GOOD)
|
||||
{
|
||||
DBG(DBG_error, "%s: failed to set up registers: %s\n", __func__, sane_strstatus(status));
|
||||
return status;
|
||||
}
|
||||
gl847_init_scan_regs(dev, sensor, &local_reg, params);
|
||||
|
||||
/* set exposure to zero */
|
||||
sanei_genesys_set_triple(&local_reg,REG_EXPR,0);
|
||||
|
@ -1957,7 +1926,6 @@ gl847_init_regs_for_shading(Genesys_Device * dev, const Genesys_Sensor& sensor,
|
|||
Genesys_Register_Set& regs)
|
||||
{
|
||||
DBG_HELPER(dbg);
|
||||
SANE_Status status = SANE_STATUS_GOOD;
|
||||
float move;
|
||||
|
||||
dev->calib_channels = 3;
|
||||
|
@ -1999,13 +1967,7 @@ gl847_init_regs_for_shading(Genesys_Device * dev, const Genesys_Sensor& sensor,
|
|||
SCAN_FLAG_DISABLE_BUFFER_FULL_MOVE |
|
||||
SCAN_FLAG_IGNORE_LINE_DISTANCE;
|
||||
|
||||
status = gl847_init_scan_regs(dev, sensor, ®s, params);
|
||||
|
||||
if (status != SANE_STATUS_GOOD)
|
||||
{
|
||||
DBG(DBG_error, "%s: failed to setup scan: %s\n", __func__, sane_strstatus(status));
|
||||
return status;
|
||||
}
|
||||
gl847_init_scan_regs(dev, sensor, ®s, params);
|
||||
|
||||
dev->model->cmd_set->bulk_write_register(dev, regs);
|
||||
|
||||
|
@ -2121,10 +2083,7 @@ gl847_init_regs_for_scan (Genesys_Device * dev, const Genesys_Sensor& sensor)
|
|||
params.color_filter = dev->settings.color_filter;
|
||||
params.flags = flags;
|
||||
|
||||
status = gl847_init_scan_regs(dev, sensor, &dev->reg, params);
|
||||
|
||||
if (status != SANE_STATUS_GOOD)
|
||||
return status;
|
||||
gl847_init_scan_regs(dev, sensor, &dev->reg, params);
|
||||
|
||||
return SANE_STATUS_GOOD;
|
||||
}
|
||||
|
@ -2278,13 +2237,7 @@ gl847_led_calibration (Genesys_Device * dev, Genesys_Sensor& sensor, Genesys_Reg
|
|||
SCAN_FLAG_SINGLE_LINE |
|
||||
SCAN_FLAG_IGNORE_LINE_DISTANCE;
|
||||
|
||||
status = gl847_init_scan_regs(dev, sensor, ®s, params);
|
||||
|
||||
if (status != SANE_STATUS_GOOD)
|
||||
{
|
||||
DBG(DBG_error, "%s: failed to setup scan: %s\n", __func__, sane_strstatus(status));
|
||||
return status;
|
||||
}
|
||||
gl847_init_scan_regs(dev, sensor, ®s, params);
|
||||
|
||||
total_size = num_pixels * channels * (depth/8) * 1; /* colors * bytes_per_color * scan lines */
|
||||
std::vector<uint8_t> line(total_size);
|
||||
|
@ -2686,13 +2639,7 @@ gl847_search_strip (Genesys_Device * dev, const Genesys_Sensor& sensor,
|
|||
params.flags = SCAN_FLAG_DISABLE_SHADING |
|
||||
SCAN_FLAG_DISABLE_GAMMA;
|
||||
|
||||
status = gl847_init_scan_regs(dev, sensor, &local_reg, params);
|
||||
|
||||
if (status != SANE_STATUS_GOOD)
|
||||
{
|
||||
DBG(DBG_error, "%s: failed to setup for scan: %s\n", __func__, sane_strstatus(status));
|
||||
return status;
|
||||
}
|
||||
gl847_init_scan_regs(dev, sensor, &local_reg, params);
|
||||
|
||||
/* set up for reverse or forward */
|
||||
r = sanei_genesys_get_address(&local_reg, REG02);
|
||||
|
@ -2955,13 +2902,8 @@ gl847_offset_calibration(Genesys_Device * dev, const Genesys_Sensor& sensor,
|
|||
SCAN_FLAG_SINGLE_LINE |
|
||||
SCAN_FLAG_IGNORE_LINE_DISTANCE;
|
||||
|
||||
status = gl847_init_scan_regs(dev, sensor, ®s, params);
|
||||
gl847_init_scan_regs(dev, sensor, ®s, params);
|
||||
|
||||
if (status != SANE_STATUS_GOOD)
|
||||
{
|
||||
DBG(DBG_error, "%s: failed to setup scan: %s\n", __func__, sane_strstatus(status));
|
||||
return status;
|
||||
}
|
||||
sanei_genesys_set_motor_power(regs, false);
|
||||
|
||||
/* allocate memory for scans */
|
||||
|
@ -3117,22 +3059,14 @@ gl847_coarse_gain_calibration(Genesys_Device * dev, const Genesys_Sensor& sensor
|
|||
SCAN_FLAG_IGNORE_LINE_DISTANCE;
|
||||
|
||||
try {
|
||||
status = gl847_init_scan_regs(dev, sensor, ®s, params);
|
||||
gl847_init_scan_regs(dev, sensor, ®s, params);
|
||||
} catch (...) {
|
||||
try {
|
||||
sanei_genesys_set_motor_power(regs, false);
|
||||
} catch (...) {}
|
||||
catch_all_exceptions(__func__, [&](){ sanei_genesys_set_motor_power(regs, false); });
|
||||
throw;
|
||||
}
|
||||
|
||||
sanei_genesys_set_motor_power(regs, false);
|
||||
|
||||
if (status != SANE_STATUS_GOOD)
|
||||
{
|
||||
DBG(DBG_error, "%s: failed to setup scan: %s\n", __func__, sane_strstatus(status));
|
||||
return status;
|
||||
}
|
||||
|
||||
dev->model->cmd_set->bulk_write_register(dev, regs);
|
||||
|
||||
total_size = pixels * channels * (16/bpp) * lines;
|
||||
|
|
|
@ -326,7 +326,7 @@
|
|||
*
|
||||
* this function sets up the scanner to scan in normal or single line mode
|
||||
*/
|
||||
static SANE_Status gl847_init_scan_regs(Genesys_Device * dev, const Genesys_Sensor& sensor,
|
||||
static void gl847_init_scan_regs(Genesys_Device* dev, const Genesys_Sensor& sensor,
|
||||
Genesys_Register_Set* reg, SetupParams& params);
|
||||
|
||||
/* Send the low-level scan command */
|
||||
|
|
Ładowanie…
Reference in New Issue