canon_dr v28, improve DR-2xxx support by emulating missing hw features

- use average instead of min/max for fine offset and gain
- rewrite supported resolution list as x and y arrays
- merge x and y resolution options into single option
- move scan params into two new structs, s->u and s->s
- sane_get_parameters() just returns values from s->u
- dont call wait_scanner() in object_position()
- dont call ssm_*() from option handler
- refactor sane_start()
- read_from_buffer() can workaround missing res, modes and cropping
- set most DR-2xxx machines to use the read_from_buffer workarounds
- set default threshold to 90
- add option for button #3 of some machines
- don't eject paper during init
- add DR-2010 quirks
- switch counter to HARD_SELECT, not SOFT
merge-requests/1/head
m. allan noah 2009-05-20 13:10:25 -04:00
rodzic dda029430e
commit 327250b7dc
6 zmienionych plików z 1112 dodań i 841 usunięć

Wyświetl plik

@ -223,6 +223,7 @@ putnbyte (unsigned char *pnt, unsigned int value, unsigned int nbytes)
#define R_PANEL_len 0x08
#define get_R_PANEL_start(in) getbitfield(in, 1, 7)
#define get_R_PANEL_stop(in) getbitfield(in, 1, 6)
#define get_R_PANEL_butt3(in) getbitfield(in, 1, 2)
#define get_R_PANEL_new_file(in) getbitfield(in+1, 1, 0)
#define get_R_PANEL_count_only(in) getbitfield(in+1, 1, 1)
#define get_R_PANEL_bypass_mode(in) getbitfield(in+1, 1, 2)

Plik diff jest za duży Load Diff

Wyświetl plik

@ -111,3 +111,15 @@ usb 0x1083 0x161d
# DR-7090C
usb 0x1083 0x1620
# DR-9050C
usb 0x1083 0x1622
# DR-7550C
usb 0x1083 0x1623
# DR-6050C
usb 0x1083 0x1624
# DR-6010C
usb 0x1083 0x1626

Wyświetl plik

@ -18,8 +18,7 @@ enum scanner_Option
OPT_STANDARD_GROUP,
OPT_SOURCE, /*fb/adf/front/back/duplex*/
OPT_MODE, /*mono/gray/color*/
OPT_X_RES, /*a range or a list*/
OPT_Y_RES, /*a range or a list*/
OPT_RES, /*a range or a list*/
OPT_GEOMETRY_GROUP,
OPT_TL_X,
@ -50,6 +49,7 @@ enum scanner_Option
OPT_SENSOR_GROUP,
OPT_START,
OPT_STOP,
OPT_BUTT3,
OPT_NEWFILE,
OPT_COUNTONLY,
OPT_BYPASSMODE,
@ -59,6 +59,42 @@ enum scanner_Option
NUM_OPTIONS
};
struct img_params
{
int mode; /*color,lineart,etc*/
int source; /*fb,adf front,adf duplex,etc*/
int dpi_x; /*these are in dpi */
int dpi_y;
int tl_x; /*these are in 1200dpi units */
int tl_y;
int br_x;
int br_y;
int page_x;
int page_y;
int width; /*these are in pixels*/
int height;
SANE_Frame format; /*SANE_FRAME_**/
int bpp; /* 1,8,24 */
int Bpl; /* in bytes */
int valid_width; /*some machines have black padding*/
int valid_Bpl;
/* done yet? */
int eof[2];
/* how far we have read/written */
int bytes_sent[2];
/* total to read/write */
int bytes_tot[2];
};
struct scanner
{
/* --------------------------------------------------------------------- */
@ -91,26 +127,12 @@ struct scanner
int min_x_res;
int min_y_res;
int std_res_200;
int std_res_180;
int std_res_160;
int std_res_150;
int std_res_120;
int std_res_100;
int std_res_75;
int std_res_60;
int std_res_1200;
int std_res_800;
int std_res_600;
int std_res_480;
int std_res_400;
int std_res_320;
int std_res_300;
int std_res_240;
int std_res_x[16];
int std_res_y[16];
/* max scan size in pixels comes from scanner in basic res units */
int max_x_basic;
int max_y_basic;
/* max scan size in pixels converted to 1200dpi units */
int max_x;
int max_y;
/*FIXME: 4 more unknown values here*/
int can_grayscale;
@ -126,10 +148,9 @@ struct scanner
int contrast_steps;
/* the scan size in 1/1200th inches, NOT basic_units or sane units */
int max_x;
int max_y;
int min_x;
int min_y;
int valid_x;
int max_x_fb;
int max_y_fb;
@ -183,10 +204,8 @@ struct scanner
SANE_String_Const mode_list[7];
SANE_String_Const source_list[5];
SANE_Int x_res_list[17];
SANE_Int y_res_list[17];
SANE_Range x_res_range;
SANE_Range y_res_range;
SANE_Int res_list[17];
SANE_Range res_range;
/*geometry group*/
SANE_Range tl_x_range;
@ -212,20 +231,9 @@ struct scanner
/* --------------------------------------------------------------------- */
/* changeable vars to hold user input. modified by SANE_Options above */
/*mode group*/
int mode; /*color,lineart,etc*/
int source; /*fb,adf front,adf duplex,etc*/
int resolution_x; /* X resolution in dpi */
int resolution_y; /* Y resolution in dpi */
/*geometry group*/
/* The desired size of the scan, all in 1/1200 inch */
int tl_x;
int tl_y;
int br_x;
int br_y;
int page_width;
int page_height;
/* the user image params (for final image output) */
/* exposed in standard and geometry option groups */
struct img_params u;
/*enhancement group*/
int brightness;
@ -248,15 +256,8 @@ struct scanner
/* values which are derived from setting the options above */
/* the user never directly modifies these */
/* this is defined in sane spec as a struct containing:
SANE_Frame format;
SANE_Bool last_frame;
SANE_Int lines;
SANE_Int depth; ( binary=1, gray=8, color=8 (!24) )
SANE_Int pixels_per_line;
SANE_Int bytes_per_line;
*/
SANE_Parameters params;
/* the scanner image params (what we ask from scanner) */
struct img_params s;
/* --------------------------------------------------------------------- */
/* values which are set by calibration functions */
@ -283,19 +284,6 @@ struct scanner
int jpeg_stage;
int jpeg_ff_offset;
/* scanner done yet? */
int eof_rx[2];
/* total to read/write */
int bytes_tot[2];
/* how far we have read */
int bytes_rx[2];
int lines_rx[2]; /*only used by 3091*/
/* how far we have written */
int bytes_tx[2];
unsigned char * buffers[2];
/* --------------------------------------------------------------------- */
@ -308,6 +296,7 @@ struct scanner
int panel_start;
int panel_stop;
int panel_butt3;
int panel_new_file;
int panel_count_only;
int panel_bypass_mode;
@ -333,6 +322,28 @@ struct scanner
#define SOURCE_ADF_BACK 2
#define SOURCE_ADF_DUPLEX 3
static const int dpi_list[] = {
60,75,100,120,150,160,180,200,
240,300,320,400,480,600,800,1200
};
#define DPI_60 0
#define DPI_75 1
#define DPI_100 2
#define DPI_120 3
#define DPI_150 4
#define DPI_160 5
#define DPI_180 6
#define DPI_200 7
#define DPI_240 8
#define DPI_300 9
#define DPI_320 10
#define DPI_400 11
#define DPI_480 12
#define DPI_600 13
#define DPI_800 14
#define DPI_1200 15
#define COMP_NONE WD_cmp_NONE
#define COMP_JPEG WD_cmp_JPEG
@ -490,6 +501,8 @@ static int get_page_width (struct scanner *s);
static int get_page_height (struct scanner *s);
static SANE_Status set_window (struct scanner *s);
static SANE_Status update_params (struct scanner *s);
static SANE_Status clean_params (struct scanner *s);
static SANE_Status read_panel(struct scanner *s, SANE_Int option);
static SANE_Status send_panel(struct scanner *s);

Wyświetl plik

@ -11,7 +11,7 @@
:backend "canon_dr" ; name of backend
:url "http://www.thebility.com/canon/"
:version "26" ; version of backend
:version "28" ; version of backend
:manpage "sane-canon_dr" ; name of manpage (if it exists)
:comment "New backend as of SANE release 1.0.20, testers needed, see manpage"
:devicetype :scanner ; start of a list of devices....
@ -40,6 +40,12 @@
:status :untested
:comment "Please test!"
:model "CR-180II"
:interface "USB SCSI"
:usbid "0x04a9" "0x1602"
:status :untested
:comment "Same as CR-180? Please test!"
:model "DR-1210C"
:interface "USB"
:usbid "0x04a9" "0x2222"
@ -55,14 +61,14 @@
:model "DR-2010C"
:interface "USB"
:usbid "0x1083" "0x161b"
:status :untested
:comment "Please test!"
:status :good
:comment "Hardware provides: Gray/Color, Simplex/Duplex, Full-width, 300/600dpi horizontal. Driver provides: Binary, Cropping, Calibration, other resolutions"
:model "DR-2050C"
:interface "USB"
:usbid "0x04a9" "0x160a"
:status :basic
:comment "Gray/Color, Simplex/Duplex working. Poor calibration, only full-width scans."
:status :good
:comment "Hardware provides: Gray/Color, Simplex/Duplex, Full-width. Driver provides: Binary, Cropping, Calibration"
:model "DR-2050SP"
:interface "USB"
@ -73,20 +79,20 @@
:model "DR-2080C"
:interface "USB SCSI"
:usbid "0x04a9" "0x1601"
:status :basic
:comment "Gray/Color, Simplex/Duplex working. Poor calibration, only full-width scans."
:status :good
:comment "Hardware provides: Gray/Color, Simplex/Duplex, Full-width. Driver provides: Binary, Cropping, Calibration"
:model "DR-2510C"
:interface "USB"
:usbid "0x1083" "0x1617"
:status :basic
:comment "Gray/Color, Simplex/Duplex, 300/600dpi working. Poor calibration, only full-width scans."
:status :good
:comment "Hardware provides: Gray/Color, Simplex/Duplex, Full-width, 300/600dpi horizontal. Driver provides: Binary, Cropping, Calibration, other resolutions"
:model "DR-2580C"
:interface "USB SCSI"
:usbid "0x04a9" "0x1608"
:status :basic
:comment "Gray/Color, Simplex/Duplex working. Poor calibration."
:status :good
:comment "Hardware provides: Gray/Color, Simplex/Duplex, Full-width. Driver provides: Binary, Cropping, Calibration"
:model "DR-3010C"
:interface "USB"
@ -159,6 +165,18 @@
:status :untested
:comment "Please test!"
:model "DR-6010C"
:interface "USB SCSI"
:usbid "0x1083" "0x1626"
:status :untested
:comment "Please test!"
:model "DR-6050C"
:interface "USB SCSI"
:usbid "0x1083" "0x1624"
:status :untested
:comment "Please test!"
:model "DR-6080"
:interface "USB SCSI"
:usbid "0x04a9" "0x1607"
@ -177,12 +195,24 @@
:status :untested
:comment "Please test!"
:model "DR-7550C"
:interface "USB SCSI"
:usbid "0x1083" "0x1623"
:status :untested
:comment "Please test!"
:model "DR-7580"
:interface "USB SCSI"
:usbid "0x04a9" "0x160b"
:status :good
:comment "Simplex, duplex, all resolutions, binary/ht/gray, async mode, dropout-color, multifeed/staple detection, deskew, buttons and JPEG working. Imprinter, barcode, custom gamma and multistream unsupported"
:model "DR-9050C"
:interface "USB SCSI"
:usbid "0x1083" "0x1622"
:status :untested
:comment "Please test!"
:model "DR-9080C"
:interface "USB SCSI"
:usbid "0x04a9" "0x1603"

Wyświetl plik

@ -1,4 +1,4 @@
.TH sane\-canon_dr 5 "20 Apr 2009" "@PACKAGEVERSION@" "SANE Scanner Access Now Easy"
.TH sane\-canon_dr 5 "20 May 2009" "@PACKAGEVERSION@" "SANE Scanner Access Now Easy"
.IX sane\-canon_dr
.SH NAME
@ -10,7 +10,7 @@ The
library implements a SANE (Scanner Access Now Easy) backend which
provides access to some Canon DR-series scanners.
This document describes backend version 26, which shipped with SANE 1.0.20.
This document describes backend version 28, which shipped with SANE 1.0.20cvs.
.SH SUPPORTED HARDWARE
This version has only been tested with a few scanner models. Please see
@ -22,6 +22,13 @@ way to determine level of support is to test the scanner directly,
or to collect a trace of the windows driver in action.
Please contact the author for help or with test results.
In general, the larger machines (DR-4000 and up) which have been tested use
a fairly complete protocol, with hardware support for many modes, resolutions
and features. The smaller machines have many limitations, like missing
horizontal resolutions, missing binary mode, always scanning full-width, etc.
There is code in the backend to address these problems, but there seems to be
no way to detect if they are required, so they must be hard-coded.
.SH OPTIONS
Effort has been made to expose most hardware options, including:
.PP
@ -37,10 +44,9 @@ Selects the mode for the scan. Options
may include "Lineart", "Halftone", "Gray", and "Color".
.RE
.PP
resolution, y\-resolution
resolution
.RS
Controls scan resolution. Setting \-\-resolution also sets \-\-y\-resolution,
though this behavior is overridden by some frontends.
Controls scan resolution.
.RE
.PP
tl\-x, tl\-y, br\-x, br\-y
@ -159,9 +165,14 @@ machines have not been tested. Their protocol is unknown.
.SH CREDITS
The various authors of the sane\-fujitsu backend provided useful code
.br
Corcaribe Tecnología C.A. www.cc.com.ve provided significant funding
.br
EvriChart, Inc. www.evrichart.com provided funding and loaned equipment
.br
Canon, USA. www.usa.canon.com loaned equipment
.br
HPrint hprint.com.br provided funding and testing for DR-2xxx support
.SH "SEE ALSO"
sane(7),