kopia lustrzana https://gitlab.com/sane-project/backends
genesys: Return errors as exceptions from *init_regs_for_warmup()
rodzic
7514468332
commit
61f74af249
|
@ -3421,13 +3421,11 @@ genesys_warmup_lamp (Genesys_Device * dev)
|
||||||
double second_average = 0;
|
double second_average = 0;
|
||||||
int difference = 255;
|
int difference = 255;
|
||||||
int empty, lines = 3;
|
int empty, lines = 3;
|
||||||
SANE_Status status = SANE_STATUS_IO_ERROR;
|
SANE_Status status = SANE_STATUS_GOOD;
|
||||||
|
|
||||||
/* check if the current chipset implements warmup */
|
/* check if the current chipset implements warmup */
|
||||||
if(dev->model->cmd_set->init_regs_for_warmup==NULL)
|
if (dev->model->cmd_set->init_regs_for_warmup == NULL) {
|
||||||
{
|
throw SaneException("init_regs_for_warmup not implemented");
|
||||||
DBG(DBG_error,"%s: init_regs_for_warmup not implemented\n", __func__);
|
|
||||||
return status;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
const auto& sensor = sanei_genesys_find_sensor_any(dev);
|
const auto& sensor = sanei_genesys_find_sensor_any(dev);
|
||||||
|
|
|
@ -2868,22 +2868,14 @@ gl124_coarse_gain_calibration(Genesys_Device * dev, const Genesys_Sensor& sensor
|
||||||
return status;
|
return status;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
// wait for lamp warmup by scanning the same line until difference
|
||||||
* wait for lamp warmup by scanning the same line until difference
|
// between 2 scans is below a threshold
|
||||||
* between 2 scans is below a threshold
|
static void gl124_init_regs_for_warmup(Genesys_Device* dev, const Genesys_Sensor& sensor,
|
||||||
*/
|
Genesys_Register_Set* reg, int* channels, int* total_size)
|
||||||
static SANE_Status
|
|
||||||
gl124_init_regs_for_warmup (Genesys_Device * dev,
|
|
||||||
const Genesys_Sensor& sensor,
|
|
||||||
Genesys_Register_Set * reg,
|
|
||||||
int *channels, int *total_size)
|
|
||||||
{
|
{
|
||||||
DBG_HELPER(dbg);
|
DBG_HELPER(dbg);
|
||||||
int num_pixels;
|
int num_pixels;
|
||||||
|
|
||||||
if (dev == NULL || reg == NULL || channels == NULL || total_size == NULL)
|
|
||||||
return SANE_STATUS_INVAL;
|
|
||||||
|
|
||||||
*channels=3;
|
*channels=3;
|
||||||
|
|
||||||
*reg = dev->reg;
|
*reg = dev->reg;
|
||||||
|
@ -2913,8 +2905,6 @@ gl124_init_regs_for_warmup (Genesys_Device * dev,
|
||||||
|
|
||||||
sanei_genesys_set_motor_power(*reg, false);
|
sanei_genesys_set_motor_power(*reg, false);
|
||||||
dev->model->cmd_set->bulk_write_register(dev, *reg);
|
dev->model->cmd_set->bulk_write_register(dev, *reg);
|
||||||
|
|
||||||
return SANE_STATUS_GOOD;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/** @brief default GPIO values
|
/** @brief default GPIO values
|
||||||
|
|
|
@ -3218,14 +3218,11 @@ gl646_coarse_gain_calibration(Genesys_Device * dev, const Genesys_Sensor& sensor
|
||||||
* sets up the scanner's register for warming up. We scan 2 lines without moving.
|
* sets up the scanner's register for warming up. We scan 2 lines without moving.
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
static SANE_Status
|
static void gl646_init_regs_for_warmup(Genesys_Device* dev, const Genesys_Sensor& sensor,
|
||||||
gl646_init_regs_for_warmup (Genesys_Device * dev,
|
Genesys_Register_Set* local_reg, int* channels,
|
||||||
const Genesys_Sensor& sensor,
|
int* total_size)
|
||||||
Genesys_Register_Set * local_reg,
|
|
||||||
int *channels, int *total_size)
|
|
||||||
{
|
{
|
||||||
DBG_HELPER(dbg);
|
DBG_HELPER(dbg);
|
||||||
SANE_Status status = SANE_STATUS_GOOD;
|
|
||||||
Genesys_Settings settings;
|
Genesys_Settings settings;
|
||||||
int resolution, lines;
|
int resolution, lines;
|
||||||
|
|
||||||
|
@ -3275,8 +3272,6 @@ gl646_init_regs_for_warmup (Genesys_Device * dev,
|
||||||
// now registers are ok, write them to scanner
|
// now registers are ok, write them to scanner
|
||||||
gl646_set_fe(dev, sensor, AFE_SET, settings.xres);
|
gl646_set_fe(dev, sensor, AFE_SET, settings.xres);
|
||||||
sanei_genesys_bulk_write_register(dev, *local_reg);
|
sanei_genesys_bulk_write_register(dev, *local_reg);
|
||||||
|
|
||||||
return status;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -4144,20 +4144,14 @@ gl841_coarse_gain_calibration(Genesys_Device * dev, const Genesys_Sensor& sensor
|
||||||
return status;
|
return status;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
// wait for lamp warmup by scanning the same line until difference
|
||||||
* wait for lamp warmup by scanning the same line until difference
|
// between 2 scans is below a threshold
|
||||||
* between 2 scans is below a threshold
|
static void gl841_init_regs_for_warmup(Genesys_Device* dev, const Genesys_Sensor& sensor,
|
||||||
*/
|
Genesys_Register_Set* local_reg, int* channels,
|
||||||
static SANE_Status
|
int* total_size)
|
||||||
gl841_init_regs_for_warmup (Genesys_Device * dev,
|
|
||||||
const Genesys_Sensor& sensor,
|
|
||||||
Genesys_Register_Set * local_reg,
|
|
||||||
int *channels, int *total_size)
|
|
||||||
{
|
{
|
||||||
DBG_HELPER(dbg);
|
DBG_HELPER(dbg);
|
||||||
int num_pixels = (int) (4 * 300);
|
int num_pixels = (int) (4 * 300);
|
||||||
SANE_Status status = SANE_STATUS_GOOD;
|
|
||||||
|
|
||||||
*local_reg = dev->reg;
|
*local_reg = dev->reg;
|
||||||
|
|
||||||
/* okay.. these should be defaults stored somewhere */
|
/* okay.. these should be defaults stored somewhere */
|
||||||
|
@ -4197,8 +4191,6 @@ gl841_init_regs_for_warmup (Genesys_Device * dev,
|
||||||
*total_size = num_pixels * 3 * 2 * 1; /* colors * bytes_per_color * scan lines */
|
*total_size = num_pixels * 3 * 2 * 1; /* colors * bytes_per_color * scan lines */
|
||||||
|
|
||||||
sanei_genesys_bulk_write_register(dev, *local_reg);
|
sanei_genesys_bulk_write_register(dev, *local_reg);
|
||||||
|
|
||||||
return status;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -3445,15 +3445,10 @@ gl843_coarse_gain_calibration(Genesys_Device * dev, const Genesys_Sensor& sensor
|
||||||
return status;
|
return status;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
// wait for lamp warmup by scanning the same line until difference
|
||||||
* wait for lamp warmup by scanning the same line until difference
|
// between 2 scans is below a threshold
|
||||||
* between 2 scans is below a threshold
|
static void gl843_init_regs_for_warmup(Genesys_Device* dev, const Genesys_Sensor& sensor,
|
||||||
*/
|
Genesys_Register_Set* reg, int* channels, int* total_size)
|
||||||
static SANE_Status
|
|
||||||
gl843_init_regs_for_warmup (Genesys_Device * dev,
|
|
||||||
const Genesys_Sensor& sensor,
|
|
||||||
Genesys_Register_Set * reg,
|
|
||||||
int *channels, int *total_size)
|
|
||||||
{
|
{
|
||||||
DBG_HELPER(dbg);
|
DBG_HELPER(dbg);
|
||||||
int num_pixels;
|
int num_pixels;
|
||||||
|
@ -3461,9 +3456,6 @@ gl843_init_regs_for_warmup (Genesys_Device * dev,
|
||||||
int resolution;
|
int resolution;
|
||||||
int factor;
|
int factor;
|
||||||
|
|
||||||
if (dev == NULL || reg == NULL || channels == NULL || total_size == NULL)
|
|
||||||
return SANE_STATUS_INVAL;
|
|
||||||
|
|
||||||
/* setup scan */
|
/* setup scan */
|
||||||
*channels=3;
|
*channels=3;
|
||||||
resolution=600;
|
resolution=600;
|
||||||
|
@ -3500,8 +3492,6 @@ gl843_init_regs_for_warmup (Genesys_Device * dev,
|
||||||
|
|
||||||
sanei_genesys_set_motor_power(*reg, false);
|
sanei_genesys_set_motor_power(*reg, false);
|
||||||
dev->model->cmd_set->bulk_write_register(dev, *reg);
|
dev->model->cmd_set->bulk_write_register(dev, *reg);
|
||||||
|
|
||||||
return SANE_STATUS_GOOD;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -1045,10 +1045,8 @@ struct Genesys_Command_Set
|
||||||
/** For ASIC initialization */
|
/** For ASIC initialization */
|
||||||
void (*init) (Genesys_Device* dev);
|
void (*init) (Genesys_Device* dev);
|
||||||
|
|
||||||
SANE_Status (*init_regs_for_warmup) (Genesys_Device * dev,
|
void (*init_regs_for_warmup) (Genesys_Device* dev, const Genesys_Sensor& sensor,
|
||||||
const Genesys_Sensor& sensor,
|
Genesys_Register_Set* regs, int*channels, int* total_size);
|
||||||
Genesys_Register_Set * regs,
|
|
||||||
int *channels, int *total_size);
|
|
||||||
void (*init_regs_for_coarse_calibration) (Genesys_Device* dev, const Genesys_Sensor& sensor,
|
void (*init_regs_for_coarse_calibration) (Genesys_Device* dev, const Genesys_Sensor& sensor,
|
||||||
Genesys_Register_Set& regs);
|
Genesys_Register_Set& regs);
|
||||||
SANE_Status (*init_regs_for_shading) (Genesys_Device * dev, const Genesys_Sensor& sensor,
|
SANE_Status (*init_regs_for_shading) (Genesys_Device * dev, const Genesys_Sensor& sensor,
|
||||||
|
|
Ładowanie…
Reference in New Issue