* backend/hp3900_sane.c: use 1.1.0 well-known option group strings.

* backend/hp3900_config.c, backend/hp3900_debug.c,
  backend/hp3900_rts8822.c, backend/hp3900_types.c,
  backend/hp3900_usb.c: fixed reference position detection for
  HP3800/HPG2710 scanners. Code clean up.
merge-requests/1/head
Jonathan Bravo Lopez 2008-05-22 10:24:31 +00:00
rodzic e154d2eb11
commit 041f5cd20c
6 zmienionych plików z 1727 dodań i 1980 usunięć

Wyświetl plik

@ -1,3 +1,10 @@
2008-05-22 Jonathan Bravo Lopez <jkdsoft@gmail.com>
* backend/hp3900_sane.c: use 1.1.0 well-known option group strings.
* backend/hp3900_config.c, backend/hp3900_debug.c,
backend/hp3900_rts8822.c, backend/hp3900_types.c,
backend/hp3900_usb.c: Fixed reference position detection for
HP3800/HPG2710 scanners. Code clean up.
2008-05-22 Stéphane Voltz <stef.dev@free.fr> 2008-05-22 Stéphane Voltz <stef.dev@free.fr>
* backend/rts8891.c: * backend/rts8891.c:
minor tweak for scanjet 4470cx minor tweak for scanjet 4470cx

Wyświetl plik

