kopia lustrzana https://gitlab.com/sane-project/backends
genesys: Return errors as exceptions from remaining functions
rodzic
c036024810
commit
faa078cd21
|
@ -2305,14 +2305,12 @@ static void gl124_send_shading_data(Genesys_Device* dev, const Genesys_Sensor& s
|
||||||
* by doing a 600 dpi scan
|
* by doing a 600 dpi scan
|
||||||
* @param dev scanner device
|
* @param dev scanner device
|
||||||
*/
|
*/
|
||||||
static SANE_Status
|
static void move_to_calibration_area(Genesys_Device* dev, const Genesys_Sensor& sensor,
|
||||||
move_to_calibration_area (Genesys_Device * dev, const Genesys_Sensor& sensor,
|
|
||||||
Genesys_Register_Set& regs)
|
Genesys_Register_Set& regs)
|
||||||
{
|
{
|
||||||
DBG_HELPER(dbg);
|
DBG_HELPER(dbg);
|
||||||
int pixels;
|
int pixels;
|
||||||
int size;
|
int size;
|
||||||
SANE_Status status = SANE_STATUS_GOOD;
|
|
||||||
|
|
||||||
pixels = (sensor.sensor_pixels*600)/sensor.optical_res;
|
pixels = (sensor.sensor_pixels*600)/sensor.optical_res;
|
||||||
|
|
||||||
|
@ -2355,8 +2353,6 @@ move_to_calibration_area (Genesys_Device * dev, const Genesys_Sensor& sensor,
|
||||||
{
|
{
|
||||||
sanei_genesys_write_pnm_file("gl124_movetocalarea.pnm", line.data(), 8, 3, pixels, 1);
|
sanei_genesys_write_pnm_file("gl124_movetocalarea.pnm", line.data(), 8, 3, pixels, 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
return status;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* this function does the led calibration by scanning one line of the calibration
|
/* this function does the led calibration by scanning one line of the calibration
|
||||||
|
|
|
@ -3450,11 +3450,7 @@ static void gl646_move_to_ta(Genesys_Device* dev)
|
||||||
{
|
{
|
||||||
DBG_HELPER(dbg);
|
DBG_HELPER(dbg);
|
||||||
|
|
||||||
if (simple_move(dev, SANE_UNFIX(dev->model->y_offset_sensor_to_ta)) != SANE_STATUS_GOOD)
|
simple_move(dev, SANE_UNFIX(dev->model->y_offset_sensor_to_ta));
|
||||||
{
|
|
||||||
DBG(DBG_error, "%s: failed to move to calibration area\n", __func__);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -3647,11 +3643,9 @@ static void simple_scan(Genesys_Device* dev, const Genesys_Sensor& sensor,
|
||||||
* @param dev device of the scanner
|
* @param dev device of the scanner
|
||||||
* @param distance distance to move in MM
|
* @param distance distance to move in MM
|
||||||
*/
|
*/
|
||||||
static SANE_Status
|
static void simple_move(Genesys_Device* dev, SANE_Int distance)
|
||||||
simple_move (Genesys_Device * dev, SANE_Int distance)
|
|
||||||
{
|
{
|
||||||
DBG_HELPER_ARGS(dbg, "%d mm", distance);
|
DBG_HELPER_ARGS(dbg, "%d mm", distance);
|
||||||
SANE_Status status = SANE_STATUS_GOOD;
|
|
||||||
Genesys_Settings settings;
|
Genesys_Settings settings;
|
||||||
|
|
||||||
int resolution = get_lowest_resolution(dev->model->ccd_type, 3);
|
int resolution = get_lowest_resolution(dev->model->ccd_type, 3);
|
||||||
|
@ -3677,9 +3671,6 @@ simple_move (Genesys_Device * dev, SANE_Int distance)
|
||||||
|
|
||||||
std::vector<uint8_t> data;
|
std::vector<uint8_t> data;
|
||||||
simple_scan(dev, sensor, settings, SANE_TRUE, SANE_TRUE, SANE_FALSE, data);
|
simple_scan(dev, sensor, settings, SANE_TRUE, SANE_TRUE, SANE_FALSE, data);
|
||||||
|
|
||||||
|
|
||||||
return status;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -214,8 +214,7 @@ static void gl646_setup_registers(Genesys_Device* dev,
|
||||||
* @param dev device of the scanner
|
* @param dev device of the scanner
|
||||||
* @param distance distance to move in MM
|
* @param distance distance to move in MM
|
||||||
*/
|
*/
|
||||||
static SANE_Status
|
static void simple_move(Genesys_Device* dev, SANE_Int distance);
|
||||||
simple_move (Genesys_Device * dev, SANE_Int distance);
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Does a simple scan of the area given by the settings. Scanned data
|
* Does a simple scan of the area given by the settings. Scanned data
|
||||||
|
|
|
@ -64,9 +64,8 @@
|
||||||
/* Read and write RAM, registers and AFE */
|
/* Read and write RAM, registers and AFE */
|
||||||
/* ------------------------------------------------------------------------ */
|
/* ------------------------------------------------------------------------ */
|
||||||
|
|
||||||
/* Set address for writing data */
|
// Set address for writing data
|
||||||
static SANE_Status
|
static void gl841_set_buffer_address_gamma(Genesys_Device* dev, uint32_t addr)
|
||||||
gl841_set_buffer_address_gamma (Genesys_Device * dev, uint32_t addr)
|
|
||||||
{
|
{
|
||||||
DBG_HELPER_ARGS(dbg, "setting address to 0x%05x", addr & 0xfffffff0);
|
DBG_HELPER_ARGS(dbg, "setting address to 0x%05x", addr & 0xfffffff0);
|
||||||
|
|
||||||
|
@ -76,8 +75,6 @@ gl841_set_buffer_address_gamma (Genesys_Device * dev, uint32_t addr)
|
||||||
|
|
||||||
addr = addr >> 8;
|
addr = addr >> 8;
|
||||||
sanei_genesys_write_register(dev, 0x5b, (addr & 0xff));
|
sanei_genesys_write_register(dev, 0x5b, (addr & 0xff));
|
||||||
|
|
||||||
return SANE_STATUS_GOOD;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
|
@ -941,7 +938,7 @@ static void gl841_init_motor_regs_off(Genesys_Register_Set* reg, unsigned int sc
|
||||||
* @param dev device to set up motor
|
* @param dev device to set up motor
|
||||||
* @param ydpi motor target resolution
|
* @param ydpi motor target resolution
|
||||||
*/
|
*/
|
||||||
static SANE_Status gl841_write_freq(Genesys_Device *dev, unsigned int ydpi)
|
static void gl841_write_freq(Genesys_Device* dev, unsigned int ydpi)
|
||||||
{
|
{
|
||||||
DBG_HELPER(dbg);
|
DBG_HELPER(dbg);
|
||||||
/**< fast table */
|
/**< fast table */
|
||||||
|
@ -978,18 +975,13 @@ uint8_t *table;
|
||||||
sanei_genesys_write_register(dev, 0x5b, 0x00);
|
sanei_genesys_write_register(dev, 0x5b, 0x00);
|
||||||
sanei_genesys_write_register(dev, 0x5c, 0x00);
|
sanei_genesys_write_register(dev, 0x5c, 0x00);
|
||||||
}
|
}
|
||||||
return SANE_STATUS_GOOD;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static SANE_Status
|
static void gl841_init_motor_regs(Genesys_Device* dev, const Genesys_Sensor& sensor,
|
||||||
gl841_init_motor_regs(Genesys_Device * dev,
|
Genesys_Register_Set* reg, unsigned int feed_steps,/*1/base_ydpi*/
|
||||||
const Genesys_Sensor& sensor,
|
/*maybe float for half/quarter step resolution?*/
|
||||||
Genesys_Register_Set * reg,
|
unsigned int action, unsigned int flags)
|
||||||
unsigned int feed_steps,/*1/base_ydpi*/
|
|
||||||
/*maybe float for half/quarter step resolution?*/
|
|
||||||
unsigned int action,
|
|
||||||
unsigned int flags)
|
|
||||||
{
|
{
|
||||||
DBG_HELPER_ARGS(dbg, "feed_steps=%d, action=%d, flags=%x", feed_steps, action, flags);
|
DBG_HELPER_ARGS(dbg, "feed_steps=%d, action=%d, flags=%x", feed_steps, action, flags);
|
||||||
unsigned int fast_exposure;
|
unsigned int fast_exposure;
|
||||||
|
@ -1134,8 +1126,6 @@ HOME_FREE: 3
|
||||||
|
|
||||||
r = sanei_genesys_get_address(reg, 0x5f);
|
r = sanei_genesys_get_address(reg, 0x5f);
|
||||||
r->value = (fast_slope_steps >> 1) + (fast_slope_steps & 1);
|
r->value = (fast_slope_steps >> 1) + (fast_slope_steps & 1);
|
||||||
|
|
||||||
return SANE_STATUS_GOOD;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void gl841_init_motor_regs_scan(Genesys_Device* dev, const Genesys_Sensor& sensor,
|
static void gl841_init_motor_regs_scan(Genesys_Device* dev, const Genesys_Sensor& sensor,
|
||||||
|
@ -1465,16 +1455,13 @@ gl841_get_dpihw(Genesys_Device * dev)
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static SANE_Status
|
static void gl841_init_optical_regs_off(Genesys_Register_Set* reg)
|
||||||
gl841_init_optical_regs_off(Genesys_Register_Set * reg)
|
|
||||||
{
|
{
|
||||||
DBG_HELPER(dbg);
|
DBG_HELPER(dbg);
|
||||||
GenesysRegister* r;
|
GenesysRegister* r;
|
||||||
|
|
||||||
r = sanei_genesys_get_address(reg, 0x01);
|
r = sanei_genesys_get_address(reg, 0x01);
|
||||||
r->value &= ~REG01_SCAN;
|
r->value &= ~REG01_SCAN;
|
||||||
|
|
||||||
return SANE_STATUS_GOOD;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void gl841_init_optical_regs_scan(Genesys_Device* dev, const Genesys_Sensor& sensor,
|
static void gl841_init_optical_regs_scan(Genesys_Device* dev, const Genesys_Sensor& sensor,
|
||||||
|
|
|
@ -2269,11 +2269,9 @@ static void gl847_init_gpio(Genesys_Device* dev)
|
||||||
/**
|
/**
|
||||||
* set memory layout by filling values in dedicated registers
|
* set memory layout by filling values in dedicated registers
|
||||||
*/
|
*/
|
||||||
static SANE_Status
|
static void gl847_init_memory_layout(Genesys_Device* dev)
|
||||||
gl847_init_memory_layout (Genesys_Device * dev)
|
|
||||||
{
|
{
|
||||||
DBG_HELPER(dbg);
|
DBG_HELPER(dbg);
|
||||||
SANE_Status status = SANE_STATUS_GOOD;
|
|
||||||
int idx = 0;
|
int idx = 0;
|
||||||
uint8_t val;
|
uint8_t val;
|
||||||
|
|
||||||
|
@ -2349,8 +2347,6 @@ gl847_init_memory_layout (Genesys_Device * dev)
|
||||||
sanei_genesys_write_register (dev, 0xf5, layouts[idx].re5);
|
sanei_genesys_write_register (dev, 0xf5, layouts[idx].re5);
|
||||||
sanei_genesys_write_register (dev, 0xf6, layouts[idx].re6);
|
sanei_genesys_write_register (dev, 0xf6, layouts[idx].re6);
|
||||||
sanei_genesys_write_register (dev, 0xf7, layouts[idx].re7);
|
sanei_genesys_write_register (dev, 0xf7, layouts[idx].re7);
|
||||||
|
|
||||||
return status;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* *
|
/* *
|
||||||
|
|
Ładowanie…
Reference in New Issue