kopia lustrzana https://gitlab.com/sane-project/backends
genesys: Support more than two scan methods
rodzic
f1e583aea8
commit
a63c8a5f8c
|
@ -186,12 +186,11 @@ const Genesys_Sensor& sanei_genesys_find_sensor_any(Genesys_Device* dev)
|
|||
const Genesys_Sensor& sanei_genesys_find_sensor(Genesys_Device* dev, int dpi,
|
||||
ScanMethod scan_method)
|
||||
{
|
||||
bool is_transparency = scan_method == ScanMethod::TRANSPARENCY;
|
||||
for (const auto& sensor : *s_sensors) {
|
||||
if (dev->model->ccd_type == sensor.sensor_id &&
|
||||
(sensor.min_resolution == -1 || dpi >= sensor.min_resolution) &&
|
||||
(sensor.max_resolution == -1 || dpi <= sensor.max_resolution) &&
|
||||
sensor.is_transparency == is_transparency) {
|
||||
sensor.method == scan_method) {
|
||||
return sensor;
|
||||
}
|
||||
}
|
||||
|
@ -201,12 +200,11 @@ const Genesys_Sensor& sanei_genesys_find_sensor(Genesys_Device* dev, int dpi,
|
|||
Genesys_Sensor& sanei_genesys_find_sensor_for_write(Genesys_Device* dev, int dpi,
|
||||
ScanMethod scan_method)
|
||||
{
|
||||
bool is_transparency = scan_method == ScanMethod::TRANSPARENCY;
|
||||
for (auto& sensor : *s_sensors) {
|
||||
if (dev->model->ccd_type == sensor.sensor_id &&
|
||||
(sensor.min_resolution == -1 || dpi >= sensor.min_resolution) &&
|
||||
(sensor.max_resolution == -1 || dpi <= sensor.max_resolution) &&
|
||||
sensor.is_transparency == is_transparency) {
|
||||
sensor.method == scan_method) {
|
||||
return sensor;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1357,12 +1357,12 @@ void genesys_init_sensor_tables()
|
|||
int min_resolution;
|
||||
int max_resolution;
|
||||
int exposure;
|
||||
int is_transparency;
|
||||
ScanMethod method;
|
||||
GenesysRegisterSettingSet extra_custom_regs;
|
||||
};
|
||||
|
||||
CustomSensorSettings custom_settings[] = {
|
||||
{ -1, 600, 8016, false, {
|
||||
{ -1, 600, 8016, ScanMethod::FLATBED, {
|
||||
{ 0x74, 0x00 }, { 0x75, 0x01 }, { 0x76, 0xff },
|
||||
{ 0x77, 0x03 }, { 0x78, 0xff }, { 0x79, 0xff },
|
||||
{ 0x7a, 0x03 }, { 0x7b, 0xff }, { 0x7c, 0xff },
|
||||
|
@ -1390,7 +1390,7 @@ void genesys_init_sensor_tables()
|
|||
{ 0x5a, 0x40 },
|
||||
}
|
||||
},
|
||||
{ 1200, 1200, 56064, false, {
|
||||
{ 1200, 1200, 56064, ScanMethod::FLATBED, {
|
||||
{ 0x74, 0x0f }, { 0x75, 0xff }, { 0x76, 0xff },
|
||||
{ 0x77, 0x00 }, { 0x78, 0x01 }, { 0x79, 0xff },
|
||||
{ 0x7a, 0x00 }, { 0x7b, 0x01 }, { 0x7c, 0xff },
|
||||
|
@ -1418,7 +1418,7 @@ void genesys_init_sensor_tables()
|
|||
{ 0x5a, 0x40 },
|
||||
}
|
||||
},
|
||||
{ 2400, 2400, 56064, false, {
|
||||
{ 2400, 2400, 56064, ScanMethod::FLATBED, {
|
||||
{ 0x74, 0x0f }, { 0x75, 0xff }, { 0x76, 0xff },
|
||||
{ 0x77, 0x00 }, { 0x78, 0x00 }, { 0x79, 0x00 },
|
||||
{ 0x7a, 0x00 }, { 0x7b, 0x00 }, { 0x7c, 0x00 },
|
||||
|
@ -1446,7 +1446,7 @@ void genesys_init_sensor_tables()
|
|||
{ 0x5a, 0x40 },
|
||||
}
|
||||
},
|
||||
{ 4800, 4800, 42752, false, {
|
||||
{ 4800, 4800, 42752, ScanMethod::FLATBED, {
|
||||
{ 0x74, 0x0f }, { 0x75, 0xff }, { 0x76, 0xff },
|
||||
{ 0x77, 0x00 }, { 0x78, 0x00 }, { 0x79, 0x00 },
|
||||
{ 0x7a, 0x00 }, { 0x7b, 0x00 }, { 0x7c, 0x00 },
|
||||
|
@ -1474,7 +1474,7 @@ void genesys_init_sensor_tables()
|
|||
{ 0x5a, 0x40 },
|
||||
}
|
||||
},
|
||||
{ -1, -1, 15624, true, {
|
||||
{ -1, -1, 15624, ScanMethod::TRANSPARENCY, {
|
||||
{ 0x74, 0x00 }, { 0x75, 0x1c }, { 0x76, 0x7f },
|
||||
{ 0x77, 0x03 }, { 0x78, 0xff }, { 0x79, 0xff },
|
||||
{ 0x7a, 0x03 }, { 0x7b, 0xff }, { 0x7c, 0xff },
|
||||
|
@ -1510,7 +1510,7 @@ void genesys_init_sensor_tables()
|
|||
sensor.min_resolution = setting.min_resolution;
|
||||
sensor.max_resolution = setting.max_resolution;
|
||||
sensor.exposure_lperiod = setting.exposure;
|
||||
sensor.is_transparency = setting.is_transparency;
|
||||
sensor.method = setting.method;
|
||||
sensor.custom_regs = base_custom_regs;
|
||||
sensor.custom_regs.merge(setting.extra_custom_regs);
|
||||
s_sensors->push_back(sensor);
|
||||
|
@ -1626,13 +1626,13 @@ void genesys_init_sensor_tables()
|
|||
int min_resolution;
|
||||
int max_resolution;
|
||||
int exposure;
|
||||
int is_transparency;
|
||||
ScanMethod method;
|
||||
GenesysRegisterSettingSet extra_custom_regs;
|
||||
GenesysRegisterSettingSet custom_fe_regs;
|
||||
};
|
||||
|
||||
CustomSensorSettings custom_settings[] = {
|
||||
{ -1, 1200, 0x5dc0, false, {
|
||||
{ -1, 1200, 0x5dc0, ScanMethod::FLATBED, {
|
||||
{ 0x74, 0x03 }, { 0x75, 0xf0 }, { 0x76, 0xf0 },
|
||||
{ 0x77, 0x03 }, { 0x78, 0xfe }, { 0x79, 0x00 },
|
||||
{ 0x7a, 0x00 }, { 0x7b, 0x92 }, { 0x7c, 0x49 },
|
||||
|
@ -1661,7 +1661,7 @@ void genesys_init_sensor_tables()
|
|||
},
|
||||
{},
|
||||
},
|
||||
{ -1, 1200, 0x5dc0, true, {
|
||||
{ -1, 1200, 0x5dc0, ScanMethod::TRANSPARENCY, {
|
||||
{ 0x74, 0x03 }, { 0x75, 0xf0 }, { 0x76, 0xf0 },
|
||||
{ 0x77, 0x03 }, { 0x78, 0xfe }, { 0x79, 0x00 },
|
||||
{ 0x7a, 0x00 }, { 0x7b, 0x92 }, { 0x7c, 0x49 },
|
||||
|
@ -1690,7 +1690,7 @@ void genesys_init_sensor_tables()
|
|||
},
|
||||
{},
|
||||
},
|
||||
{ 2400, 2400, 0x5dc0, true, {
|
||||
{ 2400, 2400, 0x5dc0, ScanMethod::TRANSPARENCY, {
|
||||
{ 0x74, 0x03 }, { 0x75, 0xfe }, { 0x76, 0x00 },
|
||||
{ 0x77, 0x03 }, { 0x78, 0xfe }, { 0x79, 0x00 },
|
||||
{ 0x7a, 0x00 }, { 0x7b, 0x92 }, { 0x7c, 0x49 },
|
||||
|
@ -1719,7 +1719,7 @@ void genesys_init_sensor_tables()
|
|||
},
|
||||
{},
|
||||
},
|
||||
{ 4800, 4800, 0x5dc0, true, {
|
||||
{ 4800, 4800, 0x5dc0, ScanMethod::TRANSPARENCY, {
|
||||
{ 0x74, 0x03 }, { 0x75, 0xff }, { 0x76, 0xff },
|
||||
{ 0x77, 0x03 }, { 0x78, 0xff }, { 0x79, 0xff },
|
||||
{ 0x7a, 0x00 }, { 0x7b, 0x92 }, { 0x7c, 0x49 },
|
||||
|
@ -1758,7 +1758,7 @@ void genesys_init_sensor_tables()
|
|||
{
|
||||
sensor.min_resolution = setting.min_resolution;
|
||||
sensor.max_resolution = setting.max_resolution;
|
||||
sensor.is_transparency = setting.is_transparency;
|
||||
sensor.method = setting.method;
|
||||
sensor.exposure_lperiod = setting.exposure;
|
||||
sensor.custom_regs = base_custom_regs;
|
||||
sensor.custom_regs.merge(setting.extra_custom_regs);
|
||||
|
|
|
@ -218,6 +218,13 @@
|
|||
|
||||
#define GENESYS_MAX_REGS 256
|
||||
|
||||
enum class ScanMethod {
|
||||
// normal scan method
|
||||
FLATBED = 0,
|
||||
// scan using transparency adaptor
|
||||
TRANSPARENCY = 1
|
||||
};
|
||||
|
||||
struct GenesysRegister {
|
||||
uint16_t address = 0;
|
||||
uint8_t value = 0;
|
||||
|
@ -559,8 +566,8 @@ struct Genesys_Sensor {
|
|||
int min_resolution = -1;
|
||||
int max_resolution = -1;
|
||||
|
||||
// whether the sensor is transparency sensor.
|
||||
bool is_transparency = false;
|
||||
// the scan method used with the sensor
|
||||
ScanMethod method = ScanMethod::FLATBED;
|
||||
|
||||
// CCD may present itself as half or quarter-size CCD on certain resolutions
|
||||
int ccd_size_divisor = 1;
|
||||
|
@ -900,13 +907,6 @@ enum Genesys_Motor_Type
|
|||
MOTOR_CANONLIDE120
|
||||
};
|
||||
|
||||
enum class ScanMethod {
|
||||
// normal scan method
|
||||
FLATBED = 0,
|
||||
// scan using transparency adaptor
|
||||
TRANSPARENCY = 1
|
||||
};
|
||||
|
||||
/* Forward typedefs */
|
||||
typedef struct Genesys_Device Genesys_Device;
|
||||
struct Genesys_Scanner;
|
||||
|
|
Ładowanie…
Reference in New Issue