kopia lustrzana https://gitlab.com/sane-project/backends
Merge branch 'genesys-gl843-segmented-sensors' into 'master'
genesys: Add support for segmented sensors on gl843 See merge request sane-project/backends!175merge-requests/176/merge
commit
0440123bdc
|
@ -5178,7 +5178,7 @@ probe_genesys_devices (void)
|
||||||
of Genesys_Calibration_Cache as is.
|
of Genesys_Calibration_Cache as is.
|
||||||
*/
|
*/
|
||||||
static const char* CALIBRATION_IDENT = "sane_genesys";
|
static const char* CALIBRATION_IDENT = "sane_genesys";
|
||||||
static const int CALIBRATION_VERSION = 8;
|
static const int CALIBRATION_VERSION = 9;
|
||||||
|
|
||||||
bool read_calibration(std::istream& str, Genesys_Device::Calibration& calibration,
|
bool read_calibration(std::istream& str, Genesys_Device::Calibration& calibration,
|
||||||
const std::string& path)
|
const std::string& path)
|
||||||
|
|
|
@ -200,6 +200,8 @@ static void gl843_setup_sensor(Genesys_Device* dev, const Genesys_Sensor& sensor
|
||||||
if (!(dev->model->flags & GENESYS_FLAG_FULL_HWDPI_MODE)) {
|
if (!(dev->model->flags & GENESYS_FLAG_FULL_HWDPI_MODE)) {
|
||||||
regs->set8(0x7d, 0x90);
|
regs->set8(0x7d, 0x90);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
dev->segment_order = sensor.segment_order;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -1299,6 +1301,9 @@ static void gl843_init_scan_regs(Genesys_Device* dev, const Genesys_Sensor& sens
|
||||||
dev->out_buffer.clear();
|
dev->out_buffer.clear();
|
||||||
dev->out_buffer.alloc(session.buffer_size_out);
|
dev->out_buffer.alloc(session.buffer_size_out);
|
||||||
|
|
||||||
|
dev->oe_buffer.clear();
|
||||||
|
dev->oe_buffer.alloc(session.output_line_bytes_raw * 2);
|
||||||
|
|
||||||
dev->read_bytes_left_after_deseg = session.output_line_bytes * session.output_line_count;
|
dev->read_bytes_left_after_deseg = session.output_line_bytes * session.output_line_count;
|
||||||
|
|
||||||
DBG(DBG_info, "%s: physical bytes to read = %lu\n", __func__,
|
DBG(DBG_info, "%s: physical bytes to read = %lu\n", __func__,
|
||||||
|
|
|
@ -1322,6 +1322,8 @@ void compute_session(Genesys_Device* dev, ScanSession& s, const Genesys_Sensor&
|
||||||
s.segment_count = 1;
|
s.segment_count = 1;
|
||||||
if (dev->model->flags & GENESYS_FLAG_SIS_SENSOR || dev->model->asic_type == AsicType::GL124) {
|
if (dev->model->flags & GENESYS_FLAG_SIS_SENSOR || dev->model->asic_type == AsicType::GL124) {
|
||||||
s.segment_count = sensor_profile->get_segment_count();
|
s.segment_count = sensor_profile->get_segment_count();
|
||||||
|
} else {
|
||||||
|
s.segment_count = sensor.get_segment_count();
|
||||||
}
|
}
|
||||||
|
|
||||||
s.optical_pixels_raw = s.optical_pixels;
|
s.optical_pixels_raw = s.optical_pixels;
|
||||||
|
@ -1363,8 +1365,14 @@ void compute_session(Genesys_Device* dev, ScanSession& s, const Genesys_Sensor&
|
||||||
s.conseq_pixel_dist_bytes = s.output_line_bytes_raw / s.segment_count;
|
s.conseq_pixel_dist_bytes = s.output_line_bytes_raw / s.segment_count;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (dev->model->asic_type == AsicType::GL843) {
|
||||||
|
s.conseq_pixel_dist_bytes = s.output_line_bytes_raw / s.segment_count;
|
||||||
|
}
|
||||||
|
|
||||||
s.output_segment_pixel_group_count = 0;
|
s.output_segment_pixel_group_count = 0;
|
||||||
if (dev->model->asic_type == AsicType::GL124) {
|
if (dev->model->asic_type == AsicType::GL124 ||
|
||||||
|
dev->model->asic_type == AsicType::GL843)
|
||||||
|
{
|
||||||
s.output_segment_pixel_group_count = s.output_line_bytes_raw / s.segment_count;
|
s.output_segment_pixel_group_count = s.output_line_bytes_raw / s.segment_count;
|
||||||
}
|
}
|
||||||
if (dev->model->asic_type == AsicType::GL845 ||
|
if (dev->model->asic_type == AsicType::GL845 ||
|
||||||
|
|
|
@ -303,6 +303,15 @@ struct Genesys_Sensor {
|
||||||
|
|
||||||
int exposure_lperiod = -1;
|
int exposure_lperiod = -1;
|
||||||
|
|
||||||
|
// the number of pixels in a single segment.
|
||||||
|
// only on gl843
|
||||||
|
unsigned segment_size = 0;
|
||||||
|
|
||||||
|
// the order of the segments, if any, for the sensor. If the sensor is not segmented or uses
|
||||||
|
// only single segment, this array can be empty
|
||||||
|
// only on gl843
|
||||||
|
std::vector<unsigned> segment_order;
|
||||||
|
|
||||||
GenesysRegisterSettingSet custom_base_regs; // gl646-specific
|
GenesysRegisterSettingSet custom_base_regs; // gl646-specific
|
||||||
GenesysRegisterSettingSet custom_regs;
|
GenesysRegisterSettingSet custom_regs;
|
||||||
GenesysRegisterSettingSet custom_fe_regs;
|
GenesysRegisterSettingSet custom_fe_regs;
|
||||||
|
@ -341,6 +350,13 @@ struct Genesys_Sensor {
|
||||||
return std::find(channels.begin(), channels.end(), count) != channels.end();
|
return std::find(channels.begin(), channels.end(), count) != channels.end();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
unsigned get_segment_count() const
|
||||||
|
{
|
||||||
|
if (segment_order.size() < 2)
|
||||||
|
return 1;
|
||||||
|
return segment_order.size();
|
||||||
|
}
|
||||||
|
|
||||||
bool operator==(const Genesys_Sensor& other) const
|
bool operator==(const Genesys_Sensor& other) const
|
||||||
{
|
{
|
||||||
return sensor_id == other.sensor_id &&
|
return sensor_id == other.sensor_id &&
|
||||||
|
@ -356,6 +372,8 @@ struct Genesys_Sensor {
|
||||||
gain_white_ref == other.gain_white_ref &&
|
gain_white_ref == other.gain_white_ref &&
|
||||||
exposure == other.exposure &&
|
exposure == other.exposure &&
|
||||||
exposure_lperiod == other.exposure_lperiod &&
|
exposure_lperiod == other.exposure_lperiod &&
|
||||||
|
segment_size == other.segment_size &&
|
||||||
|
segment_order == other.segment_order &&
|
||||||
custom_base_regs == other.custom_base_regs &&
|
custom_base_regs == other.custom_base_regs &&
|
||||||
custom_regs == other.custom_regs &&
|
custom_regs == other.custom_regs &&
|
||||||
custom_fe_regs == other.custom_fe_regs &&
|
custom_fe_regs == other.custom_fe_regs &&
|
||||||
|
@ -384,6 +402,10 @@ void serialize(Stream& str, Genesys_Sensor& x)
|
||||||
serialize(str, x.exposure.red);
|
serialize(str, x.exposure.red);
|
||||||
serialize(str, x.exposure_lperiod);
|
serialize(str, x.exposure_lperiod);
|
||||||
serialize_newline(str);
|
serialize_newline(str);
|
||||||
|
serialize(str, x.segment_size);
|
||||||
|
serialize_newline(str);
|
||||||
|
serialize(str, x.segment_order);
|
||||||
|
serialize_newline(str);
|
||||||
serialize(str, x.custom_base_regs);
|
serialize(str, x.custom_base_regs);
|
||||||
serialize_newline(str);
|
serialize_newline(str);
|
||||||
serialize(str, x.custom_regs);
|
serialize(str, x.custom_regs);
|
||||||
|
|
Ładowanie…
Reference in New Issue