From 4de7e23e897cd1ac698ea377b58118a0e087f2d5 Mon Sep 17 00:00:00 2001 From: Henning Geinitz Date: Tue, 30 Sep 2003 17:37:56 +0000 Subject: [PATCH] Added detection of Genius Vivid 4x. It won't work out-of-the-box, however. CCD coarse calib shouldn't run into an endless loop anymore. Plustek 1248U is much faster now. --- backend/gt68xx.c | 2 +- backend/gt68xx.conf | 7 ++++ backend/gt68xx_devices.c | 50 ++++++++++++++++++++++++++++ backend/gt68xx_high.c | 64 ++++++++++++++++++++++-------------- doc/descriptions/gt68xx.desc | 9 +++-- doc/gt68xx/gt68xx.CHANGES | 7 ++-- 6 files changed, 110 insertions(+), 29 deletions(-) diff --git a/backend/gt68xx.c b/backend/gt68xx.c index 041e98778..129cc9581 100644 --- a/backend/gt68xx.c +++ b/backend/gt68xx.c @@ -48,7 +48,7 @@ #include "../include/sane/config.h" -#define BUILD 48 +#define BUILD 49 #define MAX_DEBUG #define WARMUP_TIME 30 #define CALIBRATION_HEIGHT 2.5 diff --git a/backend/gt68xx.conf b/backend/gt68xx.conf index 88bf58cdd..204366f63 100644 --- a/backend/gt68xx.conf +++ b/backend/gt68xx.conf @@ -1,3 +1,4 @@ + # gt68xx.conf: Configuration file for GT68XX based scanners # Read man sane-gt68xx for documentation @@ -141,6 +142,12 @@ usb 0x0458 0x2011 # Genius Colorpage Vivid3x doesn't need any manual settings +############################################################################## +# Autodetect Genius Colorpage Vivid4x +usb 0x0458 0x201b + +# Genius Colorpage Vivid3x doesn't need any manual settings + ############################################################################## # Autodetect Genius Colorpage Vivid3xe usb 0x0458 0x2017 diff --git a/backend/gt68xx_devices.c b/backend/gt68xx_devices.c index 606a763ce..864ed2181 100644 --- a/backend/gt68xx_devices.c +++ b/backend/gt68xx_devices.c @@ -906,6 +906,55 @@ static GT68xx_Model genius_vivid3x_model = { /* Tested zo some degree, based on the Plustek OpticPro 1248U*/ }; +static GT68xx_Model genius_vivid4x_model = { + "genius-colorpage-vivid4x", /* Name */ + "Genius", /* Device vendor string */ + "Colorpage Vivid4x", /* Device model name */ + "ccd548.fw", /* Name of the firmware file */ + SANE_FALSE, /* Dynamic allocation flag */ + + &plustek_gt6801_command_set, /* Command set used by this scanner */ + + 600, /* maximum optical sensor resolution */ + 600, /* maximum motor resolution */ + 600, /* base x-res used to calculate geometry */ + 600, /* base y-res used to calculate geometry */ + 50, /* if ydpi is equal or higher, use linemode */ + SANE_TRUE, /* Use base_ydpi for all resolutions */ + + {600, 300, 150, 75, 0}, /* possible x-resolutions */ + {600, 300, 150, 75, 0}, /* possible y-resolutions */ + {12, 8, 0}, /* possible depths in gray mode */ + {12, 8, 0}, /* possible depths in color mode */ + + SANE_FIX (3.5), /* Start of scan area in mm (x) */ + SANE_FIX (7.5), /* Start of scan area in mm (y) */ + SANE_FIX (218.0), /* Size of scan area in mm (x) */ + SANE_FIX (299.0), /* Size of scan area in mm (y) */ + + SANE_FIX (0.0), /* Start of white strip in mm (y) */ + SANE_FIX (1.0), /* Start of black mark in mm (x) */ + + SANE_FIX (0.0), /* Start of scan area in TA mode in mm (x) */ + SANE_FIX (0.0), /* Start of scan area in TA mode in mm (y) */ + SANE_FIX (100.0), /* Size of scan area in TA mode in mm (x) */ + SANE_FIX (100.0), /* Size of scan area in TA mode in mm (y) */ + + SANE_FIX (0.0), /* Start of white strip in TA mode in mm (y) */ + + 0, 8, 16, /* RGB CCD Line-distance correction in pixel */ + 0, /* CCD distcance for CCD with 6 lines) */ + + COLOR_ORDER_BGR, /* Order of the CCD/CIS colors */ + {0x1c, 0x29, 0x1c, 0x2c, 0x1c, 0x2b}, /* Default offset/gain */ + {0x157, 0x157, 0x157}, /* Default exposure parameters */ + SANE_FIX (2.0), /* Default gamma value */ + + SANE_FALSE, /* Is this a CIS scanner? */ + GT68XX_FLAG_OFFSET_INV | GT68XX_FLAG_UNTESTED /* Which flags are needed for this scanner? */ + /* Completely unmtested, copied from 3x */ +}; + static GT68xx_Model genius_vivid3xe_model = { "genius-colorpage-vivid3xe", /* Name */ "Genius", /* Device vendor string */ @@ -1022,5 +1071,6 @@ static GT68xx_USB_Device_Entry gt68xx_usb_device_list[] = { {0x07b3, 0x0413, &plustek_opticslim1200}, {0x0458, 0x2011, &genius_vivid3x_model}, {0x0458, 0x2017, &genius_vivid3xe_model}, + {0x0458, 0x201b, &genius_vivid4x_model}, {0, 0, NULL} }; diff --git a/backend/gt68xx_high.c b/backend/gt68xx_high.c index b4cac4a42..20339811a 100644 --- a/backend/gt68xx_high.c +++ b/backend/gt68xx_high.c @@ -1070,24 +1070,27 @@ gt68xx_afe_ccd_calc (GT68xx_Afe_Values * values, unsigned int *buffer) static SANE_Bool gt68xx_afe_ccd_adjust_offset_gain (GT68xx_Afe_Values * values, unsigned int *buffer, SANE_Byte * offset, - SANE_Byte * pga) + SANE_Byte * pga, SANE_Byte * old_offset, + SANE_Byte * old_pga) { SANE_Int black_low = values->coarse_black, black_high = black_low + 15; SANE_Int white_high = values->coarse_white, white_low = white_high - 15; SANE_Bool done = SANE_TRUE; + SANE_Byte local_pga = *pga; + SANE_Byte local_offset = *offset; gt68xx_afe_ccd_calc (values, buffer); if (values->white > white_high) { if (values->black > black_high) - *offset += values->offset_direction; + local_offset += values->offset_direction; else if (values->black < black_low) - (*pga)--; + local_pga--; else { - *offset += values->offset_direction; - (*pga)--; + local_offset += values->offset_direction; + local_pga--; } done = SANE_FALSE; goto finish; @@ -1095,13 +1098,13 @@ gt68xx_afe_ccd_adjust_offset_gain (GT68xx_Afe_Values * values, else if (values->white < white_low) { if (values->black < black_low) - *offset -= values->offset_direction; + local_offset -= values->offset_direction; else if (values->black > black_high) - (*pga)++; + local_pga++; else { - *offset -= values->offset_direction; - (*pga)++; + local_offset -= values->offset_direction; + local_pga++; } done = SANE_FALSE; goto finish; @@ -1109,13 +1112,13 @@ gt68xx_afe_ccd_adjust_offset_gain (GT68xx_Afe_Values * values, if (values->black > black_high) { if (values->white > white_high) - *offset += values->offset_direction; + local_offset += values->offset_direction; else if (values->white < white_low) - (*pga)++; + local_pga++; else { - *offset += values->offset_direction; - (*pga)++; + local_offset += values->offset_direction; + local_pga++; } done = SANE_FALSE; goto finish; @@ -1123,20 +1126,28 @@ gt68xx_afe_ccd_adjust_offset_gain (GT68xx_Afe_Values * values, else if (values->black < black_low) { if (values->white < white_low) - *offset -= values->offset_direction; + local_offset -= values->offset_direction; else if (values->white > white_high) - (*pga)--; + local_pga--; else { - *offset -= values->offset_direction; - (*pga)--; + local_offset -= values->offset_direction; + local_pga--; } done = SANE_FALSE; goto finish; } finish: - DBG (5, "%swhite=%d, black=%d, offset=%d, gain=%d, total_white=%d\n", - done ? "DONE: " : "", values->white, values->black, *offset, *pga, values->total_white); + if ((*old_pga == *pga) && (*old_offset = *offset)) + done = SANE_TRUE; + *old_pga = *pga; + *old_offset = *offset; + *pga = local_pga; + *offset = local_offset; + + DBG (5, "%swhite=%d, black=%d, offset=%d, gain=%d, old offs=%d, old pga=%dtotal_white=%d\n", + done ? "DONE: " : "", values->white, values->black, local_offset, local_pga, *old_offset, + *old_pga, values->total_white); return done; } @@ -1165,6 +1176,7 @@ gt68xx_afe_ccd_auto (GT68xx_Scanner * scanner, GT68xx_Afe_Values values; unsigned int *buffer_pointers[3]; GT68xx_AFE_Parameters *afe = scanner->dev->afe; + GT68xx_AFE_Parameters old_afe = {255, 255, 255, 255, 255, 255}; SANE_Bool done; SANE_Int last_white = 0; @@ -1259,7 +1271,7 @@ gt68xx_afe_ccd_auto (GT68xx_Scanner * scanner, gt68xx_afe_ccd_calc (&values, buffer_pointers[0]); - XDBG ((5, "%s: check lamp stable: this white = %d, last white = %d\n", + XDBG ((4, "%s: check lamp stable: this white = %d, last white = %d\n", function_name, values.total_white, last_white)); if (scanner->val[OPT_AUTO_WARMUP].w == SANE_TRUE) @@ -1308,19 +1320,23 @@ gt68xx_afe_ccd_auto (GT68xx_Scanner * scanner, { done = gt68xx_afe_ccd_adjust_offset_gain (&values, buffer_pointers[0], - &afe->r_offset, &afe->r_pga); + &afe->r_offset, &afe->r_pga, + &old_afe.r_offset, &old_afe.r_pga); done &= gt68xx_afe_ccd_adjust_offset_gain (&values, buffer_pointers[1], - &afe->g_offset, &afe->g_pga); + &afe->g_offset, &afe->g_pga, + &old_afe.g_offset, &old_afe.g_pga); done &= gt68xx_afe_ccd_adjust_offset_gain (&values, buffer_pointers[2], - &afe->b_offset, &afe->b_pga); + &afe->b_offset, &afe->b_pga, + &old_afe.b_offset, &old_afe.b_pga); } else { done = gt68xx_afe_ccd_adjust_offset_gain (&values, buffer_pointers[0], - &afe->g_offset, &afe->g_pga); + &afe->g_offset, &afe->g_pga, + &old_afe.g_offset, &old_afe.g_pga); } gt68xx_scanner_stop_scan (scanner); diff --git a/doc/descriptions/gt68xx.desc b/doc/descriptions/gt68xx.desc index 4cc3a039d..b7375ad53 100644 --- a/doc/descriptions/gt68xx.desc +++ b/doc/descriptions/gt68xx.desc @@ -53,6 +53,11 @@ :interface "USB" :comment "Works but has limited testing. Color problems? Reports are welcome." +:model "Colorpage Vivid4x" +:status :untested +:interface "USB" +:comment "Should be detecetd but may not work. Please contact me if you have such a scanner." + ; ----------------------------------------------------------------------------- :mfg "Lexmark" @@ -191,8 +196,8 @@ :model "OpticPro 1248U" :interface "USB" -:status :basic -:comment "Works up to 600 dpi, but calibration is slow" +:status :good +:comment "Works up to 600 dpi." :model "OpticSlim 1200" :interface "USB" diff --git a/doc/gt68xx/gt68xx.CHANGES b/doc/gt68xx/gt68xx.CHANGES index af1180b58..698e8283d 100644 --- a/doc/gt68xx/gt68xx.CHANGES +++ b/doc/gt68xx/gt68xx.CHANGES @@ -1,10 +1,13 @@ gt68xx.CHANGES -*-text-*- -V 1.0-49 (2003-0?-??) +V 1.0-49 (2003-09-30) -* Added Settings for Plustek OpticSlim 1200 * Fixed wrong test for allocation in gt68xx.c. * Added ScanMagic 1200 UB Plus to man page and .desc. +* Added Settings for Plustek OpticSlim 1200 +* Added detection of Genius Vivid 4x. It won't work out-of-the-box, however. +* CCD coarse calib shouldn't run into an endless loop anymore. Plustek 1248U + is much faster now. V 1.0-48 (2003-07-25)