Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- diff --git "a/diff/old/plustek-usb.c" "b/diff/new/plustek-usb.c"
- index 6c9e67a..133837f 100644
- --- "a/diff/old/plustek-usb.c"
- +++ "b/diff/new/plustek-usb.c"
- @@ -1366,6 +1366,12 @@ usbDev_Prepare( Plustek_Device *dev, SANE_Byte *buf )
- scan->sParam.UserDpi.y, scan->sParam.PhyDpi.y, scan->wSumY );
- }
- }
- +
- + /* Switch lamp off for dark scan ? */
- + if (dev->adj.dark_scan != 0) {
- + DBG( _DBG_INFO, "Dark-Scan: switching lamps off..\n" );
- + usb_LampOn( dev, SANE_FALSE, SANE_TRUE );
- + }
- }
- dumpPicInit( &scan->sParam, "plustek-pic.raw" );
- diff --git "a/diff/old/plustek.c" "b/diff/new/plustek.c"
- index a8debeb..a270ed4 100644
- --- "a/diff/old/plustek.c"
- +++ "b/diff/new/plustek.c"
- @@ -248,6 +248,7 @@ static const SANE_Range warmup_range = { -1, 999, 1 };
- static const SANE_Range offtimer_range = { 0, 999, 1 };
- static const SANE_Range gain_range = { -1, 63, 1 };
- static const SANE_Range loff_range = { -1, 16363, 1 };
- +static const SANE_Range darkscan_range = { 0, 1, 1 };
- /* authorization stuff */
- static SANE_Auth_Callback auth = NULL;
- @@ -303,6 +304,7 @@ static void show_cnf( CnfDef *cnf )
- DBG( _DBG_SANE_INIT,"green Gamma : %.2f\n",cnf->adj.ggamma );
- DBG( _DBG_SANE_INIT,"blue Gamma : %.2f\n",cnf->adj.bgamma );
- DBG( _DBG_SANE_INIT,"gray Gamma : %.2f\n",cnf->adj.graygamma );
- + DBG( _DBG_SANE_INIT,"dark scan : %d\n", cnf->adj.dark_scan );
- DBG( _DBG_SANE_INIT,"---------------------\n" );
- }
- @@ -1109,6 +1111,16 @@ init_options( Plustek_Scanner *s )
- }
- usb_UpdateButtonStatus( s );
- +
- + /* scan dark image without lamps ? */
- + s->opt[OPT_DARK_SCAN].name = "dark-scan";
- + s->opt[OPT_DARK_SCAN].title = SANE_I18N("Dark Scan");;
- + s->opt[OPT_DARK_SCAN].desc = SANE_I18N("Perform a dark scan (1) or with the lamps on (0)");
- + s->opt[OPT_DARK_SCAN].type = SANE_TYPE_INT;
- + s->opt[OPT_DARK_SCAN].constraint_type = SANE_CONSTRAINT_RANGE;
- + s->opt[OPT_DARK_SCAN].constraint.range = &darkscan_range;
- + s->val[OPT_DARK_SCAN].w = adj->dark_scan;
- +
- return SANE_STATUS_GOOD;
- }
- @@ -1427,6 +1439,8 @@ init_config_struct( CnfDef *cnf )
- cnf->adj.rgamma = 1.0;
- cnf->adj.ggamma = 1.0;
- cnf->adj.bgamma = 1.0;
- +
- + cnf->adj.dark_scan = 0;
- }
- /** intialize the backend
- @@ -1546,6 +1560,8 @@ sane_init( SANE_Int *version_code, SANE_Auth_Callback authorize )
- decodeVal( str, "redGamma", _FLOAT, &config.adj.rgamma, &dval );
- decodeVal( str, "greenGamma", _FLOAT, &config.adj.ggamma, &dval );
- decodeVal( str, "blueGamma", _FLOAT, &config.adj.bgamma, &dval );
- +
- + decodeVal( str, "dark_scan", _INT, &config.adj.dark_scan, &ival);
- continue;
- /* check for sections: */
- @@ -1958,6 +1974,13 @@ sane_control_option( SANE_Handle handle, SANE_Int option,
- DBG( _DBG_INFO, "Reading BLUE gamma.\n" );
- memcpy( value, s->val[option].wa, s->opt[option].size );
- break;
- +
- + /* dark scan */
- + case OPT_DARK_SCAN:
- + DBG( _DBG_INFO, "Reading drak_scan.\n" );
- + *(SANE_Word *)value = s->val[OPT_DARK_SCAN].w;
- + break;
- +
- default:
- return SANE_STATUS_INVAL;
- }
- @@ -2017,6 +2040,12 @@ sane_control_option( SANE_Handle handle, SANE_Int option,
- if( NULL != info )
- *info |= SANE_INFO_RELOAD_PARAMS;
- break;
- + case OPT_DARK_SCAN:
- + DBG( _DBG_INFO, "Setting dark_scan to 0x%02x.\n", *(SANE_Word *)value);
- + s->val[option].w = *(SANE_Word *)value;
- + if( NULL != info )
- + *info |= SANE_INFO_RELOAD_PARAMS;
- + break;
- case OPT_CACHECAL:
- s->val[option].w = *(SANE_Word *)value;
- @@ -2527,6 +2556,9 @@ local_sane_start(Plustek_Scanner *s, int scanmode )
- tsecs = 0; /* reset timer */
- + DBG( _DBG_INFO, "--- dark_scan is set to 0x%02x, transfer to dev...\n", s->val[OPT_DARK_SCAN].w);
- + dev->adj.dark_scan = s->val[OPT_DARK_SCAN].w;
- +
- result = usbDev_startScan( dev );
- if( result < 0 ) {
- DBG( _DBG_ERROR, "usbDev_startScan() failed(%d)\n", result );
- @@ -2581,6 +2613,7 @@ sane_start( SANE_Handle handle )
- int fds[2];
- DBG( _DBG_SANE_INIT, "sane_start\n" );
- + DBG( _DBG_INFO, "--- dark_scan is set to 0x%02x.\n", s->val[OPT_DARK_SCAN].w);
- if (s->scanning)
- return SANE_STATUS_DEVICE_BUSY;
- diff --git "a/diff/old/plustek.conf.in" "b/diff/new/plustek.conf.in"
- index e16823e..8ba4fce 100644
- --- "a/diff/old/plustek.conf.in"
- +++ "b/diff/new/plustek.conf.in"
- @@ -173,6 +173,11 @@ option enableTPA 0
- option mov 0
- #
- +# switch lamps off when scanning. Suitable for scanning B/W negatives or when using as scanner camera
- +#
- +option dark_scan 0
- +
- +#
- # and of course the device-name
- #
- # device /dev/usbscanner
- diff --git "a/diff/old/plustek.h" "b/diff/new/plustek.h"
- index be657c1..0244916 100644
- --- "a/diff/old/plustek.h"
- +++ "b/diff/new/plustek.h"
- @@ -247,6 +247,7 @@ enum {
- OPT_BUTTON_3,
- OPT_BUTTON_4,
- OPT_BUTTON_LAST = OPT_BUTTON_4,
- + OPT_DARK_SCAN,
- NUM_OPTIONS
- };
- @@ -303,6 +304,9 @@ typedef struct {
- double graygamma;
- + /* scan without lamps */
- + int dark_scan;
- +
- } AdjDef;
- typedef struct {
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement