kopia lustrzana https://gitlab.com/sane-project/backends
genesys: Return errors as exceptions from *init()
rodzic
67f187bceb
commit
867d907bb9
|
@ -6134,9 +6134,9 @@ sane_open_impl(SANE_String_Const devicename, SANE_Handle * handle)
|
||||||
|
|
||||||
sanei_genesys_init_cmd_set(s->dev);
|
sanei_genesys_init_cmd_set(s->dev);
|
||||||
|
|
||||||
// FIXME: we create sensor tables for the sensor, this should happen when we know which sensor
|
// FIXME: we create sensor tables for the sensor, this should happen when we know which sensor
|
||||||
// we will select
|
// we will select
|
||||||
RIE (dev->model->cmd_set->init(dev));
|
dev->model->cmd_set->init(dev);
|
||||||
|
|
||||||
/* some hardware capabilities are detected through sensors */
|
/* some hardware capabilities are detected through sensors */
|
||||||
RIE (s->dev->model->cmd_set->update_hardware_sensors (s));
|
RIE (s->dev->model->cmd_set->update_hardware_sensors (s));
|
||||||
|
|
|
@ -3028,17 +3028,12 @@ static void gl124_init_memory_layout(Genesys_Device* dev)
|
||||||
* initialize backend and ASIC : registers, motor tables, and gamma tables
|
* initialize backend and ASIC : registers, motor tables, and gamma tables
|
||||||
* then ensure scanner's head is at home
|
* then ensure scanner's head is at home
|
||||||
*/
|
*/
|
||||||
static SANE_Status
|
static void gl124_init(Genesys_Device* dev)
|
||||||
gl124_init(Genesys_Device * dev)
|
|
||||||
{
|
{
|
||||||
SANE_Status status = SANE_STATUS_GOOD;
|
|
||||||
|
|
||||||
DBG_INIT ();
|
DBG_INIT ();
|
||||||
DBG_HELPER(dbg);
|
DBG_HELPER(dbg);
|
||||||
|
|
||||||
status=sanei_genesys_asic_init(dev, 0);
|
sanei_genesys_asic_init(dev, 0);
|
||||||
|
|
||||||
return status;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -470,7 +470,7 @@ static void gl124_begin_scan(Genesys_Device* dev, const Genesys_Sensor& sensor,
|
||||||
Genesys_Register_Set* reg, SANE_Bool start_motor);
|
Genesys_Register_Set* reg, SANE_Bool start_motor);
|
||||||
static void gl124_end_scan(Genesys_Device* dev, Genesys_Register_Set* reg, SANE_Bool check_stop);
|
static void gl124_end_scan(Genesys_Device* dev, Genesys_Register_Set* reg, SANE_Bool check_stop);
|
||||||
static void gl124_slow_back_home(Genesys_Device* dev, SANE_Bool wait_until_home);
|
static void gl124_slow_back_home(Genesys_Device* dev, SANE_Bool wait_until_home);
|
||||||
static SANE_Status gl124_init(Genesys_Device * dev);
|
static void gl124_init(Genesys_Device* dev);
|
||||||
static void gl124_send_shading_data(Genesys_Device* dev, const Genesys_Sensor& sensor,
|
static void gl124_send_shading_data(Genesys_Device* dev, const Genesys_Sensor& sensor,
|
||||||
uint8_t* data, int size);
|
uint8_t* data, int size);
|
||||||
|
|
||||||
|
|
|
@ -3394,8 +3394,7 @@ static void gl646_repark_head(Genesys_Device* dev)
|
||||||
* @param dev device description of the scanner to initailize
|
* @param dev device description of the scanner to initailize
|
||||||
* @return SANE_STATUS_GOOD if success, error code if failure
|
* @return SANE_STATUS_GOOD if success, error code if failure
|
||||||
*/
|
*/
|
||||||
static SANE_Status
|
static void gl646_init(Genesys_Device* dev)
|
||||||
gl646_init (Genesys_Device * dev)
|
|
||||||
{
|
{
|
||||||
DBG_INIT();
|
DBG_INIT();
|
||||||
DBG_HELPER(dbg);
|
DBG_HELPER(dbg);
|
||||||
|
@ -3553,8 +3552,6 @@ gl646_init (Genesys_Device * dev)
|
||||||
|
|
||||||
/* here session and device are initialized */
|
/* here session and device are initialized */
|
||||||
dev->already_initialized = SANE_TRUE;
|
dev->already_initialized = SANE_TRUE;
|
||||||
|
|
||||||
return SANE_STATUS_GOOD;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static
|
static
|
||||||
|
|
|
@ -4269,8 +4269,7 @@ gl841_is_compatible_calibration (Genesys_Device * dev, const Genesys_Sensor& sen
|
||||||
* initialize ASIC : registers, motor tables, and gamma tables
|
* initialize ASIC : registers, motor tables, and gamma tables
|
||||||
* then ensure scanner's head is at home
|
* then ensure scanner's head is at home
|
||||||
*/
|
*/
|
||||||
static SANE_Status
|
static void gl841_init(Genesys_Device* dev)
|
||||||
gl841_init (Genesys_Device * dev)
|
|
||||||
{
|
{
|
||||||
uint8_t val;
|
uint8_t val;
|
||||||
size_t size;
|
size_t size;
|
||||||
|
@ -4287,7 +4286,7 @@ gl841_init (Genesys_Device * dev)
|
||||||
if (val & REG41_PWRBIT)
|
if (val & REG41_PWRBIT)
|
||||||
{
|
{
|
||||||
DBG(DBG_info, "%s: already initialized\n", __func__);
|
DBG(DBG_info, "%s: already initialized\n", __func__);
|
||||||
return SANE_STATUS_GOOD;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -4381,8 +4380,6 @@ gl841_init (Genesys_Device * dev)
|
||||||
// Set powersaving(default = 15 minutes)
|
// Set powersaving(default = 15 minutes)
|
||||||
gl841_set_powersaving(dev, 15);
|
gl841_set_powersaving(dev, 15);
|
||||||
dev->already_initialized = SANE_TRUE;
|
dev->already_initialized = SANE_TRUE;
|
||||||
|
|
||||||
return SANE_STATUS_GOOD;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static SANE_Status
|
static SANE_Status
|
||||||
|
|
|
@ -3645,17 +3645,12 @@ static void gl843_boot(Genesys_Device* dev, SANE_Bool cold)
|
||||||
* initialize backend and ASIC : registers, motor tables, and gamma tables
|
* initialize backend and ASIC : registers, motor tables, and gamma tables
|
||||||
* then ensure scanner's head is at home
|
* then ensure scanner's head is at home
|
||||||
*/
|
*/
|
||||||
static SANE_Status
|
static void gl843_init(Genesys_Device* dev)
|
||||||
gl843_init (Genesys_Device * dev)
|
|
||||||
{
|
{
|
||||||
SANE_Status status = SANE_STATUS_GOOD;
|
|
||||||
|
|
||||||
DBG_INIT ();
|
DBG_INIT ();
|
||||||
DBG_HELPER(dbg);
|
DBG_HELPER(dbg);
|
||||||
|
|
||||||
status=sanei_genesys_asic_init(dev, 0);
|
sanei_genesys_asic_init(dev, 0);
|
||||||
|
|
||||||
return status;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static SANE_Status
|
static SANE_Status
|
||||||
|
|
|
@ -2334,16 +2334,12 @@ static void gl846_boot(Genesys_Device* dev, SANE_Bool cold)
|
||||||
* initialize backend and ASIC : registers, motor tables, and gamma tables
|
* initialize backend and ASIC : registers, motor tables, and gamma tables
|
||||||
* then ensure scanner's head is at home
|
* then ensure scanner's head is at home
|
||||||
*/
|
*/
|
||||||
static SANE_Status gl846_init(Genesys_Device * dev)
|
static void gl846_init(Genesys_Device* dev)
|
||||||
{
|
{
|
||||||
SANE_Status status = SANE_STATUS_GOOD;
|
|
||||||
|
|
||||||
DBG_INIT ();
|
DBG_INIT ();
|
||||||
DBG_HELPER(dbg);
|
DBG_HELPER(dbg);
|
||||||
|
|
||||||
status=sanei_genesys_asic_init(dev, 0);
|
sanei_genesys_asic_init(dev, 0);
|
||||||
|
|
||||||
return status;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static SANE_Status
|
static SANE_Status
|
||||||
|
|
|
@ -352,7 +352,7 @@ static void gl846_begin_scan(Genesys_Device* dev, const Genesys_Sensor& sensor,
|
||||||
// Send the stop scan command
|
// Send the stop scan command
|
||||||
static void gl846_end_scan(Genesys_Device* dev, Genesys_Register_Set* reg, SANE_Bool check_stop);
|
static void gl846_end_scan(Genesys_Device* dev, Genesys_Register_Set* reg, SANE_Bool check_stop);
|
||||||
|
|
||||||
static SANE_Status gl846_init (Genesys_Device * dev);
|
static void gl846_init(Genesys_Device* dev);
|
||||||
|
|
||||||
/** @brief moves the slider to steps at motor base dpi
|
/** @brief moves the slider to steps at motor base dpi
|
||||||
* @param dev device to work on
|
* @param dev device to work on
|
||||||
|
|
|
@ -2434,16 +2434,12 @@ static void gl847_boot(Genesys_Device* dev, SANE_Bool cold)
|
||||||
* initialize backend and ASIC : registers, motor tables, and gamma tables
|
* initialize backend and ASIC : registers, motor tables, and gamma tables
|
||||||
* then ensure scanner's head is at home
|
* then ensure scanner's head is at home
|
||||||
*/
|
*/
|
||||||
static SANE_Status gl847_init (Genesys_Device * dev)
|
static void gl847_init(Genesys_Device* dev)
|
||||||
{
|
{
|
||||||
SANE_Status status = SANE_STATUS_GOOD;
|
|
||||||
|
|
||||||
DBG_INIT ();
|
DBG_INIT ();
|
||||||
DBG_HELPER(dbg);
|
DBG_HELPER(dbg);
|
||||||
|
|
||||||
status=sanei_genesys_asic_init(dev, 0);
|
sanei_genesys_asic_init(dev, 0);
|
||||||
|
|
||||||
return status;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static SANE_Status
|
static SANE_Status
|
||||||
|
|
|
@ -336,7 +336,7 @@ static void gl847_begin_scan(Genesys_Device* dev, const Genesys_Sensor& sensor,
|
||||||
// Send the stop scan command
|
// Send the stop scan command
|
||||||
static void gl847_end_scan(Genesys_Device* dev, Genesys_Register_Set* reg, SANE_Bool check_stop);
|
static void gl847_end_scan(Genesys_Device* dev, Genesys_Register_Set* reg, SANE_Bool check_stop);
|
||||||
|
|
||||||
static SANE_Status gl847_init (Genesys_Device * dev);
|
static void gl847_init(Genesys_Device* dev);
|
||||||
|
|
||||||
/** @brief moves the slider to steps at motor base dpi
|
/** @brief moves the slider to steps at motor base dpi
|
||||||
* @param dev device to work on
|
* @param dev device to work on
|
||||||
|
|
|
@ -1198,12 +1198,10 @@ void sanei_genesys_send_gamma_table(Genesys_Device* dev, const Genesys_Sensor& s
|
||||||
* @param max_regs umber of maximum used registers
|
* @param max_regs umber of maximum used registers
|
||||||
* @return SANE_STATUS_GOOD in case of success
|
* @return SANE_STATUS_GOOD in case of success
|
||||||
*/
|
*/
|
||||||
SANE_Status
|
void sanei_genesys_asic_init(Genesys_Device* dev, int /*max_regs*/)
|
||||||
sanei_genesys_asic_init(Genesys_Device* dev, int /*max_regs*/)
|
|
||||||
{
|
{
|
||||||
DBG_HELPER(dbg);
|
DBG_HELPER(dbg);
|
||||||
|
|
||||||
SANE_Status status = SANE_STATUS_GOOD;
|
|
||||||
uint8_t val;
|
uint8_t val;
|
||||||
SANE_Bool cold = SANE_TRUE;
|
SANE_Bool cold = SANE_TRUE;
|
||||||
|
|
||||||
|
@ -1238,7 +1236,7 @@ sanei_genesys_asic_init(Genesys_Device* dev, int /*max_regs*/)
|
||||||
if (dev->already_initialized && !cold)
|
if (dev->already_initialized && !cold)
|
||||||
{
|
{
|
||||||
DBG (DBG_info, "%s: already initialized, nothing to do\n", __func__);
|
DBG (DBG_info, "%s: already initialized, nothing to do\n", __func__);
|
||||||
return SANE_STATUS_GOOD;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
// set up hardware and registers
|
// set up hardware and registers
|
||||||
|
@ -1266,8 +1264,6 @@ sanei_genesys_asic_init(Genesys_Device* dev, int /*max_regs*/)
|
||||||
|
|
||||||
// Set powersaving (default = 15 minutes)
|
// Set powersaving (default = 15 minutes)
|
||||||
dev->model->cmd_set->set_powersaving(dev, 15);
|
dev->model->cmd_set->set_powersaving(dev, 15);
|
||||||
|
|
||||||
return status;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -1043,7 +1043,7 @@ struct Genesys_Command_Set
|
||||||
bool (*needs_home_before_init_regs_for_scan) (Genesys_Device* dev);
|
bool (*needs_home_before_init_regs_for_scan) (Genesys_Device* dev);
|
||||||
|
|
||||||
/** For ASIC initialization */
|
/** For ASIC initialization */
|
||||||
SANE_Status (*init) (Genesys_Device * dev);
|
void (*init) (Genesys_Device* dev);
|
||||||
|
|
||||||
SANE_Status (*init_regs_for_warmup) (Genesys_Device * dev,
|
SANE_Status (*init_regs_for_warmup) (Genesys_Device * dev,
|
||||||
const Genesys_Sensor& sensor,
|
const Genesys_Sensor& sensor,
|
||||||
|
@ -1951,8 +1951,7 @@ inline SensorExposure sanei_genesys_fixup_exposure(SensorExposure exposure)
|
||||||
|
|
||||||
extern void sanei_genesys_wait_for_home(Genesys_Device* dev);
|
extern void sanei_genesys_wait_for_home(Genesys_Device* dev);
|
||||||
|
|
||||||
extern SANE_Status
|
extern void sanei_genesys_asic_init(Genesys_Device* dev, SANE_Bool cold);
|
||||||
sanei_genesys_asic_init(Genesys_Device *dev, SANE_Bool cold);
|
|
||||||
|
|
||||||
int sanei_genesys_compute_dpihw(Genesys_Device *dev, const Genesys_Sensor& sensor, int xres);
|
int sanei_genesys_compute_dpihw(Genesys_Device *dev, const Genesys_Sensor& sensor, int xres);
|
||||||
|
|
||||||
|
|
Ładowanie…
Reference in New Issue