genesys: Make asic type an enum

merge-requests/116/head
Povilas Kanapickas 2019-07-27 05:12:30 +03:00
rodzic e34814aef8
commit f4401d501f
6 zmienionych plików z 140 dodań i 145 usunięć

Wyświetl plik

@ -779,7 +779,7 @@ void sanei_genesys_create_default_gamma_table(Genesys_Device* dev,
{ {
int size = 0; int size = 0;
int max = 0; int max = 0;
if (dev->model->asic_type == GENESYS_GL646) { if (dev->model->asic_type == AsicType::GL646) {
if (dev->model->flags & GENESYS_FLAG_14BIT_GAMMA) { if (dev->model->flags & GENESYS_FLAG_14BIT_GAMMA) {
size = 16384; size = 16384;
} else { } else {
@ -1644,11 +1644,11 @@ static void genesys_dark_shading_calibration(Genesys_Device* dev, const Genesys_
return; return;
} }
// FIXME: the current calculation is likely incorrect on non-GENESYS_GL843 implementations, // FIXME: the current calculation is likely incorrect on non-GL843 implementations,
// but this needs checking // but this needs checking
if (dev->calib_total_bytes_to_read > 0) { if (dev->calib_total_bytes_to_read > 0) {
size = dev->calib_total_bytes_to_read; size = dev->calib_total_bytes_to_read;
} else if (dev->model->asic_type == GENESYS_GL843) { } else if (dev->model->asic_type == AsicType::GL843) {
size = channels * 2 * pixels_per_line * dev->calib_lines; size = channels * 2 * pixels_per_line * dev->calib_lines;
} else { } else {
size = channels * 2 * pixels_per_line * (dev->calib_lines + 1); size = channels * 2 * pixels_per_line * (dev->calib_lines + 1);
@ -1828,11 +1828,11 @@ static void genesys_white_shading_calibration(Genesys_Device* dev, const Genesys
dev->white_average_data.clear(); dev->white_average_data.clear();
dev->white_average_data.resize(channels * 2 * out_pixels_per_line); dev->white_average_data.resize(channels * 2 * out_pixels_per_line);
// FIXME: the current calculation is likely incorrect on non-GENESYS_GL843 implementations, // FIXME: the current calculation is likely incorrect on non-GL843 implementations,
// but this needs checking // but this needs checking
if (dev->calib_total_bytes_to_read > 0) { if (dev->calib_total_bytes_to_read > 0) {
size = dev->calib_total_bytes_to_read; size = dev->calib_total_bytes_to_read;
} else if (dev->model->asic_type == GENESYS_GL843) { } else if (dev->model->asic_type == AsicType::GL843) {
size = channels * 2 * pixels_per_line * dev->calib_lines; size = channels * 2 * pixels_per_line * dev->calib_lines;
} else { } else {
size = channels * 2 * pixels_per_line * (dev->calib_lines + 1); size = channels * 2 * pixels_per_line * (dev->calib_lines + 1);
@ -4133,12 +4133,12 @@ static void calc_parameters(Genesys_Scanner* s)
/* we need an even pixels number /* we need an even pixels number
* TODO invert test logic or generalize behaviour across all ASICs */ * TODO invert test logic or generalize behaviour across all ASICs */
if ((s->dev->model->flags & GENESYS_FLAG_SIS_SENSOR) if ((s->dev->model->flags & GENESYS_FLAG_SIS_SENSOR) ||
|| s->dev->model->asic_type == GENESYS_GL847 s->dev->model->asic_type == AsicType::GL847 ||
|| s->dev->model->asic_type == GENESYS_GL124 s->dev->model->asic_type == AsicType::GL124 ||
|| s->dev->model->asic_type == GENESYS_GL845 s->dev->model->asic_type == AsicType::GL845 ||
|| s->dev->model->asic_type == GENESYS_GL846 s->dev->model->asic_type == AsicType::GL846 ||
|| s->dev->model->asic_type == GENESYS_GL843) s->dev->model->asic_type == AsicType::GL843)
{ {
if (s->dev->settings.xres <= 1200) if (s->dev->settings.xres <= 1200)
s->params.pixels_per_line = (s->params.pixels_per_line/4)*4; s->params.pixels_per_line = (s->params.pixels_per_line/4)*4;
@ -4148,12 +4148,10 @@ static void calc_parameters(Genesys_Scanner* s)
/* corner case for true lineart for sensor with several segments /* corner case for true lineart for sensor with several segments
* or when xres is doubled to match yres */ * or when xres is doubled to match yres */
if (s->dev->settings.xres >= 1200 if (s->dev->settings.xres >= 1200 && (
&& ( s->dev->model->asic_type == GENESYS_GL124 s->dev->model->asic_type == AsicType::GL124 ||
|| s->dev->model->asic_type == GENESYS_GL847 s->dev->model->asic_type == AsicType::GL847 ||
|| s->dev->current_setup.xres < s->dev->current_setup.params.yres s->dev->current_setup.xres < s->dev->current_setup.params.yres))
)
)
{ {
s->params.pixels_per_line = (s->params.pixels_per_line/16)*16; s->params.pixels_per_line = (s->params.pixels_per_line/16)*16;
} }
@ -4230,9 +4228,9 @@ static void calc_parameters(Genesys_Scanner* s)
/* hardware lineart works only when we don't have interleave data /* hardware lineart works only when we don't have interleave data
* for GL847 scanners, ie up to 600 DPI, then we have to rely on * for GL847 scanners, ie up to 600 DPI, then we have to rely on
* dynamic_lineart */ * dynamic_lineart */
if(s->dev->settings.xres > 600 if (s->dev->settings.xres > 600 &&
&& s->dev->model->asic_type==GENESYS_GL847 s->dev->model->asic_type==AsicType::GL847 &&
&& s->dev->settings.scan_mode == ScanColorMode::LINEART) s->dev->settings.scan_mode == ScanColorMode::LINEART)
{ {
s->dev->settings.dynamic_lineart = SANE_TRUE; s->dev->settings.dynamic_lineart = SANE_TRUE;
} }
@ -4294,8 +4292,7 @@ init_gamma_vector_option (Genesys_Scanner * scanner, int option)
scanner->opt[option].cap |= SANE_CAP_INACTIVE | SANE_CAP_ADVANCED; scanner->opt[option].cap |= SANE_CAP_INACTIVE | SANE_CAP_ADVANCED;
scanner->opt[option].unit = SANE_UNIT_NONE; scanner->opt[option].unit = SANE_UNIT_NONE;
scanner->opt[option].constraint_type = SANE_CONSTRAINT_RANGE; scanner->opt[option].constraint_type = SANE_CONSTRAINT_RANGE;
if (scanner->dev->model->asic_type == GENESYS_GL646) if (scanner->dev->model->asic_type == AsicType::GL646) {
{
if ((scanner->dev->model->flags & GENESYS_FLAG_14BIT_GAMMA) != 0) if ((scanner->dev->model->flags & GENESYS_FLAG_14BIT_GAMMA) != 0)
{ {
scanner->opt[option].size = 16384 * sizeof (SANE_Word); scanner->opt[option].size = 16384 * sizeof (SANE_Word);
@ -4766,8 +4763,8 @@ static void init_options(Genesys_Scanner* s)
s->disable_dynamic_lineart = false; s->disable_dynamic_lineart = false;
/* fastmod is required for hw lineart to work */ /* fastmod is required for hw lineart to work */
if ((s->dev->model->asic_type == GENESYS_GL646) if ((s->dev->model->asic_type == AsicType::GL646) &&
&&(s->dev->model->motor_type != MOTOR_XP200)) (s->dev->model->motor_type != MOTOR_XP200))
{ {
s->opt[OPT_DISABLE_DYNAMIC_LINEART].cap = SANE_CAP_INACTIVE; s->opt[OPT_DISABLE_DYNAMIC_LINEART].cap = SANE_CAP_INACTIVE;
} }
@ -4794,8 +4791,7 @@ static void init_options(Genesys_Scanner* s)
s->opt[OPT_COLOR_FILTER].type = SANE_TYPE_STRING; s->opt[OPT_COLOR_FILTER].type = SANE_TYPE_STRING;
s->opt[OPT_COLOR_FILTER].constraint_type = SANE_CONSTRAINT_STRING_LIST; s->opt[OPT_COLOR_FILTER].constraint_type = SANE_CONSTRAINT_STRING_LIST;
/* true gray not yet supported for GL847 and GL124 scanners */ /* true gray not yet supported for GL847 and GL124 scanners */
if(!model->is_cis || model->asic_type==GENESYS_GL847 || model->asic_type==GENESYS_GL124) if (!model->is_cis || model->asic_type==AsicType::GL847 || model->asic_type==AsicType::GL124) {
{
s->opt[OPT_COLOR_FILTER].size = max_string_size (color_filter_list); s->opt[OPT_COLOR_FILTER].size = max_string_size (color_filter_list);
s->opt[OPT_COLOR_FILTER].constraint.string_list = color_filter_list; s->opt[OPT_COLOR_FILTER].constraint.string_list = color_filter_list;
s->color_filter = s->opt[OPT_COLOR_FILTER].constraint.string_list[1]; s->color_filter = s->opt[OPT_COLOR_FILTER].constraint.string_list[1];
@ -4808,9 +4804,8 @@ static void init_options(Genesys_Scanner* s)
s->color_filter = s->opt[OPT_COLOR_FILTER].constraint.string_list[3]; s->color_filter = s->opt[OPT_COLOR_FILTER].constraint.string_list[3];
} }
/* no support for color filter for cis+gl646 scanners */ // no support for color filter for cis+gl646 scanners
if (model->asic_type == GENESYS_GL646 && model->is_cis) if (model->asic_type == AsicType::GL646 && model->is_cis) {
{
DISABLE (OPT_COLOR_FILTER); DISABLE (OPT_COLOR_FILTER);
} }
@ -6109,10 +6104,9 @@ set_option_value (Genesys_Scanner * s, int option, void *val,
ENABLE (OPT_THRESHOLD); ENABLE (OPT_THRESHOLD);
ENABLE (OPT_THRESHOLD_CURVE); ENABLE (OPT_THRESHOLD_CURVE);
DISABLE (OPT_BIT_DEPTH); DISABLE (OPT_BIT_DEPTH);
if (s->dev->model->asic_type != GENESYS_GL646 || !s->dev->model->is_cis) if (s->dev->model->asic_type != AsicType::GL646 || !s->dev->model->is_cis) {
{ ENABLE(OPT_COLOR_FILTER);
ENABLE (OPT_COLOR_FILTER); }
}
ENABLE (OPT_DISABLE_DYNAMIC_LINEART); ENABLE (OPT_DISABLE_DYNAMIC_LINEART);
} }
else else
@ -6122,10 +6116,9 @@ set_option_value (Genesys_Scanner * s, int option, void *val,
DISABLE (OPT_DISABLE_DYNAMIC_LINEART); DISABLE (OPT_DISABLE_DYNAMIC_LINEART);
if (s->mode == SANE_VALUE_SCAN_MODE_GRAY) if (s->mode == SANE_VALUE_SCAN_MODE_GRAY)
{ {
if (s->dev->model->asic_type != GENESYS_GL646 || !s->dev->model->is_cis) if (s->dev->model->asic_type != AsicType::GL646 || !s->dev->model->is_cis) {
{ ENABLE(OPT_COLOR_FILTER);
ENABLE (OPT_COLOR_FILTER); }
}
create_bpp_list (s, s->dev->model->bpp_gray_values); create_bpp_list (s, s->dev->model->bpp_gray_values);
} }
else else

Wyświetl plik

@ -92,8 +92,7 @@ struct Genesys_Model
const char* model = nullptr; const char* model = nullptr;
unsigned model_id = 0; unsigned model_id = 0;
// ASIC type gl646 or gl841 AsicType asic_type = AsicType::UNKNOWN;
unsigned asic_type = 0;
// possible x resolutions // possible x resolutions
std::vector<unsigned> xdpi_values; std::vector<unsigned> xdpi_values;

Wyświetl plik

@ -3015,7 +3015,7 @@ void genesys_init_usb_device_tables()
model.vendor = "UMAX"; model.vendor = "UMAX";
model.model = "Astra 4500"; model.model = "Astra 4500";
model.model_id = MODEL_UMAX_ASTRA_4500; model.model_id = MODEL_UMAX_ASTRA_4500;
model.asic_type = GENESYS_GL646; model.asic_type = AsicType::GL646;
model.xdpi_values = { 1200, 600, 300, 150, 75 }; model.xdpi_values = { 1200, 600, 300, 150, 75 };
model.ydpi_values = { 2400, 1200, 600, 300, 150, 75 }; model.ydpi_values = { 2400, 1200, 600, 300, 150, 75 };
@ -3067,7 +3067,7 @@ void genesys_init_usb_device_tables()
model.vendor = "Canon"; model.vendor = "Canon";
model.model = "LiDE 35/40/50"; model.model = "LiDE 35/40/50";
model.model_id = MODEL_CANON_LIDE_50; model.model_id = MODEL_CANON_LIDE_50;
model.asic_type = GENESYS_GL841; model.asic_type = AsicType::GL841;
model.xdpi_values = { 1200, 600, 400, 300, 240, 200, 150, 75 }; model.xdpi_values = { 1200, 600, 400, 300, 240, 200, 150, 75 };
model.ydpi_values = { 2400, 1200, 600, 400, 300, 240, 200, 150, 75 }; model.ydpi_values = { 2400, 1200, 600, 400, 300, 240, 200, 150, 75 };
@ -3126,7 +3126,7 @@ void genesys_init_usb_device_tables()
model.vendor = "Panasonic"; model.vendor = "Panasonic";
model.model = "KV-SS080"; model.model = "KV-SS080";
model.model_id = MODEL_PANASONIC_KV_SS080; model.model_id = MODEL_PANASONIC_KV_SS080;
model.asic_type = GENESYS_GL843; model.asic_type = AsicType::GL843;
model.xdpi_values = { 600, /* 500, 400,*/ 300, 200, 150, 100, 75 }; model.xdpi_values = { 600, /* 500, 400,*/ 300, 200, 150, 100, 75 };
model.ydpi_values = { 1200, 600, /* 500, 400, */ 300, 200, 150, 100, 75 }; model.ydpi_values = { 1200, 600, /* 500, 400, */ 300, 200, 150, 100, 75 };
@ -3181,7 +3181,7 @@ void genesys_init_usb_device_tables()
model.vendor = "Hewlett Packard"; model.vendor = "Hewlett Packard";
model.model = "ScanJet 4850C"; model.model = "ScanJet 4850C";
model.model_id = MODEL_HP_SCANJET_4850C; model.model_id = MODEL_HP_SCANJET_4850C;
model.asic_type = GENESYS_GL843; model.asic_type = AsicType::GL843;
model.xdpi_values = { 2400, 1200, 600, 400, 300, 200, 150, 100 }; model.xdpi_values = { 2400, 1200, 600, 400, 300, 200, 150, 100 };
model.ydpi_values = { 2400, 1200, 600, 400, 300, 200, 150, 100 }; model.ydpi_values = { 2400, 1200, 600, 400, 300, 200, 150, 100 };
@ -3237,7 +3237,7 @@ void genesys_init_usb_device_tables()
model.vendor = "Hewlett Packard"; model.vendor = "Hewlett Packard";
model.model = "ScanJet G4010"; model.model = "ScanJet G4010";
model.model_id = MODEL_HP_SCANJET_G4010; model.model_id = MODEL_HP_SCANJET_G4010;
model.asic_type = GENESYS_GL843; model.asic_type = AsicType::GL843;
model.xdpi_values = { 2400, 1200, 600, 400, 300, 200, 150, 100 }; model.xdpi_values = { 2400, 1200, 600, 400, 300, 200, 150, 100 };
model.ydpi_values = { 2400, 1200, 600, 400, 300, 200, 150, 100 }; model.ydpi_values = { 2400, 1200, 600, 400, 300, 200, 150, 100 };
@ -3293,7 +3293,7 @@ void genesys_init_usb_device_tables()
model.vendor = "Hewlett Packard"; model.vendor = "Hewlett Packard";
model.model = "ScanJet G4050"; model.model = "ScanJet G4050";
model.model_id = MODEL_HP_SCANJET_G4050; model.model_id = MODEL_HP_SCANJET_G4050;
model.asic_type = GENESYS_GL843; model.asic_type = AsicType::GL843;
model.xdpi_values = { 2400, 1200, 600, 400, 300, 200, 150, 100 }; model.xdpi_values = { 2400, 1200, 600, 400, 300, 200, 150, 100 };
model.ydpi_values = { 2400, 1200, 600, 400, 300, 200, 150, 100 }; model.ydpi_values = { 2400, 1200, 600, 400, 300, 200, 150, 100 };
@ -3350,7 +3350,7 @@ void genesys_init_usb_device_tables()
model.vendor = "Canon"; model.vendor = "Canon";
model.model = "Canoscan 4400f"; model.model = "Canoscan 4400f";
model.model_id = MODEL_CANON_CANOSCAN_4400F; model.model_id = MODEL_CANON_CANOSCAN_4400F;
model.asic_type = GENESYS_GL843; model.asic_type = AsicType::GL843;
model.xdpi_values = { 4800, 2400, 1200, 600, 400, 300, 200, 150, 100 }; model.xdpi_values = { 4800, 2400, 1200, 600, 400, 300, 200, 150, 100 };
model.ydpi_values = { 4800, 2400, 1200, 600, 400, 300, 200, 150, 100 }; model.ydpi_values = { 4800, 2400, 1200, 600, 400, 300, 200, 150, 100 };
@ -3409,7 +3409,7 @@ void genesys_init_usb_device_tables()
model.vendor = "Canon"; model.vendor = "Canon";
model.model = "Canoscan 8400f"; model.model = "Canoscan 8400f";
model.model_id = MODEL_CANON_CANOSCAN_8400F; model.model_id = MODEL_CANON_CANOSCAN_8400F;
model.asic_type = GENESYS_GL843; model.asic_type = AsicType::GL843;
model.xdpi_values = { 4800, 2400, 1200, 600, 400, 300, 200, 150, 100 }; model.xdpi_values = { 4800, 2400, 1200, 600, 400, 300, 200, 150, 100 };
model.ydpi_values = { 4800, 2400, 1200, 600, 400, 300, 200, 150, 100 }; model.ydpi_values = { 4800, 2400, 1200, 600, 400, 300, 200, 150, 100 };
@ -3470,7 +3470,7 @@ void genesys_init_usb_device_tables()
model.vendor = "Canon"; model.vendor = "Canon";
model.model = "Canoscan 8600f"; model.model = "Canoscan 8600f";
model.model_id = MODEL_CANON_CANOSCAN_8600F; model.model_id = MODEL_CANON_CANOSCAN_8600F;
model.asic_type = GENESYS_GL843; model.asic_type = AsicType::GL843;
model.xdpi_values = { 4800, 2400, 1200, 600, 400, 300 }; // TODO: resolutions for non-XPA mode model.xdpi_values = { 4800, 2400, 1200, 600, 400, 300 }; // TODO: resolutions for non-XPA mode
model.ydpi_values = { 4800, 2400, 1200, 600, 400, 300 }; // TODO: resolutions for non-XPA mode model.ydpi_values = { 4800, 2400, 1200, 600, 400, 300 }; // TODO: resolutions for non-XPA mode
@ -3531,7 +3531,7 @@ void genesys_init_usb_device_tables()
model.vendor = "Canon"; model.vendor = "Canon";
model.model = "LiDE 100"; model.model = "LiDE 100";
model.model_id = MODEL_CANON_LIDE_100; model.model_id = MODEL_CANON_LIDE_100;
model.asic_type = GENESYS_GL847; model.asic_type = AsicType::GL847;
model.xdpi_values = { 4800, 2400, 1200, 600, 300, 200, 150, 100, 75 }; model.xdpi_values = { 4800, 2400, 1200, 600, 300, 200, 150, 100, 75 };
model.ydpi_values = { 4800, 2400, 1200, 600, 300, 200, 150, 100, 75 }; model.ydpi_values = { 4800, 2400, 1200, 600, 300, 200, 150, 100, 75 };
@ -3591,7 +3591,7 @@ void genesys_init_usb_device_tables()
model.vendor = "Canon"; model.vendor = "Canon";
model.model = "LiDE 110"; model.model = "LiDE 110";
model.model_id = MODEL_CANON_LIDE_110; model.model_id = MODEL_CANON_LIDE_110;
model.asic_type = GENESYS_GL124; model.asic_type = AsicType::GL124;
model.xdpi_values = { 4800, 2400, 1200, 600, /* 400,*/ 300, 150, 100, 75 }; model.xdpi_values = { 4800, 2400, 1200, 600, /* 400,*/ 300, 150, 100, 75 };
model.ydpi_values = { 4800, 2400, 1200, 600, /* 400,*/ 300, 150, 100, 75 }; model.ydpi_values = { 4800, 2400, 1200, 600, /* 400,*/ 300, 150, 100, 75 };
@ -3649,7 +3649,7 @@ void genesys_init_usb_device_tables()
model.vendor = "Canon"; model.vendor = "Canon";
model.model = "LiDE 120"; model.model = "LiDE 120";
model.model_id = MODEL_CANON_LIDE_120; model.model_id = MODEL_CANON_LIDE_120;
model.asic_type = GENESYS_GL124; model.asic_type = AsicType::GL124;
model.xdpi_values = { 4800, 2400, 1200, 600, 300, 150, 100, 75 }; model.xdpi_values = { 4800, 2400, 1200, 600, 300, 150, 100, 75 };
model.ydpi_values = { 4800, 2400, 1200, 600, 300, 150, 100, 75 }; model.ydpi_values = { 4800, 2400, 1200, 600, 300, 150, 100, 75 };
@ -3706,7 +3706,7 @@ void genesys_init_usb_device_tables()
model.vendor = "Canon"; model.vendor = "Canon";
model.model = "LiDE 210"; model.model = "LiDE 210";
model.model_id = MODEL_CANON_LIDE_210; model.model_id = MODEL_CANON_LIDE_210;
model.asic_type = GENESYS_GL124; model.asic_type = AsicType::GL124;
model.xdpi_values = { 4800, 2400, 1200, 600, /* 400,*/ 300, 150, 100, 75 }; model.xdpi_values = { 4800, 2400, 1200, 600, /* 400,*/ 300, 150, 100, 75 };
model.ydpi_values = { 4800, 2400, 1200, 600, /* 400,*/ 300, 150, 100, 75 }; model.ydpi_values = { 4800, 2400, 1200, 600, /* 400,*/ 300, 150, 100, 75 };
@ -3766,7 +3766,7 @@ void genesys_init_usb_device_tables()
model.vendor = "Canon"; model.vendor = "Canon";
model.model = "LiDE 220"; model.model = "LiDE 220";
model.model_id = MODEL_CANON_LIDE_220; model.model_id = MODEL_CANON_LIDE_220;
model.asic_type = GENESYS_GL124; // or a compatible one model.asic_type = AsicType::GL124; // or a compatible one
model.xdpi_values = { 4800, 2400, 1200, 600, 300, 150, 100, 75 }; model.xdpi_values = { 4800, 2400, 1200, 600, 300, 150, 100, 75 };
model.ydpi_values = { 4800, 2400, 1200, 600, 300, 150, 100, 75 }; model.ydpi_values = { 4800, 2400, 1200, 600, 300, 150, 100, 75 };
@ -3825,7 +3825,7 @@ void genesys_init_usb_device_tables()
model.vendor = "Canon"; model.vendor = "Canon";
model.model = "5600F"; model.model = "5600F";
model.model_id = MODEL_CANON_CANOSCAN_5600F; model.model_id = MODEL_CANON_CANOSCAN_5600F;
model.asic_type = GENESYS_GL847; model.asic_type = AsicType::GL847;
model.xdpi_values = { 1200, 600, 400, 300, 200, 150, 100, 75 }; model.xdpi_values = { 1200, 600, 400, 300, 200, 150, 100, 75 };
model.ydpi_values = { 1200, 600, 400, 300, 200, 150, 100, 75 }; model.ydpi_values = { 1200, 600, 400, 300, 200, 150, 100, 75 };
@ -3885,7 +3885,7 @@ void genesys_init_usb_device_tables()
model.vendor = "Canon"; model.vendor = "Canon";
model.model = "LiDE 700F"; model.model = "LiDE 700F";
model.model_id = MODEL_CANON_LIDE_700F; model.model_id = MODEL_CANON_LIDE_700F;
model.asic_type = GENESYS_GL847; model.asic_type = AsicType::GL847;
model.xdpi_values = { 4800, 2400, 1200, 600, 300, 200, 150, 100, 75 }; model.xdpi_values = { 4800, 2400, 1200, 600, 300, 200, 150, 100, 75 };
model.ydpi_values = { 4800, 2400, 1200, 600, 300, 200, 150, 100, 75 }; model.ydpi_values = { 4800, 2400, 1200, 600, 300, 200, 150, 100, 75 };
@ -3944,7 +3944,7 @@ void genesys_init_usb_device_tables()
model.vendor = "Canon"; model.vendor = "Canon";
model.model = "LiDE 200"; model.model = "LiDE 200";
model.model_id = MODEL_CANON_LIDE_200; model.model_id = MODEL_CANON_LIDE_200;
model.asic_type = GENESYS_GL847; model.asic_type = AsicType::GL847;
model.xdpi_values = { 4800, 2400, 1200, 600, 300, 200, 150, 100, 75 }; model.xdpi_values = { 4800, 2400, 1200, 600, 300, 200, 150, 100, 75 };
model.ydpi_values = { 4800, 2400, 1200, 600, 300, 200, 150, 100, 75 }; model.ydpi_values = { 4800, 2400, 1200, 600, 300, 200, 150, 100, 75 };
@ -4003,7 +4003,7 @@ void genesys_init_usb_device_tables()
model.vendor = "Canon"; model.vendor = "Canon";
model.model = "LiDE 60"; model.model = "LiDE 60";
model.model_id = MODEL_CANON_LIDE_60; model.model_id = MODEL_CANON_LIDE_60;
model.asic_type = GENESYS_GL841; model.asic_type = AsicType::GL841;
model.xdpi_values = { 1200, 600, 300, 150, 75 }; model.xdpi_values = { 1200, 600, 300, 150, 75 };
model.ydpi_values = { 2400, 1200, 600, 300, 150, 75 }; model.ydpi_values = { 2400, 1200, 600, 300, 150, 75 };
@ -4062,7 +4062,7 @@ void genesys_init_usb_device_tables()
model.vendor = "Canon"; model.vendor = "Canon";
model.model = "LiDE 80"; model.model = "LiDE 80";
model.model_id = MODEL_CANON_LIDE_80; model.model_id = MODEL_CANON_LIDE_80;
model.asic_type = GENESYS_GL841; model.asic_type = AsicType::GL841;
model.xdpi_values = { 1200, 600, 400, 300, 240, 150, 100, 75 }; model.xdpi_values = { 1200, 600, 400, 300, 240, 150, 100, 75 };
model.ydpi_values = { 2400, 1200, 600, 400, 300, 240, 150, 100, 75 }; model.ydpi_values = { 2400, 1200, 600, 400, 300, 240, 150, 100, 75 };
@ -4120,7 +4120,7 @@ void genesys_init_usb_device_tables()
model.vendor = "Hewlett Packard"; model.vendor = "Hewlett Packard";
model.model = "ScanJet 2300c"; model.model = "ScanJet 2300c";
model.model_id = MODEL_HP_SCANJET_2300C; model.model_id = MODEL_HP_SCANJET_2300C;
model.asic_type = GENESYS_GL646; model.asic_type = AsicType::GL646;
model.xdpi_values = { 600, 300, 150, 75 }; model.xdpi_values = { 600, 300, 150, 75 };
model.ydpi_values = { 1200, 600, 300, 150, 75 }; model.ydpi_values = { 1200, 600, 300, 150, 75 };
@ -4177,7 +4177,7 @@ void genesys_init_usb_device_tables()
model.vendor = "Hewlett Packard"; model.vendor = "Hewlett Packard";
model.model = "ScanJet 2400c"; model.model = "ScanJet 2400c";
model.model_id = MODEL_HP_SCANJET_2400C; model.model_id = MODEL_HP_SCANJET_2400C;
model.asic_type = GENESYS_GL646; model.asic_type = AsicType::GL646;
model.xdpi_values = { 1200, 600, 300, 150, 100, 50 }; model.xdpi_values = { 1200, 600, 300, 150, 100, 50 };
model.ydpi_values = { 1200, 600, 300, 150, 100, 50 }; model.ydpi_values = { 1200, 600, 300, 150, 100, 50 };
@ -4235,7 +4235,7 @@ void genesys_init_usb_device_tables()
model.vendor = "Visioneer"; model.vendor = "Visioneer";
model.model = "Strobe XP200"; model.model = "Strobe XP200";
model.model_id = MODEL_VISIONEER_STROBE_XP200; model.model_id = MODEL_VISIONEER_STROBE_XP200;
model.asic_type = GENESYS_GL646; model.asic_type = AsicType::GL646;
model.xdpi_values = { 600, 300, 200, 100, 75 }; model.xdpi_values = { 600, 300, 200, 100, 75 };
model.ydpi_values = { 600, 300, 200, 100, 75 }; model.ydpi_values = { 600, 300, 200, 100, 75 };
@ -4292,7 +4292,7 @@ void genesys_init_usb_device_tables()
model.vendor = "Hewlett Packard"; model.vendor = "Hewlett Packard";
model.model = "ScanJet 3670c"; model.model = "ScanJet 3670c";
model.model_id = MODEL_HP_SCANJET_3670C; model.model_id = MODEL_HP_SCANJET_3670C;
model.asic_type = GENESYS_GL646; model.asic_type = AsicType::GL646;
model.xdpi_values = { 1200, 600, 300, 150, 100, 75 }; model.xdpi_values = { 1200, 600, 300, 150, 100, 75 };
model.ydpi_values = { 1200, 600, 300, 150, 100, 75 }; model.ydpi_values = { 1200, 600, 300, 150, 100, 75 };
@ -4350,7 +4350,7 @@ void genesys_init_usb_device_tables()
model.vendor = "Plustek"; model.vendor = "Plustek";
model.model = "OpticPro ST12"; model.model = "OpticPro ST12";
model.model_id = MODEL_PLUSTEK_OPTICPRO_ST12; model.model_id = MODEL_PLUSTEK_OPTICPRO_ST12;
model.asic_type = GENESYS_GL646; model.asic_type = AsicType::GL646;
model.xdpi_values = { 600, 300, 150, 75 }; model.xdpi_values = { 600, 300, 150, 75 };
model.ydpi_values = { 1200, 600, 300, 150, 75 }; model.ydpi_values = { 1200, 600, 300, 150, 75 };
@ -4401,7 +4401,7 @@ void genesys_init_usb_device_tables()
model.vendor = "Plustek"; model.vendor = "Plustek";
model.model = "OpticPro ST24"; model.model = "OpticPro ST24";
model.model_id = MODEL_PLUSTEK_OPTICPRO_ST24; model.model_id = MODEL_PLUSTEK_OPTICPRO_ST24;
model.asic_type = GENESYS_GL646; model.asic_type = AsicType::GL646;
model.xdpi_values = { 1200, 600, 300, 150, 75 }; model.xdpi_values = { 1200, 600, 300, 150, 75 };
model.ydpi_values = { 2400, 1200, 600, 300, 150, 75 }; model.ydpi_values = { 2400, 1200, 600, 300, 150, 75 };
@ -4457,7 +4457,7 @@ void genesys_init_usb_device_tables()
model.vendor = "Medion"; model.vendor = "Medion";
model.model = "MD5345/MD6228/MD6471"; model.model = "MD5345/MD6228/MD6471";
model.model_id = MODEL_MEDION_MD5345; model.model_id = MODEL_MEDION_MD5345;
model.asic_type = GENESYS_GL646; model.asic_type = AsicType::GL646;
model.xdpi_values = { 1200, 600, 400, 300, 200, 150, 100, 75, 50 }; model.xdpi_values = { 1200, 600, 400, 300, 200, 150, 100, 75, 50 };
model.ydpi_values = { 2400, 1200, 600, 400, 300, 200, 150, 100, 75, 50 }; model.ydpi_values = { 2400, 1200, 600, 400, 300, 200, 150, 100, 75, 50 };
@ -4518,7 +4518,7 @@ void genesys_init_usb_device_tables()
model.vendor = "Visioneer"; model.vendor = "Visioneer";
model.model = "Strobe XP300"; model.model = "Strobe XP300";
model.model_id = MODEL_VISIONEER_STROBE_XP300; model.model_id = MODEL_VISIONEER_STROBE_XP300;
model.asic_type = GENESYS_GL841; model.asic_type = AsicType::GL841;
model.xdpi_values = { 600, 300, 150, 75 }; model.xdpi_values = { 600, 300, 150, 75 };
model.ydpi_values = { 600, 300, 150, 75 }; model.ydpi_values = { 600, 300, 150, 75 };
@ -4573,7 +4573,7 @@ void genesys_init_usb_device_tables()
model.vendor = "Syscan/Ambir"; model.vendor = "Syscan/Ambir";
model.model = "DocketPORT 665"; model.model = "DocketPORT 665";
model.model_id = MODEL_SYSCAN_DOCKETPORT_665; model.model_id = MODEL_SYSCAN_DOCKETPORT_665;
model.asic_type = GENESYS_GL841; model.asic_type = AsicType::GL841;
model.xdpi_values = { 600, 300, 150, 75 }; model.xdpi_values = { 600, 300, 150, 75 };
model.ydpi_values = { 1200, 600, 300, 150, 75 }; model.ydpi_values = { 1200, 600, 300, 150, 75 };
@ -4628,7 +4628,7 @@ void genesys_init_usb_device_tables()
model.vendor = "Visioneer"; model.vendor = "Visioneer";
model.model = "Readwarrior"; model.model = "Readwarrior";
model.model_id = MODEL_VISIONEER_ROADWARRIOR; model.model_id = MODEL_VISIONEER_ROADWARRIOR;
model.asic_type = GENESYS_GL841; model.asic_type = AsicType::GL841;
model.xdpi_values = { 600, 300, 150, 75 }; model.xdpi_values = { 600, 300, 150, 75 };
model.ydpi_values = { 1200, 600, 300, 150, 75 }; model.ydpi_values = { 1200, 600, 300, 150, 75 };
@ -4683,7 +4683,7 @@ void genesys_init_usb_device_tables()
model.vendor = "Syscan"; model.vendor = "Syscan";
model.model = "DocketPORT 465"; model.model = "DocketPORT 465";
model.model_id = MODEL_SYSCAN_DOCKETPORT_465; model.model_id = MODEL_SYSCAN_DOCKETPORT_465;
model.asic_type = GENESYS_GL841; model.asic_type = AsicType::GL841;
model.xdpi_values = { 600, 300, 150, 75 }; model.xdpi_values = { 600, 300, 150, 75 };
model.ydpi_values = { 1200, 600, 300, 150, 75 }; model.ydpi_values = { 1200, 600, 300, 150, 75 };
@ -4739,7 +4739,7 @@ void genesys_init_usb_device_tables()
model.vendor = "Visioneer"; model.vendor = "Visioneer";
model.model = "XP100 Revision 3"; model.model = "XP100 Revision 3";
model.model_id = MODEL_VISIONEER_STROBE_XP100_REVISION3; model.model_id = MODEL_VISIONEER_STROBE_XP100_REVISION3;
model.asic_type = GENESYS_GL841; model.asic_type = AsicType::GL841;
model.xdpi_values = { 600, 300, 150, 75 }; model.xdpi_values = { 600, 300, 150, 75 };
model.ydpi_values = { 1200, 600, 300, 150, 75 }; model.ydpi_values = { 1200, 600, 300, 150, 75 };
@ -4794,7 +4794,7 @@ void genesys_init_usb_device_tables()
model.vendor = "Pentax"; model.vendor = "Pentax";
model.model = "DSmobile 600"; model.model = "DSmobile 600";
model.model_id = MODEL_PENTAX_DSMOBILE_600; model.model_id = MODEL_PENTAX_DSMOBILE_600;
model.asic_type = GENESYS_GL841; model.asic_type = AsicType::GL841;
model.xdpi_values = { 600, 300, 150, 75 }; model.xdpi_values = { 600, 300, 150, 75 };
model.ydpi_values = { 1200, 600, 300, 150, 75 }; model.ydpi_values = { 1200, 600, 300, 150, 75 };
@ -4851,7 +4851,7 @@ void genesys_init_usb_device_tables()
model.vendor = "Syscan"; model.vendor = "Syscan";
model.model = "DocketPORT 467"; model.model = "DocketPORT 467";
model.model_id = MODEL_SYSCAN_DOCKETPORT_467; model.model_id = MODEL_SYSCAN_DOCKETPORT_467;
model.asic_type = GENESYS_GL841; model.asic_type = AsicType::GL841;
model.xdpi_values = { 600, 300, 150, 75 }; model.xdpi_values = { 600, 300, 150, 75 };
model.ydpi_values = { 1200, 600, 300, 150, 75 }; model.ydpi_values = { 1200, 600, 300, 150, 75 };
@ -4905,7 +4905,7 @@ void genesys_init_usb_device_tables()
model.vendor = "Syscan/Ambir"; model.vendor = "Syscan/Ambir";
model.model = "DocketPORT 685"; model.model = "DocketPORT 685";
model.model_id = MODEL_SYSCAN_DOCKETPORT_685; model.model_id = MODEL_SYSCAN_DOCKETPORT_685;
model.asic_type = GENESYS_GL841; model.asic_type = AsicType::GL841;
model.xdpi_values = { 600, 300, 150, 75 }; model.xdpi_values = { 600, 300, 150, 75 };
model.ydpi_values = { 600, 300, 150, 75 }; model.ydpi_values = { 600, 300, 150, 75 };
@ -4962,7 +4962,7 @@ void genesys_init_usb_device_tables()
model.vendor = "Syscan/Ambir"; model.vendor = "Syscan/Ambir";
model.model = "DocketPORT 485"; model.model = "DocketPORT 485";
model.model_id = MODEL_SYSCAN_DOCKETPORT_485; model.model_id = MODEL_SYSCAN_DOCKETPORT_485;
model.asic_type = GENESYS_GL841; model.asic_type = AsicType::GL841;
model.xdpi_values = { 600, 300, 150, 75 }; model.xdpi_values = { 600, 300, 150, 75 };
model.ydpi_values = { 600, 300, 150, 75 }; model.ydpi_values = { 600, 300, 150, 75 };
@ -5018,7 +5018,7 @@ void genesys_init_usb_device_tables()
model.vendor = "DCT"; model.vendor = "DCT";
model.model = "DocketPORT 487"; model.model = "DocketPORT 487";
model.model_id = MODEL_DCT_DOCKETPORT_487; model.model_id = MODEL_DCT_DOCKETPORT_487;
model.asic_type = GENESYS_GL841; model.asic_type = AsicType::GL841;
model.xdpi_values = { 600, 300, 150, 75 }; model.xdpi_values = { 600, 300, 150, 75 };
model.ydpi_values = { 600, 300, 150, 75 }; model.ydpi_values = { 600, 300, 150, 75 };
@ -5075,7 +5075,7 @@ void genesys_init_usb_device_tables()
model.vendor = "Visioneer"; model.vendor = "Visioneer";
model.model = "OneTouch 7100"; model.model = "OneTouch 7100";
model.model_id = MODEL_VISIONEER_7100; model.model_id = MODEL_VISIONEER_7100;
model.asic_type = GENESYS_GL646; model.asic_type = AsicType::GL646;
model.xdpi_values = { 1200, 600, 400, 300, 200, 150, 100, 75, 50 }; model.xdpi_values = { 1200, 600, 400, 300, 200, 150, 100, 75, 50 };
model.ydpi_values = { 2400, 1200, 600, 400, 300, 200, 150, 100, 75, 50 }; model.ydpi_values = { 2400, 1200, 600, 400, 300, 200, 150, 100, 75, 50 };
@ -5136,7 +5136,7 @@ void genesys_init_usb_device_tables()
model.vendor = "Xerox"; model.vendor = "Xerox";
model.model = "OneTouch 2400"; model.model = "OneTouch 2400";
model.model_id = MODEL_XEROX_2400; model.model_id = MODEL_XEROX_2400;
model.asic_type = GENESYS_GL646; model.asic_type = AsicType::GL646;
model.xdpi_values = { 1200, 600, 400, 300, 200, 150, 100, 75, 50 }; model.xdpi_values = { 1200, 600, 400, 300, 200, 150, 100, 75, 50 };
model.ydpi_values = { 2400, 1200, 600, 400, 300, 200, 150, 100, 75, 50 }; model.ydpi_values = { 2400, 1200, 600, 400, 300, 200, 150, 100, 75, 50 };
@ -5197,7 +5197,7 @@ void genesys_init_usb_device_tables()
model.vendor = "Xerox"; model.vendor = "Xerox";
model.model = "Travelscanner 100"; model.model = "Travelscanner 100";
model.model_id = MODEL_XEROX_TRAVELSCANNER_100; model.model_id = MODEL_XEROX_TRAVELSCANNER_100;
model.asic_type = GENESYS_GL841; model.asic_type = AsicType::GL841;
model.xdpi_values = { 600, 300, 150, 75 }; model.xdpi_values = { 600, 300, 150, 75 };
model.ydpi_values = { 1200, 600, 300, 150, 75 }; model.ydpi_values = { 1200, 600, 300, 150, 75 };
@ -5253,7 +5253,7 @@ void genesys_init_usb_device_tables()
model.vendor = "PLUSTEK"; model.vendor = "PLUSTEK";
model.model = "OpticBook 3600"; model.model = "OpticBook 3600";
model.model_id = MODEL_PLUSTEK_OPTICPRO_3600; model.model_id = MODEL_PLUSTEK_OPTICPRO_3600;
model.asic_type = GENESYS_GL841; model.asic_type = AsicType::GL841;
model.xdpi_values = { /*1200,*/ 600, 400, 300, 200, 150, 100, 75 }; model.xdpi_values = { /*1200,*/ 600, 400, 300, 200, 150, 100, 75 };
model.ydpi_values = { /*2400,*/ 1200, 600, 400, 300, 200, 150, 100, 75 }; model.ydpi_values = { /*2400,*/ 1200, 600, 400, 300, 200, 150, 100, 75 };
model.bpp_gray_values = { 16, 8 }; model.bpp_gray_values = { 16, 8 };
@ -5309,7 +5309,7 @@ void genesys_init_usb_device_tables()
model.vendor = "Hewlett Packard"; model.vendor = "Hewlett Packard";
model.model = "ScanJet N6310"; model.model = "ScanJet N6310";
model.model_id = MODEL_HP_SCANJET_N6310; model.model_id = MODEL_HP_SCANJET_N6310;
model.asic_type = GENESYS_GL847; model.asic_type = AsicType::GL847;
model.xdpi_values = { 2400, 1200, 600, 400, 300, 200, 150, 100, 75 }; model.xdpi_values = { 2400, 1200, 600, 400, 300, 200, 150, 100, 75 };
model.ydpi_values = { 2400, 1200, 600, 400, 300, 200, 150, 100, 75 }; model.ydpi_values = { 2400, 1200, 600, 400, 300, 200, 150, 100, 75 };
@ -5370,7 +5370,7 @@ void genesys_init_usb_device_tables()
model.vendor = "PLUSTEK"; model.vendor = "PLUSTEK";
model.model = "OpticBook 3800"; model.model = "OpticBook 3800";
model.model_id = MODEL_PLUSTEK_OPTICBOOK_3800; model.model_id = MODEL_PLUSTEK_OPTICBOOK_3800;
model.asic_type = GENESYS_GL845; model.asic_type = AsicType::GL845;
model.xdpi_values = { 1200, 600, 300, 150, 100, 75 }; model.xdpi_values = { 1200, 600, 300, 150, 100, 75 };
model.ydpi_values = { 1200, 600, 300, 150, 100, 75 }; model.ydpi_values = { 1200, 600, 300, 150, 100, 75 };
@ -5425,7 +5425,7 @@ void genesys_init_usb_device_tables()
model.vendor = "Canon"; model.vendor = "Canon";
model.model = "Image Formula 101"; model.model = "Image Formula 101";
model.model_id = MODEL_CANON_IMAGE_FORMULA_101; model.model_id = MODEL_CANON_IMAGE_FORMULA_101;
model.asic_type = GENESYS_GL846; model.asic_type = AsicType::GL846;
model.xdpi_values = { 1200, 600, 300, 150, 100, 75 }; model.xdpi_values = { 1200, 600, 300, 150, 100, 75 };
model.ydpi_values = { 1200, 600, 300, 150, 100, 75 }; model.ydpi_values = { 1200, 600, 300, 150, 100, 75 };

Wyświetl plik

@ -286,4 +286,18 @@ enum Genesys_Motor_Type
MOTOR_CANONLIDE120 MOTOR_CANONLIDE120
}; };
enum class AsicType : unsigned
{
UNKNOWN = 0,
GL646,
GL841,
GL843,
GL845,
GL846,
GL847,
GL848,
GL123,
GL124,
};
#endif // BACKEND_GENESYS_ENUMS_H #endif // BACKEND_GENESYS_ENUMS_H

Wyświetl plik

@ -68,13 +68,13 @@ void sanei_genesys_init_cmd_set(Genesys_Device* dev)
DBG_INIT (); DBG_INIT ();
DBG_HELPER(dbg); DBG_HELPER(dbg);
switch (dev->model->asic_type) { switch (dev->model->asic_type) {
case GENESYS_GL646: dev->cmd_set = &gl646_cmd_set; break; case AsicType::GL646: dev->cmd_set = &gl646_cmd_set; break;
case GENESYS_GL841: dev->cmd_set = &gl841_cmd_set; break; case AsicType::GL841: dev->cmd_set = &gl841_cmd_set; break;
case GENESYS_GL843: dev->cmd_set = &gl843_cmd_set; break; case AsicType::GL843: dev->cmd_set = &gl843_cmd_set; break;
case GENESYS_GL845: // since only a few reg bits differs we handle both together case AsicType::GL845: // since only a few reg bits differs we handle both together
case GENESYS_GL846: dev->cmd_set = &gl846_cmd_set; break; case AsicType::GL846: dev->cmd_set = &gl846_cmd_set; break;
case GENESYS_GL847: dev->cmd_set = &gl847_cmd_set; break; case AsicType::GL847: dev->cmd_set = &gl847_cmd_set; break;
case GENESYS_GL124: dev->cmd_set = &gl124_cmd_set; break; case AsicType::GL124: dev->cmd_set = &gl124_cmd_set; break;
default: throw SaneException(SANE_STATUS_INVAL, "unknown ASIC type"); default: throw SaneException(SANE_STATUS_INVAL, "unknown ASIC type");
} }
} }
@ -170,9 +170,10 @@ extern unsigned sanei_genesys_get_bulk_max_size(Genesys_Device * dev)
b_size is the size of the ring buffer. By default it's 300*1024, so the b_size is the size of the ring buffer. By default it's 300*1024, so the
packet is limited 61440 without any visibility to acquiring software. packet is limited 61440 without any visibility to acquiring software.
*/ */
if (dev->model->asic_type == GENESYS_GL124 || if (dev->model->asic_type == AsicType::GL124 ||
dev->model->asic_type == GENESYS_GL846 || dev->model->asic_type == AsicType::GL846 ||
dev->model->asic_type == GENESYS_GL847) { dev->model->asic_type == AsicType::GL847)
{
return 0xeff0; return 0xeff0;
} }
return 0xf000; return 0xf000;
@ -183,17 +184,17 @@ void sanei_genesys_bulk_read_data_send_header(Genesys_Device* dev, size_t len)
DBG_HELPER(dbg); DBG_HELPER(dbg);
uint8_t outdata[8]; uint8_t outdata[8];
if (dev->model->asic_type == GENESYS_GL124 || if (dev->model->asic_type == AsicType::GL124 ||
dev->model->asic_type == GENESYS_GL846 || dev->model->asic_type == AsicType::GL846 ||
dev->model->asic_type == GENESYS_GL847) dev->model->asic_type == AsicType::GL847)
{ {
// hard coded 0x10000000 address // hard coded 0x10000000 address
outdata[0] = 0; outdata[0] = 0;
outdata[1] = 0; outdata[1] = 0;
outdata[2] = 0; outdata[2] = 0;
outdata[3] = 0x10; outdata[3] = 0x10;
} else if (dev->model->asic_type == GENESYS_GL841 || } else if (dev->model->asic_type == AsicType::GL841 ||
dev->model->asic_type == GENESYS_GL843) { dev->model->asic_type == AsicType::GL843) {
outdata[0] = BULK_IN; outdata[0] = BULK_IN;
outdata[1] = BULK_RAM; outdata[1] = BULK_RAM;
outdata[2] = 0x82; // outdata[2] = 0x82; //
@ -226,9 +227,9 @@ void sanei_genesys_bulk_read_data(Genesys_Device * dev, uint8_t addr, uint8_t* d
unsigned is_addr_used = 1; unsigned is_addr_used = 1;
unsigned has_header_before_each_chunk = 0; unsigned has_header_before_each_chunk = 0;
if (dev->model->asic_type == GENESYS_GL124 || if (dev->model->asic_type == AsicType::GL124 ||
dev->model->asic_type == GENESYS_GL846 || dev->model->asic_type == AsicType::GL846 ||
dev->model->asic_type == GENESYS_GL847) dev->model->asic_type == AsicType::GL847)
{ {
is_addr_used = 0; is_addr_used = 0;
has_header_before_each_chunk = 1; has_header_before_each_chunk = 1;
@ -304,7 +305,7 @@ void sanei_genesys_bulk_write_data(Genesys_Device* dev, uint8_t addr, uint8_t* d
else else
size = len; size = len;
if (dev->model->asic_type == GENESYS_GL841) { if (dev->model->asic_type == AsicType::GL841) {
outdata[0] = BULK_OUT; outdata[0] = BULK_OUT;
outdata[1] = BULK_RAM; outdata[1] = BULK_RAM;
// both 0x82 and 0x00 works on GL841. // both 0x82 and 0x00 works on GL841.
@ -417,11 +418,11 @@ void sanei_genesys_write_register(Genesys_Device* dev, uint16_t reg, uint8_t val
return; return;
} }
/* route to gl847 function if needed */ // route to gl847 function if needed
if(dev->model->asic_type==GENESYS_GL847 if (dev->model->asic_type == AsicType::GL847 ||
|| dev->model->asic_type==GENESYS_GL845 dev->model->asic_type == AsicType::GL845 ||
|| dev->model->asic_type==GENESYS_GL846 dev->model->asic_type == AsicType::GL846 ||
|| dev->model->asic_type==GENESYS_GL124) dev->model->asic_type == AsicType::GL124)
{ {
sanei_genesys_write_gl847_register(dev, reg, val); sanei_genesys_write_gl847_register(dev, reg, val);
return; return;
@ -489,10 +490,10 @@ void sanei_genesys_read_register(Genesys_Device* dev, uint16_t reg, uint8_t* val
} }
// route to gl847 function if needed // route to gl847 function if needed
if (dev->model->asic_type==GENESYS_GL847 if (dev->model->asic_type == AsicType::GL847 ||
|| dev->model->asic_type==GENESYS_GL845 dev->model->asic_type == AsicType::GL845 ||
|| dev->model->asic_type==GENESYS_GL846 dev->model->asic_type == AsicType::GL846 ||
|| dev->model->asic_type==GENESYS_GL124) dev->model->asic_type == AsicType::GL124)
{ {
sanei_genesys_read_gl847_register(dev, reg, val); sanei_genesys_read_gl847_register(dev, reg, val);
return; return;
@ -517,10 +518,10 @@ void sanei_genesys_set_buffer_address(Genesys_Device* dev, uint32_t addr)
{ {
DBG_HELPER(dbg); DBG_HELPER(dbg);
if(dev->model->asic_type==GENESYS_GL847 if (dev->model->asic_type==AsicType::GL847 ||
|| dev->model->asic_type==GENESYS_GL845 dev->model->asic_type==AsicType::GL845 ||
|| dev->model->asic_type==GENESYS_GL846 dev->model->asic_type==AsicType::GL846 ||
|| dev->model->asic_type==GENESYS_GL124) dev->model->asic_type==AsicType::GL124)
{ {
DBG(DBG_warn, "%s: shouldn't be used for GL846+ ASICs\n", __func__); DBG(DBG_warn, "%s: shouldn't be used for GL846+ ASICs\n", __func__);
return; return;
@ -573,7 +574,7 @@ void sanei_genesys_fe_write_data(Genesys_Device* dev, uint8_t addr, uint16_t dat
Genesys_Register_Set reg(Genesys_Register_Set::SEQUENTIAL); Genesys_Register_Set reg(Genesys_Register_Set::SEQUENTIAL);
reg.init_reg(0x51, addr); reg.init_reg(0x51, addr);
if (dev->model->asic_type == GENESYS_GL124) { if (dev->model->asic_type == AsicType::GL124) {
reg.init_reg(0x5d, (data / 256) & 0xff); reg.init_reg(0x5d, (data / 256) & 0xff);
reg.init_reg(0x5e, data & 0xff); reg.init_reg(0x5e, data & 0xff);
} else { } else {
@ -593,7 +594,7 @@ void sanei_genesys_fe_write_data(Genesys_Device* dev, uint8_t addr, uint16_t dat
void sanei_genesys_get_status(Genesys_Device* dev, uint8_t* status) void sanei_genesys_get_status(Genesys_Device* dev, uint8_t* status)
{ {
DBG_HELPER(dbg); DBG_HELPER(dbg);
if (dev->model->asic_type == GENESYS_GL124) { if (dev->model->asic_type == AsicType::GL124) {
sanei_genesys_read_hregister(dev, 0x101, status); sanei_genesys_read_hregister(dev, 0x101, status);
return; return;
} }
@ -653,22 +654,22 @@ void sanei_genesys_read_valid_words(Genesys_Device* dev, unsigned int* words)
switch (dev->model->asic_type) switch (dev->model->asic_type)
{ {
case GENESYS_GL124: case AsicType::GL124:
*words = dev->read_register(0x102) & 0x03; *words = dev->read_register(0x102) & 0x03;
*words = *words * 256 + dev->read_register(0x103); *words = *words * 256 + dev->read_register(0x103);
*words = *words * 256 + dev->read_register(0x104); *words = *words * 256 + dev->read_register(0x104);
*words = *words * 256 + dev->read_register(0x105); *words = *words * 256 + dev->read_register(0x105);
break; break;
case GENESYS_GL845: case AsicType::GL845:
case GENESYS_GL846: case AsicType::GL846:
*words = dev->read_register(0x42) & 0x02; *words = dev->read_register(0x42) & 0x02;
*words = *words * 256 + dev->read_register(0x43); *words = *words * 256 + dev->read_register(0x43);
*words = *words * 256 + dev->read_register(0x44); *words = *words * 256 + dev->read_register(0x44);
*words = *words * 256 + dev->read_register(0x45); *words = *words * 256 + dev->read_register(0x45);
break; break;
case GENESYS_GL847: case AsicType::GL847:
*words = dev->read_register(0x42) & 0x03; *words = dev->read_register(0x42) & 0x03;
*words = *words * 256 + dev->read_register(0x43); *words = *words * 256 + dev->read_register(0x43);
*words = *words * 256 + dev->read_register(0x44); *words = *words * 256 + dev->read_register(0x44);
@ -678,7 +679,7 @@ void sanei_genesys_read_valid_words(Genesys_Device* dev, unsigned int* words)
default: default:
*words = dev->read_register(0x44); *words = dev->read_register(0x44);
*words += dev->read_register(0x43) * 256; *words += dev->read_register(0x43) * 256;
if (dev->model->asic_type == GENESYS_GL646) { if (dev->model->asic_type == AsicType::GL646) {
*words += ((dev->read_register(0x42) & 0x03) * 256 * 256); *words += ((dev->read_register(0x42) & 0x03) * 256 * 256);
} else { } else {
*words += ((dev->read_register(0x42) & 0x0f) * 256 * 256); *words += ((dev->read_register(0x42) & 0x0f) * 256 * 256);
@ -695,8 +696,7 @@ void sanei_genesys_read_scancnt(Genesys_Device* dev, unsigned int* words)
{ {
DBG_HELPER(dbg); DBG_HELPER(dbg);
if (dev->model->asic_type == GENESYS_GL124) if (dev->model->asic_type == AsicType::GL124) {
{
*words = (dev->read_register(0x10b) & 0x0f) << 16; *words = (dev->read_register(0x10b) & 0x0f) << 16;
*words += (dev->read_register(0x10c) << 8); *words += (dev->read_register(0x10c) << 8);
*words += dev->read_register(0x10d); *words += dev->read_register(0x10d);
@ -705,7 +705,7 @@ void sanei_genesys_read_scancnt(Genesys_Device* dev, unsigned int* words)
{ {
*words = dev->read_register(0x4d); *words = dev->read_register(0x4d);
*words += dev->read_register(0x4c) * 256; *words += dev->read_register(0x4c) * 256;
if (dev->model->asic_type == GENESYS_GL646) { if (dev->model->asic_type == AsicType::GL646) {
*words += ((dev->read_register(0x4b) & 0x03) * 256 * 256); *words += ((dev->read_register(0x4b) & 0x03) * 256 * 256);
} else { } else {
*words += ((dev->read_register(0x4b) & 0x0f) * 256 * 256); *words += ((dev->read_register(0x4b) & 0x0f) * 256 * 256);
@ -776,8 +776,7 @@ void sanei_genesys_read_feed_steps(Genesys_Device* dev, unsigned int* steps)
{ {
DBG_HELPER(dbg); DBG_HELPER(dbg);
if (dev->model->asic_type == GENESYS_GL124) if (dev->model->asic_type == AsicType::GL124) {
{
*steps = (dev->read_register(0x108) & 0x1f) << 16; *steps = (dev->read_register(0x108) & 0x1f) << 16;
*steps += (dev->read_register(0x109) << 8); *steps += (dev->read_register(0x109) << 8);
*steps += dev->read_register(0x10a); *steps += dev->read_register(0x10a);
@ -786,9 +785,9 @@ void sanei_genesys_read_feed_steps(Genesys_Device* dev, unsigned int* steps)
{ {
*steps = dev->read_register(0x4a); *steps = dev->read_register(0x4a);
*steps += dev->read_register(0x49) * 256; *steps += dev->read_register(0x49) * 256;
if (dev->model->asic_type == GENESYS_GL646) { if (dev->model->asic_type == AsicType::GL646) {
*steps += ((dev->read_register(0x48) & 0x03) * 256 * 256); *steps += ((dev->read_register(0x48) & 0x03) * 256 * 256);
} else if (dev->model->asic_type == GENESYS_GL841) { } else if (dev->model->asic_type == AsicType::GL841) {
*steps += ((dev->read_register(0x48) & 0x0f) * 256 * 256); *steps += ((dev->read_register(0x48) & 0x0f) * 256 * 256);
} else { } else {
*steps += ((dev->read_register(0x48) & 0x1f) * 256 * 256); *steps += ((dev->read_register(0x48) & 0x1f) * 256 * 256);
@ -806,12 +805,12 @@ void sanei_genesys_set_lamp_power(Genesys_Device* dev, const Genesys_Sensor& sen
if (set) { if (set) {
regs.find_reg(0x03).value |= REG03_LAMPPWR; regs.find_reg(0x03).value |= REG03_LAMPPWR;
if (dev->model->asic_type == GENESYS_GL841) { if (dev->model->asic_type == AsicType::GL841) {
sanei_genesys_set_exposure(regs, sanei_genesys_fixup_exposure(sensor.exposure)); sanei_genesys_set_exposure(regs, sanei_genesys_fixup_exposure(sensor.exposure));
regs.set8(0x19, 0x50); regs.set8(0x19, 0x50);
} }
if (dev->model->asic_type == GENESYS_GL843) { if (dev->model->asic_type == AsicType::GL843) {
sanei_genesys_set_exposure(regs, sensor.exposure); sanei_genesys_set_exposure(regs, sensor.exposure);
// we don't actually turn on lamp on infrared scan // we don't actually turn on lamp on infrared scan
@ -825,12 +824,12 @@ void sanei_genesys_set_lamp_power(Genesys_Device* dev, const Genesys_Sensor& sen
} else { } else {
regs.find_reg(0x03).value &= ~REG03_LAMPPWR; regs.find_reg(0x03).value &= ~REG03_LAMPPWR;
if (dev->model->asic_type == GENESYS_GL841) { if (dev->model->asic_type == AsicType::GL841) {
sanei_genesys_set_exposure(regs, {0x0101, 0x0101, 0x0101}); sanei_genesys_set_exposure(regs, {0x0101, 0x0101, 0x0101});
regs.set8(0x19, 0xff); regs.set8(0x19, 0xff);
} }
if (dev->model->asic_type == GENESYS_GL843) { if (dev->model->asic_type == AsicType::GL843) {
if (dev->model->model_id == MODEL_PANASONIC_KV_SS080 || if (dev->model->model_id == MODEL_PANASONIC_KV_SS080 ||
dev->model->model_id == MODEL_HP_SCANJET_4850C || dev->model->model_id == MODEL_HP_SCANJET_4850C ||
dev->model->model_id == MODEL_HP_SCANJET_G4010 || dev->model->model_id == MODEL_HP_SCANJET_G4010 ||
@ -867,8 +866,8 @@ void sanei_genesys_bulk_write_register(Genesys_Device* dev, const Genesys_Regist
{ {
DBG_HELPER(dbg); DBG_HELPER(dbg);
if (dev->model->asic_type == GENESYS_GL646 || if (dev->model->asic_type == AsicType::GL646 ||
dev->model->asic_type == GENESYS_GL841) dev->model->asic_type == AsicType::GL841)
{ {
uint8_t outdata[8]; uint8_t outdata[8];
std::vector<uint8_t> buffer; std::vector<uint8_t> buffer;
@ -883,7 +882,7 @@ void sanei_genesys_bulk_write_register(Genesys_Device* dev, const Genesys_Regist
DBG(DBG_io, "%s (elems= %lu, size = %lu)\n", __func__, (u_long) reg.size(), DBG(DBG_io, "%s (elems= %lu, size = %lu)\n", __func__, (u_long) reg.size(),
(u_long) buffer.size()); (u_long) buffer.size());
if (dev->model->asic_type == GENESYS_GL646) { if (dev->model->asic_type == AsicType::GL646) {
outdata[0] = BULK_OUT; outdata[0] = BULK_OUT;
outdata[1] = BULK_REGISTER; outdata[1] = BULK_REGISTER;
outdata[2] = 0x00; outdata[2] = 0x00;

Wyświetl plik

@ -204,16 +204,6 @@
#define MAX_RESOLUTIONS 13 #define MAX_RESOLUTIONS 13
#define MAX_DPI 4 #define MAX_DPI 4
#define GENESYS_GL646 646
#define GENESYS_GL841 841
#define GENESYS_GL843 843
#define GENESYS_GL845 845
#define GENESYS_GL846 846
#define GENESYS_GL847 847
#define GENESYS_GL848 848
#define GENESYS_GL123 123
#define GENESYS_GL124 124
/* Forward typedefs */ /* Forward typedefs */
struct Genesys_Scanner; struct Genesys_Scanner;
typedef struct Genesys_Calibration_Cache Genesys_Calibration_Cache; typedef struct Genesys_Calibration_Cache Genesys_Calibration_Cache;