genesys: Return errors as exceptions from *led_calibration()

merge-requests/104/head
Povilas Kanapickas 2019-07-20 11:02:25 +03:00
rodzic dd29e02457
commit 0db604d4dd
8 zmienionych plików z 16 dodań i 45 usunięć

Wyświetl plik

@ -3006,12 +3006,7 @@ genesys_flatbed_calibration(Genesys_Device * dev, Genesys_Sensor& sensor)
{
/* the afe now sends valid data for doing led calibration */
sanei_usb_testing_record_message("led_calibration");
status = dev->model->cmd_set->led_calibration(dev, sensor, dev->calib_reg);
if (status != SANE_STATUS_GOOD)
{
DBG(DBG_error, "%s: led calibration failed: %s\n", __func__, sane_strstatus(status));
return status;
}
dev->model->cmd_set->led_calibration(dev, sensor, dev->calib_reg);
/* calibrate afe again to match new exposure */
if (dev->model->flags & GENESYS_FLAG_OFFSET_CALIBRATION)
@ -3176,12 +3171,7 @@ static SANE_Status genesys_sheetfed_calibration(Genesys_Device * dev, Genesys_Se
if (dev->model->is_cis)
{
status = dev->model->cmd_set->led_calibration(dev, sensor, dev->calib_reg);
if (status != SANE_STATUS_GOOD)
{
DBG(DBG_error, "%s: led calibration failed: %s\n", __func__, sane_strstatus(status));
return status;
}
dev->model->cmd_set->led_calibration(dev, sensor, dev->calib_reg);
}
/* calibrate afe */

Wyświetl plik

@ -2370,8 +2370,8 @@ move_to_calibration_area (Genesys_Device * dev, const Genesys_Sensor& sensor,
-needs working coarse/gain
*/
static SANE_Status
gl124_led_calibration (Genesys_Device * dev, Genesys_Sensor& sensor, Genesys_Register_Set& regs)
static void gl124_led_calibration(Genesys_Device* dev, Genesys_Sensor& sensor,
Genesys_Register_Set& regs)
{
DBG_HELPER(dbg);
int num_pixels;
@ -2379,7 +2379,6 @@ gl124_led_calibration (Genesys_Device * dev, Genesys_Sensor& sensor, Genesys_Reg
int resolution;
int dpihw;
int i, j;
SANE_Status status = SANE_STATUS_GOOD;
int val;
int channels, depth;
int avg[3];
@ -2515,8 +2514,6 @@ gl124_led_calibration (Genesys_Device * dev, Genesys_Sensor& sensor, Genesys_Reg
sensor.exposure.red = exp[0];
sensor.exposure.green = exp[1];
sensor.exposure.blue = exp[2];
return status;
}
/**

Wyświetl plik

@ -2505,14 +2505,12 @@ static void gl646_send_gamma_table(Genesys_Device* dev, const Genesys_Sensor& se
* area below scanner's top on white strip. The scope of this function is
* currently limited to the XP200
*/
static SANE_Status
gl646_led_calibration (Genesys_Device * dev, Genesys_Sensor& sensor, Genesys_Register_Set& regs)
static void gl646_led_calibration(Genesys_Device* dev, Genesys_Sensor& sensor, Genesys_Register_Set& regs)
{
DBG_HELPER(dbg);
(void) regs;
int total_size;
unsigned int i, j;
SANE_Status status = SANE_STATUS_GOOD;
int val;
unsigned int channels;
int avg[3], avga, avge;
@ -2526,7 +2524,7 @@ gl646_led_calibration (Genesys_Device * dev, Genesys_Sensor& sensor, Genesys_Reg
if (!dev->model->is_cis)
{
DBG(DBG_proc, "%s: not a cis scanner, nothing to do...\n", __func__);
return SANE_STATUS_GOOD;
return;
}
/* get led calibration resolution */
@ -2649,8 +2647,6 @@ gl646_led_calibration (Genesys_Device * dev, Genesys_Sensor& sensor, Genesys_Reg
while (!acceptable && turn < 100);
DBG(DBG_info,"%s: acceptable exposure: 0x%04x,0x%04x,0x%04x\n", __func__, expr, expg, expb);
return status;
}
/**

Wyświetl plik

@ -3291,14 +3291,13 @@ static void gl841_send_gamma_table(Genesys_Device* dev, const Genesys_Sensor& se
-needs working coarse/gain
*/
static SANE_Status
gl841_led_calibration (Genesys_Device * dev, Genesys_Sensor& sensor, Genesys_Register_Set& regs)
static void gl841_led_calibration(Genesys_Device* dev, Genesys_Sensor& sensor,
Genesys_Register_Set& regs)
{
DBG_HELPER(dbg);
int num_pixels;
int total_size;
int i, j;
SANE_Status status = SANE_STATUS_GOOD;
int val;
int channels;
int avg[3], avga, avge;
@ -3489,8 +3488,6 @@ gl841_led_calibration (Genesys_Device * dev, Genesys_Sensor& sensor, Genesys_Reg
DBG(DBG_info,"%s: acceptable exposure: %d,%d,%d\n", __func__, exp[0], exp[1], exp[2]);
gl841_slow_back_home(dev, SANE_TRUE);
return status;
}
/** @brief calibration for AD frontend devices

Wyświetl plik

@ -2809,15 +2809,14 @@ static void gl843_send_gamma_table(Genesys_Device* dev, const Genesys_Sensor& se
-needs working coarse/gain
*/
static SANE_Status
gl843_led_calibration (Genesys_Device * dev, Genesys_Sensor& sensor, Genesys_Register_Set& regs)
static void gl843_led_calibration(Genesys_Device* dev, Genesys_Sensor& sensor,
Genesys_Register_Set& regs)
{
DBG_HELPER(dbg);
int num_pixels;
int total_size;
int used_res;
int i, j;
SANE_Status status = SANE_STATUS_GOOD;
int val;
int channels, depth;
int avg[3], avga, avge;
@ -2975,8 +2974,6 @@ gl843_led_calibration (Genesys_Device * dev, Genesys_Sensor& sensor, Genesys_Reg
sensor.exposure = calib_sensor.exposure;
gl843_slow_back_home (dev, SANE_TRUE);
return status;
}

Wyświetl plik

@ -2020,15 +2020,14 @@ static void gl846_send_shading_data(Genesys_Device* dev, const Genesys_Sensor& s
* data white enough.
* @param dev device to calibrate
*/
static SANE_Status
gl846_led_calibration (Genesys_Device * dev, Genesys_Sensor& sensor, Genesys_Register_Set& regs)
static void gl846_led_calibration(Genesys_Device* dev, Genesys_Sensor& sensor,
Genesys_Register_Set& regs)
{
DBG_HELPER(dbg);
int num_pixels;
int total_size;
int used_res;
int i, j;
SANE_Status status = SANE_STATUS_GOOD;
int val;
int channels, depth;
int avg[3], top[3], bottom[3];
@ -2177,8 +2176,6 @@ gl846_led_calibration (Genesys_Device * dev, Genesys_Sensor& sensor, Genesys_Reg
{
gl846_slow_back_home(dev, SANE_TRUE);
}
return status;
}
/**

Wyświetl plik

@ -2080,15 +2080,14 @@ static void gl847_send_shading_data(Genesys_Device* dev, const Genesys_Sensor& s
* data white enough.
* @param dev device to calibrate
*/
static SANE_Status
gl847_led_calibration (Genesys_Device * dev, Genesys_Sensor& sensor, Genesys_Register_Set& regs)
static void gl847_led_calibration(Genesys_Device* dev, Genesys_Sensor& sensor,
Genesys_Register_Set& regs)
{
DBG_HELPER(dbg);
int num_pixels;
int total_size;
int used_res;
int i, j;
SANE_Status status = SANE_STATUS_GOOD;
int val;
int channels, depth;
int avg[3], top[3], bottom[3];
@ -2236,8 +2235,6 @@ gl847_led_calibration (Genesys_Device * dev, Genesys_Sensor& sensor, Genesys_Reg
if (move>20) {
gl847_slow_back_home(dev, SANE_TRUE);
}
return status;
}
/**

Wyświetl plik

@ -1080,8 +1080,8 @@ struct Genesys_Command_Set
Genesys_Register_Set& regs);
void (*coarse_gain_calibration) (Genesys_Device* dev, const Genesys_Sensor& sensor,
Genesys_Register_Set& regs, int dpi);
SANE_Status (*led_calibration) (Genesys_Device * dev, Genesys_Sensor& sensor,
Genesys_Register_Set& regs);
void (*led_calibration) (Genesys_Device* dev, Genesys_Sensor& sensor,
Genesys_Register_Set& regs);
void (*wait_for_motor_stop) (Genesys_Device* dev);
void (*slow_back_home) (Genesys_Device* dev, SANE_Bool wait_until_home);