canon_dr backend v38

- initial support for DR-5020
- use ppl_mod instead of Bpl_mod, apply to all modes
- invert logic of read_panel tracking
- add ability to disable read_panel()
- automatically disable read/send_panel if unsupported
merge-requests/1/head
m. allan noah 2011-07-07 10:29:45 -04:00
rodzic c2371afe61
commit 03c6806618
4 zmienionych plików z 80 dodań i 23 usunięć

Wyświetl plik

@ -1,3 +1,12 @@
2011-07-06 m. allan noah <kitno455 at gmail dot com>
* backend/canon_dr.[ch]: backend version 38
- initial support for DR-5020
- use ppl_mod instead of Bpl_mod, apply to all modes
- invert logic of read_panel tracking
- add ability to disable read_panel()
- automatically disable read/send_panel if unsupported
* doc/descriptions/canon_dr.desc: status of DR-5020
2011-07-06 Stéphane Voltz <stef.dev@free.fr>
* backend/genesys_low.h backend/genesys_gl847.c backend/genesys.c
backend/genesys_gl124.c backend/genesys_gl843.c backend/genesys_gl646.c

Wyświetl plik

@ -266,6 +266,12 @@
- don't center window when using flatbed
- improve request sense error messages
- enable flatbed for all known models
v38 2011-07-06, MAN
- initial support for DR-5020
- use ppl_mod instead of Bpl_mod, apply to all modes
- invert logic of read_panel tracking
- add ability to disable read_panel()
- automatically disable read/send_panel if unsupported
SANE FLOW DIAGRAM
@ -314,7 +320,7 @@
#include "canon_dr.h"
#define DEBUG 1
#define BUILD 37
#define BUILD 38
/* values for SANE_DEBUG_CANON_DR env var:
- errors 5
@ -1120,13 +1126,14 @@ init_model (struct scanner *s)
s->has_adf = 1;
s->has_duplex = 1;
s->has_buffer = 1;
s->can_read_panel = 1;
s->can_write_panel = 1;
s->brightness_steps = 255;
s->contrast_steps = 255;
s->threshold_steps = 255;
s->Bpl_mod = 1;
s->ppl_mod = 1;
s->bg_color = 0xee;
/* assume these are same as adf, override below */
@ -1233,7 +1240,17 @@ init_model (struct scanner *s)
s->can_write_panel = 0;
s->has_df = 0;
s->has_btc = 0;
s->Bpl_mod = 32;
s->ppl_mod = 32;
s->reverse_by_mode[MODE_LINEART] = 0;
s->reverse_by_mode[MODE_HALFTONE] = 0;
}
else if (strstr (s->model_name,"DR-5020")){
s->can_read_panel = 0;
s->can_write_panel = 0;
s->has_df = 0;
s->has_btc = 0;
s->ppl_mod = 32;
s->reverse_by_mode[MODE_LINEART] = 0;
s->reverse_by_mode[MODE_HALFTONE] = 0;
}
@ -1253,10 +1270,21 @@ init_panel (struct scanner *s)
DBG (10, "init_panel: start\n");
ret = read_panel(s,OPT_COUNTER);
ret = read_panel(s,0);
if(ret){
DBG (5, "init_panel: disabling read_panel\n");
s->can_read_panel = 0;
ret = SANE_STATUS_GOOD;
}
s->panel_enable_led = 1;
s->panel_counter = 0;
ret = send_panel(s);
if(ret){
DBG (5, "init_panel: disabling send_panel\n");
s->can_write_panel = 0;
ret = SANE_STATUS_GOOD;
}
DBG (10, "init_panel: finish\n");
@ -2072,6 +2100,8 @@ sane_get_option_descriptor (SANE_Handle handle, SANE_Int option)
opt->type = SANE_TYPE_BOOL;
opt->unit = SANE_UNIT_NONE;
opt->cap = SANE_CAP_SOFT_DETECT | SANE_CAP_HARD_SELECT | SANE_CAP_ADVANCED;
if(!s->can_read_panel)
opt->cap = SANE_CAP_INACTIVE;
}
if(option==OPT_STOP){
@ -2081,6 +2111,8 @@ sane_get_option_descriptor (SANE_Handle handle, SANE_Int option)
opt->type = SANE_TYPE_BOOL;
opt->unit = SANE_UNIT_NONE;
opt->cap = SANE_CAP_SOFT_DETECT | SANE_CAP_HARD_SELECT | SANE_CAP_ADVANCED;
if(!s->can_read_panel)
opt->cap = SANE_CAP_INACTIVE;
}
if(option==OPT_BUTT3){
@ -2090,6 +2122,8 @@ sane_get_option_descriptor (SANE_Handle handle, SANE_Int option)
opt->type = SANE_TYPE_BOOL;
opt->unit = SANE_UNIT_NONE;
opt->cap = SANE_CAP_SOFT_DETECT | SANE_CAP_HARD_SELECT | SANE_CAP_ADVANCED;
if(!s->can_read_panel)
opt->cap = SANE_CAP_INACTIVE;
}
if(option==OPT_NEWFILE){
@ -2099,6 +2133,8 @@ sane_get_option_descriptor (SANE_Handle handle, SANE_Int option)
opt->type = SANE_TYPE_BOOL;
opt->unit = SANE_UNIT_NONE;
opt->cap = SANE_CAP_SOFT_DETECT | SANE_CAP_HARD_SELECT | SANE_CAP_ADVANCED;
if(!s->can_read_panel)
opt->cap = SANE_CAP_INACTIVE;
}
if(option==OPT_COUNTONLY){
@ -2108,6 +2144,8 @@ sane_get_option_descriptor (SANE_Handle handle, SANE_Int option)
opt->type = SANE_TYPE_BOOL;
opt->unit = SANE_UNIT_NONE;
opt->cap = SANE_CAP_SOFT_DETECT | SANE_CAP_HARD_SELECT | SANE_CAP_ADVANCED;
if(!s->can_read_panel)
opt->cap = SANE_CAP_INACTIVE;
}
if(option==OPT_BYPASSMODE){
@ -2117,6 +2155,8 @@ sane_get_option_descriptor (SANE_Handle handle, SANE_Int option)
opt->type = SANE_TYPE_BOOL;
opt->unit = SANE_UNIT_NONE;
opt->cap = SANE_CAP_SOFT_DETECT | SANE_CAP_HARD_SELECT | SANE_CAP_ADVANCED;
if(!s->can_read_panel)
opt->cap = SANE_CAP_INACTIVE;
}
if(option==OPT_COUNTER){
@ -2131,7 +2171,7 @@ sane_get_option_descriptor (SANE_Handle handle, SANE_Int option)
s->counter_range.max=500;
s->counter_range.quant=1;
if (s->has_counter)
if (s->can_read_panel && s->has_counter)
opt->cap = SANE_CAP_SOFT_DETECT | SANE_CAP_HARD_SELECT | SANE_CAP_ADVANCED;
else
opt->cap = SANE_CAP_INACTIVE;
@ -2878,10 +2918,16 @@ read_panel(struct scanner *s,SANE_Int option)
unsigned char in[R_PANEL_len];
size_t inLen = R_PANEL_len;
DBG (10, "read_panel: start\n");
DBG (10, "read_panel: start %d\n", option);
/* only run this if frontend has read previous value */
if (s->hw_read[option-OPT_START]) {
if(!s->can_read_panel){
DBG (10, "read_panel: unsupported, finishing\n");
return ret;
}
/* only run this if frontend has read previous value
* or if the caller does not want the data stored */
if (!option || !s->hw_read[option-OPT_START]) {
DBG (15, "read_panel: running\n");
@ -2898,8 +2944,9 @@ read_panel(struct scanner *s,SANE_Int option)
);
if (ret == SANE_STATUS_GOOD || ret == SANE_STATUS_EOF) {
/*blast the read flags*/
memset(s->hw_read,0,sizeof(s->hw_read));
/*set flags indicating there is data to read*/
if(option)
memset(s->hw_read,1,sizeof(s->hw_read));
s->panel_start = get_R_PANEL_start(in);
s->panel_stop = get_R_PANEL_stop(in);
@ -2913,7 +2960,8 @@ read_panel(struct scanner *s,SANE_Int option)
}
}
s->hw_read[option-OPT_START] = 1;
if(option)
s->hw_read[option-OPT_START] = 0;
DBG (10, "read_panel: finish %d\n",s->panel_counter);
@ -3047,9 +3095,6 @@ update_params(struct scanner *s, int calib)
else if (s->u.mode == MODE_GRAYSCALE) {
s->u.format = SANE_FRAME_GRAY;
s->u.bpp = 8;
/* round down to boundary for some scanners */
s->u.width -= s->u.width % s->Bpl_mod;
}
else {
s->u.format = SANE_FRAME_GRAY;
@ -3059,6 +3104,9 @@ update_params(struct scanner *s, int calib)
s->u.width -= s->u.width % 8;
}
/* round down to pixel boundary for some scanners */
s->u.width -= s->u.width % s->ppl_mod;
#ifdef SANE_FRAME_JPEG
/* jpeg requires 8x8 squares */
if(s->compress == COMP_JPEG && s->u.mode >= MODE_GRAYSCALE){
@ -3139,10 +3187,9 @@ update_params(struct scanner *s, int calib)
if(s->s.mode < MODE_GRAYSCALE){
s->s.width -= s->s.width % 8;
}
if(s->s.mode == MODE_GRAYSCALE){
/* round down to boundary for some scanners */
s->s.width -= s->s.width % s->Bpl_mod;
}
/* round down to pixel boundary for some scanners */
s->s.width -= s->s.width % s->ppl_mod;
s->s.valid_width = s->s.width;
s->s.valid_Bpl = s->s.valid_width * s->s.bpp / 8;

Wyświetl plik

@ -153,7 +153,7 @@ struct scanner
int brightness_steps;
int threshold_steps;
int contrast_steps;
int Bpl_mod; /* modulus of scanline byte width */
int ppl_mod; /* modulus of scanline width */
/* the scan size in 1/1200th inches, NOT basic_units or sane units */
int min_x;
@ -177,6 +177,7 @@ struct scanner
int has_buffer;
int has_df;
int has_btc;
int can_read_panel;
int can_write_panel;
int rgb_format; /* meaning unknown */
int padding; /* meaning unknown */

Wyświetl plik

@ -11,9 +11,9 @@
:backend "canon_dr" ; name of backend
:url "http://www.thebility.com/canon/"
:version "37" ; version of backend
:version "38" ; version of backend
:manpage "sane-canon_dr" ; name of manpage (if it exists)
:comment "Backend updated for SANE release 1.0.21, see sane-canon_dr manpage"
:comment "Backend updated for SANE release 1.0.23, see sane-canon_dr manpage"
:devicetype :scanner ; start of a list of devices....
; other types: :stillcam, :vidcam,
; :meta, :api
@ -174,8 +174,8 @@
:model "DR-5020"
:interface "SCSI"
:status :untested
:comment "Please test!"
:status :good
:comment "LineArt, Duplex working, cannot read buttons or screen?"
:model "DR-5060F"
:interface "SCSI"