@ -202,11 +202,7 @@ enum ConfigFiles
enum fcsec6 enum fcsec6
{ {
SONY_LAMP = 0, TOSHIBA_LAMP, CALIBREFLECTIVE = 0, CALIBTRANSPARENT, CALIBNEGATIVEFILM,
CHECKSTABLE,
CALIBREFLECTIVE, CALIBTRANSPARENT, CALIBNEGATIVEFILM,
SCANINFO, SCANINFO,
SCAN_CALI, SCAN_CALI,
@ -281,8 +277,6 @@ enum fcsec6
DPIGAINCONTROL_TA600, DPIGAINCONTROL_TA600,
DPIGAINCONTROL_NEG600, DPIGAINCONTROL_NEG600,
DPILUMPING100,
CRVS, MLOCK, CRVS, MLOCK,
ENABLEWARMUP, ENABLEWARMUP,
@ -293,7 +287,7 @@ enum fcsec6
STABLEDIFF, STABLEDIFF,
DELTAPWM, DELTAPWM,
PWMLAMPENABLED, PWMLAMPLEVEL, PWMLAMPLEVEL,
TMAPWMDUTY, TMAPWMDUTY,
@ -1068,6 +1062,7 @@ static void cfg_autoref_get(struct st_autoref *reg)
struct st_reg myreg[] = struct st_reg myreg[] =
{ {
/* x and y offsets are based on 2400 dpi */
/* device, { type , x , y , resolution, extern_boundary}*/ /* device, { type , x , y , resolution, extern_boundary}*/
{ BQ5550 , {REF_NONE , -40, -40, 600 , 40}}, { BQ5550 , {REF_NONE , -40, -40, 600 , 40}},
{ UA4900 , {REF_NONE , -40, -40, 600 , 40}}, { UA4900 , {REF_NONE , -40, -40, 600 , 40}},
@ -5371,7 +5366,7 @@ static int srt_hp3800_scanparam_get(int option, int defvalue)
int rst = defvalue; int rst = defvalue;
/* t_rtinifile */ /* t_rtinifile */
int value3[] = {1, 0, 0, 0, 1, 0, 12, 0, 1, 170, 140, 40, 30, 40, 30, 1500, 20, 1, 0, 36, 0}; int value3[] = {1, 0, 0, 0, 1, 12, 0, 1, 170, 140, 40, 30, 40, 30, 1500, 20, 0, 36, 0};
int *value = value3; int *value = value3;
@ -5383,22 +5378,20 @@ static int srt_hp3800_scanparam_get(int option, int defvalue)
case TA_X_START: rst = value[2]; break; case TA_X_START: rst = value[2]; break;
case TA_Y_START: rst = value[3]; break; case TA_Y_START: rst = value[3]; break;
case DPIGAINCONTROL600: rst = value[4]; break; case DPIGAINCONTROL600: rst = value[4]; break;
case DPILUMPING100: rst = value[5]; break; case CRVS: rst = value[5]; break;
case CRVS: rst = value[6]; break; case MLOCK: rst = value[6]; break;
case MLOCK: rst = value[7]; break; case ENABLEWARMUP: rst = value[7]; break;
case ENABLEWARMUP: rst = value[8]; break; case NMAXTARGET: rst = value[8]; break;
case NMAXTARGET: rst = value[9]; break; case NMINTARGET: rst = value[9]; break;
case NMINTARGET: rst = value[10]; break; case NMAXTARGETTA: rst = value[10]; break;
case NMAXTARGETTA: rst = value[11]; break; case NMINTARGETTA: rst = value[11]; break;
case NMINTARGETTA: rst = value[12]; break; case NMAXTARGETNEG: rst = value[12]; break;
case NMAXTARGETNEG: rst = value[13]; break; case NMINTARGETNEG: rst = value[13]; break;
case NMINTARGETNEG: rst = value[14]; break; case STABLEDIFF: rst = value[14]; break;
case STABLEDIFF: rst = value[15]; break; case DELTAPWM: rst = value[15]; break;
case DELTAPWM: rst = value[16]; break; case PWMLAMPLEVEL: rst = value[16]; break;
case PWMLAMPENABLED: rst = value[17]; break; case TMAPWMDUTY: rst = value[17]; break;
case PWMLAMPLEVEL: rst = value[18]; break; case LEFTLEADING: rst = value[18]; break;
case TMAPWMDUTY: rst = value[19]; break;
case LEFTLEADING: rst = value[20]; break;
} }
return rst; return rst;
@ -5408,13 +5401,13 @@ static int srt_hp3970_scanparam_get(int file, int option, int defvalue)
{ {
int rst = defvalue; int rst = defvalue;
/* s_rtinifile */ /* s_rtinifile */
int value1[] = {1, 0, 150, 0, 1, 0, 6, 0, 0, 170, 140, 40, 30, 40, 30, 1500, 20, 1, 0, 36, 360}; int value1[] = {1, 0, 150, 0, 1, 6, 0, 0, 170, 140, 40, 30, 40, 30, 1500, 20, 0, 36, 360};
/* s_usb1inifile */ /* s_usb1inifile */
int value2[] = {1, 0, 150, 0, 1, 0, 6, 0, 0, 170, 140, 40, 30, 40, 30, 1500, 20, 1, 0, 36, 360}; int value2[] = {1, 0, 150, 0, 1, 6, 0, 0, 170, 140, 40, 30, 40, 30, 1500, 20, 0, 36, 360};
/* t_rtinifile */ /* t_rtinifile */
int value3[] = {1, 0, 150, 0, 1, 0, 12, 0, 0, 170, 140, 40, 30, 40, 30, 1500, 20, 1, 0, 36, 0}; int value3[] = {1, 0, 150, 0, 1, 12, 0, 0, 170, 140, 40, 30, 40, 30, 1500, 20, 0, 36, 0};
/* t_usb1inifile */ /* t_usb1inifile */
int value4[] = {1, 0, 150, 0, 1, 0, 12, 0, 0, 170, 140, 40, 30, 40, 30, 1500, 20, 1, 0, 36, 0}; int value4[] = {1, 0, 150, 0, 1, 12, 0, 0, 170, 140, 40, 30, 40, 30, 1500, 20, 0, 36, 0};
int *value = NULL; int *value = NULL;
@ -5434,22 +5427,20 @@ static int srt_hp3970_scanparam_get(int file, int option, int defvalue)
case TA_X_START: rst = value[2]; break; case TA_X_START: rst = value[2]; break;
case TA_Y_START: rst = value[3]; break; case TA_Y_START: rst = value[3]; break;
case DPIGAINCONTROL600: rst = value[4]; break; case DPIGAINCONTROL600: rst = value[4]; break;
case DPILUMPING100: rst = value[5]; break; case CRVS: rst = value[5]; break;
case CRVS: rst = value[6]; break; case MLOCK: rst = value[6]; break;
case MLOCK: rst = value[7]; break; case ENABLEWARMUP: rst = value[7]; break;
case ENABLEWARMUP: rst = value[8]; break; case NMAXTARGET: rst = value[8]; break;
case NMAXTARGET: rst = value[9]; break; case NMINTARGET: rst = value[9]; break;
case NMINTARGET: rst = value[10]; break; case NMAXTARGETTA: rst = value[10]; break;
case NMAXTARGETTA: rst = value[11]; break; case NMINTARGETTA: rst = value[11]; break;
case NMINTARGETTA: rst = value[12]; break; case NMAXTARGETNEG: rst = value[12]; break;
case NMAXTARGETNEG: rst = value[13]; break; case NMINTARGETNEG: rst = value[13]; break;
case NMINTARGETNEG: rst = value[14]; break; case STABLEDIFF: rst = value[14]; break;
case STABLEDIFF: rst = value[15]; break; case DELTAPWM: rst = value[15]; break;
case DELTAPWM: rst = value[16]; break; case PWMLAMPLEVEL: rst = value[16]; break;
case PWMLAMPENABLED: rst = value[17]; break; case TMAPWMDUTY: rst = value[17]; break;
case PWMLAMPLEVEL: rst = value[18]; break; case LEFTLEADING: rst = value[18]; break;
case TMAPWMDUTY: rst = value[19]; break;
case LEFTLEADING: rst = value[20]; break;
} }
return rst; return rst;
@ -5458,13 +5449,13 @@ static int srt_hp3970_scanparam_get(int file, int option, int defvalue)
static int srt_hp4370_scanparam_get(int file, int option, int defvalue) static int srt_hp4370_scanparam_get(int file, int option, int defvalue)
{ {
/* s_rtinifile */ /* s_rtinifile */
int value1[] = {1, 0, 150, 0, 1, 0, 6, 0, 0, 170, 140, 40, 30, 40, 30, 1500, 20, 1, 0, 36, 360}; int value1[] = {1, 0, 150, 0, 1, 6, 0, 0, 170, 140, 40, 30, 40, 30, 1500, 20, 0, 36, 360};
/* s_usb1inifile */ /* s_usb1inifile */
int value2[] = {1, 0, 150, 0, 1, 0, 6, 0, 0, 170, 140, 40, 30, 40, 30, 1500, 20, 1, 0, 36, 360}; int value2[] = {1, 0, 150, 0, 1, 6, 0, 0, 170, 140, 40, 30, 40, 30, 1500, 20, 0, 36, 360};
/* t_rtinifile */ /* t_rtinifile */
int value3[] = {1, 0, 150, 0, 1, 0, 12, 0, 0, 170, 140, 40, 30, 40, 30, 1500, 20, 1, 0, 36, 0}; int value3[] = {1, 0, 150, 0, 1, 12, 0, 0, 170, 140, 40, 30, 40, 30, 1500, 20, 0, 36, 0};
/* t_usb1inifile */ /* t_usb1inifile */
int value4[] = {1, 0, 150, 0, 1, 0, 12, 0, 0, 170, 140, 40, 30, 40, 30, 1500, 20, 1, 0, 36, 0}; int value4[] = {1, 0, 150, 0, 1, 12, 0, 0, 170, 140, 40, 30, 40, 30, 1500, 20, 0, 36, 0};
int *value = NULL; int *value = NULL;
int rst = defvalue; int rst = defvalue;
@ -5485,22 +5476,20 @@ static int srt_hp4370_scanparam_get(int file, int option, int defvalue)
case TA_X_START: rst = value[2]; break; case TA_X_START: rst = value[2]; break;
case TA_Y_START: rst = value[3]; break; case TA_Y_START: rst = value[3]; break;
case DPIGAINCONTROL600: rst = value[4]; break; case DPIGAINCONTROL600: rst = value[4]; break;
case DPILUMPING100: rst = value[5]; break; case CRVS: rst = value[5]; break;
case CRVS: rst = value[6]; break; case MLOCK: rst = value[6]; break;
case MLOCK: rst = value[7]; break; case ENABLEWARMUP: rst = value[7]; break;
case ENABLEWARMUP: rst = value[8]; break; case NMAXTARGET: rst = value[8]; break;
case NMAXTARGET: rst = value[9]; break; case NMINTARGET: rst = value[9]; break;
case NMINTARGET: rst = value[10]; break; case NMAXTARGETTA: rst = value[10]; break;
case NMAXTARGETTA: rst = value[11]; break; case NMINTARGETTA: rst = value[11]; break;
case NMINTARGETTA: rst = value[12]; break; case NMAXTARGETNEG: rst = value[12]; break;
case NMAXTARGETNEG: rst = value[13]; break; case NMINTARGETNEG: rst = value[13]; break;
case NMINTARGETNEG: rst = value[14]; break; case STABLEDIFF: rst = value[14]; break;
case STABLEDIFF: rst = value[15]; break; case DELTAPWM: rst = value[15]; break;
case DELTAPWM: rst = value[16]; break; case PWMLAMPLEVEL: rst = value[16]; break;
case PWMLAMPENABLED: rst = value[17]; break; case TMAPWMDUTY: rst = value[17]; break;
case PWMLAMPLEVEL: rst = value[18]; break; case LEFTLEADING: rst = value[18]; break;
case TMAPWMDUTY: rst = value[19]; break;
case LEFTLEADING: rst = value[20]; break;
} }
return rst; return rst;

Wyświetl plik

@ -55,14 +55,14 @@
/* headers */ /* headers */
static void dump_shading (struct st_calibration *myCalib); static void dump_shading (struct st_calibration *myCalib);
static char *dbg_scantype (char *text, SANE_Int type); static char *dbg_scantype (SANE_Int type);
static void dbg_scanmodes (struct st_device *dev); static void dbg_scanmodes (struct st_device *dev);
static void dbg_motorcurves (struct st_device *dev); static void dbg_motorcurves (struct st_device *dev);
static void dbg_motormoves (struct st_device *dev); static void dbg_motormoves (struct st_device *dev);
static void dbg_hwdcfg (struct st_hwdconfig *params); static void dbg_hwdcfg (struct st_hwdconfig *params);
static void dbg_ScanParams (struct st_scanparams *params); static void dbg_ScanParams (struct st_scanparams *params);
static void dbg_calibtable (struct st_gain_offset *params); static void dbg_calibtable (struct st_gain_offset *params);
static char *dbg_colour (char *text, SANE_Int colour); static char *dbg_colour (SANE_Int colour);
static void dbg_motorcfg (struct st_motorcfg *motorcfg); static void dbg_motorcfg (struct st_motorcfg *motorcfg);
static void dbg_buttons (struct st_buttons *buttons); static void dbg_buttons (struct st_buttons *buttons);
static void dbg_sensor (struct st_sensorcfg *sensor); static void dbg_sensor (struct st_sensorcfg *sensor);
@ -129,26 +129,23 @@ dump_shading (struct st_calibration *myCalib)
} }
static char * static char *
dbg_scantype (char *text, SANE_Int type) dbg_scantype (SANE_Int type)
{ {
if (text != NULL)
switch (type) switch (type)
{ {
case ST_NORMAL: case ST_NORMAL:
strcpy (text, "ST_NORMAL"); return "ST_NORMAL";
break; break;
case ST_TA: case ST_TA:
strcpy (text, "ST_TA"); return "ST_TA";
break; break;
case ST_NEG: case ST_NEG:
strcpy (text, "ST_NEG"); return "ST_NEG";
break; break;
default: default:
snprintf (text, 10, "%i", type); return "Unknown";
break; break;
} }
return text;
} }
static void static void
@ -239,7 +236,6 @@ dbg_scanmodes (struct st_device *dev)
{ {
SANE_Int a; SANE_Int a;
struct st_scanmode *reg; struct st_scanmode *reg;
char sdebug[20], scm[20];
DBG (DBG_FNC, DBG (DBG_FNC,
" -> ##, ST , CM , RES , TM, CV, SR, CLK, CTPC , BKS , STT, DML, { Exposure times }, { Max exposure times }, MP , MExp16, MExpF, MExp, MRI, MSI, MMTIR, MMTIRH, SK\n"); " -> ##, ST , CM , RES , TM, CV, SR, CLK, CTPC , BKS , STT, DML, { Exposure times }, { Max exposure times }, MP , MExp16, MExpF, MExp, MRI, MSI, MMTIR, MMTIRH, SK\n");
@ -252,15 +248,13 @@ dbg_scanmodes (struct st_device *dev)
{ {
DBG (DBG_FNC, DBG (DBG_FNC,
" -> %2i, %9s, %10s, %4i, %2i, %2i, %2i, %3i, %6i, %4i, %3i, %3i, {%6i, %6i, %6i}, {%6i, %6i, %6i}, %3i, %6i, %5i, %4i, %3i, %3i, %5i, %6i, %2i\n", " -> %2i, %9s, %10s, %4i, %2i, %2i, %2i, %3i, %6i, %4i, %3i, %3i, {%6i, %6i, %6i}, {%6i, %6i, %6i}, %3i, %6i, %5i, %4i, %3i, %3i, %5i, %6i, %2i\n",
a, dbg_scantype (sdebug, reg->scantype), dbg_colour (scm, a, dbg_scantype (reg->scantype),
reg-> dbg_colour (reg->colormode), reg->resolution, reg->timing,
colormode), reg->motorcurve, reg->samplerate, reg->systemclock,
reg->resolution, reg->timing, reg->motorcurve, reg->ctpc, reg->motorbackstep, reg->scanmotorsteptype,
reg->samplerate, reg->systemclock, reg->ctpc, reg->dummyline, reg->expt[0], reg->expt[1], reg->expt[2],
reg->motorbackstep, reg->scanmotorsteptype, reg->dummyline, reg->mexpt[0], reg->mexpt[1], reg->mexpt[2],
reg->expt[0], reg->expt[1], reg->expt[2], reg->mexpt[0], reg->motorplus, reg->multiexposurefor16bitmode,
reg->mexpt[1], reg->mexpt[2], reg->motorplus,
reg->multiexposurefor16bitmode,
reg->multiexposureforfullspeed, reg->multiexposure, reg->multiexposureforfullspeed, reg->multiexposure,
reg->mri, reg->msi, reg->mmtir, reg->mmtirh, reg->mri, reg->msi, reg->mmtir, reg->mmtirh,
reg->skiplinecount); reg->skiplinecount);
@ -421,8 +415,6 @@ dbg_hwdcfg (struct st_hwdconfig *params)
{ {
if (params != NULL) if (params != NULL)
{ {
char sdebug[20];
DBG (DBG_FNC, " -> Low level config:\n"); DBG (DBG_FNC, " -> Low level config:\n");
DBG (DBG_FNC, " -> startpos = %i\n", params->startpos); DBG (DBG_FNC, " -> startpos = %i\n", params->startpos);
DBG (DBG_FNC, " -> arrangeline = %s\n", DBG (DBG_FNC, " -> arrangeline = %s\n",
@ -431,7 +423,7 @@ dbg_hwdcfg (struct st_hwdconfig *params)
FIX_BY_HARD) ? "FIX_BY_HARD" : FIX_BY_HARD) ? "FIX_BY_HARD" :
"FIX_BY_NONE"); "FIX_BY_NONE");
DBG (DBG_FNC, " -> scantype = %s\n", DBG (DBG_FNC, " -> scantype = %s\n",
dbg_scantype (sdebug, params->scantype)); dbg_scantype (params->scantype));
DBG (DBG_FNC, " -> compression = %i\n", params->compression); DBG (DBG_FNC, " -> compression = %i\n", params->compression);
DBG (DBG_FNC, " -> use_gamma_tables = %i\n", DBG (DBG_FNC, " -> use_gamma_tables = %i\n",
params->use_gamma_tables); params->use_gamma_tables);
@ -460,11 +452,9 @@ dbg_ScanParams (struct st_scanparams *params)
{ {
if (params != NULL) if (params != NULL)
{ {
char scm[20], ssc[20];
DBG (DBG_FNC, " -> Scan params:\n"); DBG (DBG_FNC, " -> Scan params:\n");
DBG (DBG_FNC, " -> colormode = %s\n", DBG (DBG_FNC, " -> colormode = %s\n",
dbg_colour (scm, params->colormode)); dbg_colour (params->colormode));
DBG (DBG_FNC, " -> depth = %i\n", params->depth); DBG (DBG_FNC, " -> depth = %i\n", params->depth);
DBG (DBG_FNC, " -> samplerate = %i\n", params->samplerate); DBG (DBG_FNC, " -> samplerate = %i\n", params->samplerate);
DBG (DBG_FNC, " -> timing = %i\n", params->timing); DBG (DBG_FNC, " -> timing = %i\n", params->timing);
@ -485,7 +475,7 @@ dbg_ScanParams (struct st_scanparams *params)
DBG (DBG_FNC, " *> ser = %i\n", params->ser); DBG (DBG_FNC, " *> ser = %i\n", params->ser);
DBG (DBG_FNC, " *> ler = %i\n", params->ler); DBG (DBG_FNC, " *> ler = %i\n", params->ler);
DBG (DBG_FNC, " *> scantype = %s\n", DBG (DBG_FNC, " *> scantype = %s\n",
dbg_scantype (ssc, params->scantype)); dbg_scantype (params->scantype));
} }
} }
@ -495,6 +485,8 @@ dbg_calibtable (struct st_gain_offset *params)
if (params != NULL) if (params != NULL)
{ {
DBG (DBG_FNC, " -> Calib table:\n"); DBG (DBG_FNC, " -> Calib table:\n");
DBG (DBG_FNC, " -> type R G B\n");
DBG (DBG_FNC, " -> ----- --- --- ---B\n");
DBG (DBG_FNC, " -> edcg1 = %3i , %3i , %3i\n", params->edcg1[0], DBG (DBG_FNC, " -> edcg1 = %3i , %3i , %3i\n", params->edcg1[0],
params->edcg1[1], params->edcg1[2]); params->edcg1[1], params->edcg1[2]);
DBG (DBG_FNC, " -> edcg2 = %3i , %3i , %3i\n", params->edcg2[0], DBG (DBG_FNC, " -> edcg2 = %3i , %3i , %3i\n", params->edcg2[0],
@ -513,26 +505,23 @@ dbg_calibtable (struct st_gain_offset *params)
} }
static char * static char *
dbg_colour (char *text, SANE_Int colour) dbg_colour (SANE_Int colour)
{ {
if (text != NULL)
switch (colour) switch (colour)
{ {
case CM_COLOR: case CM_COLOR:
strcpy (text, "CM_COLOR"); return "CM_COLOR";
break; break;
case CM_GRAY: case CM_GRAY:
strcpy (text, "CM_GRAY"); return "CM_GRAY";
break; break;
case CM_LINEART: case CM_LINEART:
strcpy (text, "CM_LINEART"); return "CM_LINEART";
break; break;
default: default:
snprintf (text, 20, "%i", colour); return "Unknown";
break; break;
} }
return text;
} }
static void static void

Plik diff jest za duży Load Diff

Wyświetl plik

@ -102,7 +102,7 @@ typedef enum
opt_infoupdate, opt_infoupdate,
/* supported buttons. RTS8822 supports up to 6 buttons */ /* supported buttons. RTS8822 supports up to 6 buttons */
grp_buttons, grp_sensors,
opt_button_0, opt_button_0,
opt_button_1, opt_button_1,
opt_button_2, opt_button_2,
@ -167,7 +167,6 @@ typedef struct
SANE_Int scan_count; SANE_Int scan_count;
SANE_Int fScanning; /* TRUE if actively scanning */ SANE_Int fScanning; /* TRUE if actively scanning */
SANE_Int fCanceled;
} TScanner; } TScanner;
/* functions to manage backend's options */ /* functions to manage backend's options */
@ -1230,9 +1229,9 @@ options_init (TScanner * scanner)
break; break;
case grp_geometry: case grp_geometry:
pDesc->name = "grp_geometry"; pDesc->name = SANE_NAME_GEOMETRY;
pDesc->title = SANE_I18N ("Geometry"); pDesc->title = SANE_TITLE_GEOMETRY;
pDesc->desc = ""; pDesc->desc = SANE_DESC_GEOMETRY;
pDesc->type = SANE_TYPE_GROUP; pDesc->type = SANE_TYPE_GROUP;
pDesc->unit = SANE_UNIT_NONE; pDesc->unit = SANE_UNIT_NONE;
pDesc->size = 0; pDesc->size = 0;
@ -1559,7 +1558,7 @@ options_init (TScanner * scanner)
pDesc->type = SANE_TYPE_STRING; pDesc->type = SANE_TYPE_STRING;
pDesc->constraint_type = SANE_CONSTRAINT_NONE; pDesc->constraint_type = SANE_CONSTRAINT_NONE;
pDesc->cap = pDesc->cap =
SANE_CAP_ADVANCED | SANE_CAP_HARD_SELECT | SANE_CAP_ADVANCED | SANE_CAP_SOFT_SELECT |
SANE_CAP_SOFT_DETECT; SANE_CAP_SOFT_DETECT;
pVal->s = strdup (SANE_I18N ("Unknown")); pVal->s = strdup (SANE_I18N ("Unknown"));
break; break;
@ -1572,7 +1571,7 @@ options_init (TScanner * scanner)
pDesc->unit = SANE_UNIT_NONE; pDesc->unit = SANE_UNIT_NONE;
pDesc->constraint_type = SANE_CONSTRAINT_NONE; pDesc->constraint_type = SANE_CONSTRAINT_NONE;
pDesc->cap = pDesc->cap =
SANE_CAP_ADVANCED | SANE_CAP_HARD_SELECT | SANE_CAP_ADVANCED | SANE_CAP_SOFT_SELECT |
SANE_CAP_SOFT_DETECT; SANE_CAP_SOFT_DETECT;
pVal->w = -1; pVal->w = -1;
break; break;
@ -1586,7 +1585,7 @@ options_init (TScanner * scanner)
pDesc->unit = SANE_UNIT_NONE; pDesc->unit = SANE_UNIT_NONE;
pDesc->constraint_type = SANE_CONSTRAINT_NONE; pDesc->constraint_type = SANE_CONSTRAINT_NONE;
pDesc->cap = pDesc->cap =
SANE_CAP_ADVANCED | SANE_CAP_HARD_SELECT | SANE_CAP_ADVANCED | SANE_CAP_SOFT_SELECT |
SANE_CAP_SOFT_DETECT; SANE_CAP_SOFT_DETECT;
pVal->w = -1; pVal->w = -1;
break; break;
@ -1605,10 +1604,10 @@ options_init (TScanner * scanner)
break; break;
/* buttons support */ /* buttons support */
case grp_buttons: case grp_sensors:
pDesc->name = "grp_buttons"; pDesc->name = SANE_NAME_SENSORS;
pDesc->title = SANE_I18N ("Buttons"); pDesc->title = SANE_TITLE_SENSORS;
pDesc->desc = ""; pDesc->desc = SANE_DESC_SENSORS;
pDesc->type = SANE_TYPE_GROUP; pDesc->type = SANE_TYPE_GROUP;
pDesc->unit = SANE_UNIT_NONE; pDesc->unit = SANE_UNIT_NONE;
pDesc->size = 0; pDesc->size = 0;
@ -2176,6 +2175,14 @@ option_set (TScanner * scanner, SANE_Int optid, void *value, SANE_Int * pInfo)
if (bknd_info (scanner) == SANE_STATUS_GOOD) if (bknd_info (scanner) == SANE_STATUS_GOOD)
info |= SANE_INFO_RELOAD_OPTIONS; info |= SANE_INFO_RELOAD_OPTIONS;
break; break;
case opt_chipname:
case opt_chipid:
case opt_scancount:
bknd_info (scanner);
info |= SANE_INFO_RELOAD_OPTIONS;
break;
default: default:
rst = SANE_STATUS_INVAL; rst = SANE_STATUS_INVAL;
break; break;
@ -2341,10 +2348,7 @@ sane_start (SANE_Handle h)
s->cnv.colormode = -1; s->cnv.colormode = -1;
/* setting channel for colormodes different than CM_COLOR */ /* setting channel for colormodes different than CM_COLOR */
if (colormode != CM_COLOR) channel = (colormode != CM_COLOR) ? 1 : 0;
channel = 1;
else
channel = 0;
/* negative colors */ /* negative colors */
s->cnv.negative = s->cnv.negative =
@ -2445,7 +2449,7 @@ sane_read (SANE_Handle h, SANE_Byte * buf, SANE_Int maxlen, SANE_Int * len)
SANE_Status rst = SANE_STATUS_GOOD; SANE_Status rst = SANE_STATUS_GOOD;
TScanner *s = (TScanner *) h; TScanner *s = (TScanner *) h;
DBG (DBG_FNC, "> sane_read\n"); DBG (DBG_FNC, "+ sane_read\n");
if ((s != NULL) && (buf != NULL) && (len != NULL)) if ((s != NULL) && (buf != NULL) && (len != NULL))
{ {
@ -2454,13 +2458,14 @@ sane_read (SANE_Handle h, SANE_Byte * buf, SANE_Int maxlen, SANE_Int * len)
/* if we read all the lines return EOF */ /* if we read all the lines return EOF */
if ((s->mylin == s->ScanParams.coords.height) if ((s->mylin == s->ScanParams.coords.height)
|| (device->Reading->Cancel == TRUE)) || (device->status->cancel == TRUE))
{ {
rst =
(device->status->cancel ==
TRUE) ? SANE_STATUS_CANCELLED : SANE_STATUS_EOF;
RTS_Scanner_StopScan (device, FALSE); RTS_Scanner_StopScan (device, FALSE);
img_buffers_free (s); img_buffers_free (s);
DBG (DBG_FNC, "> sane_read: All lines read\n");
rst = SANE_STATUS_EOF;
} }
else else
{ {
@ -2537,8 +2542,6 @@ sane_read (SANE_Handle h, SANE_Byte * buf, SANE_Int maxlen, SANE_Int * len)
&transferred) != OK) &transferred) != OK)
{ {
/* error, exit function */ /* error, exit function */
DBG (DBG_FNC,
"> sane_read: Read_Image returned ERROR\n");
rst = SANE_STATUS_EOF; rst = SANE_STATUS_EOF;
break; break;
} }
@ -2640,6 +2643,8 @@ sane_read (SANE_Handle h, SANE_Byte * buf, SANE_Int maxlen, SANE_Int * len)
else else
rst = SANE_STATUS_EOF; rst = SANE_STATUS_EOF;
DBG (DBG_FNC, "- sane_read: %s\n", sane_strstatus (rst));
return rst; return rst;
} }
@ -2651,7 +2656,7 @@ sane_cancel (SANE_Handle h)
/* silence gcc */ /* silence gcc */
h = h; h = h;
device->Reading->Cancel = TRUE; device->status->cancel = TRUE;
} }
SANE_Status SANE_Status

Wyświetl plik

@ -639,6 +639,13 @@ struct st_buttons
SANE_Int mask[6]; /* up to 6 buttons */ SANE_Int mask[6]; /* up to 6 buttons */
}; };
struct st_status
{
SANE_Byte warmup;
SANE_Byte parkhome;
SANE_Byte cancel;
};
struct st_device struct st_device
{ {
/* next var handles usb device, used for every usb operations */ /* next var handles usb device, used for every usb operations */
@ -686,6 +693,9 @@ struct st_device
/* next structure will be used to arrange color channels while scanning */ /* next structure will be used to arrange color channels while scanning */
struct st_scanning *scanning; struct st_scanning *scanning;
/* next structure will contain some status which can be requested */
struct st_status *status;
}; };
/* Unknown vars */ /* Unknown vars */
@ -710,10 +720,8 @@ SANE_Byte gain[3];
static SANE_Int usbfile = -1; static SANE_Int usbfile = -1;
SANE_Int scantype; SANE_Int scantype;
SANE_Byte pwmlampenabled;
SANE_Byte pwmlamplevel; SANE_Byte pwmlamplevel;
SANE_Byte dpi100Lumping;
SANE_Byte arrangeline; SANE_Byte arrangeline;
SANE_Byte binarythresholdh; SANE_Byte binarythresholdh;
SANE_Byte binarythresholdl; SANE_Byte binarythresholdl;