Merge branch 'master' of ssh://git.debian.org/git/sane/sane-backends

merge-requests/1/head
Nicolas Martin 2010-12-04 15:50:38 +01:00
commit 70d6c87fa0
5 zmienionych plików z 143 dodań i 34 usunięć

Wyświetl plik

@ -1,3 +1,14 @@
2010-12-02 m. allan noah <kitno455 at gmail dot com>
* backend/fujitsu.[ch], backend/fujitsu-scsi.h:
Fujitsu backend version 105
- backup and restore image params around image processing code
- cache software crop/deskew parameters for use on backside of duplex
- fi-6110 does not support bgcolor or prepick
2010-11-29 Olaf Meeuwissen <olaf.meeuwissen@avasys.jp>
* backend/epson2-ops.c: fix list of supported commands for levels D1
and D2.
2010-11-24 m. allan noah <kitno455 at gmail dot com>
* backend/fujitsu.c, backend/fujitsu.conf.in,
doc/descriptions/fujitsu.desc, doc/sane-fujitsu.man:

Wyświetl plik

@ -86,8 +86,8 @@ static struct EpsonCmd epson_cmd[] = {
{"B8",'I', 0 ,'F','S','C','G','D','R','H','A','L',{-4, 3, 0},'Z','B','M','@','g','d','K','z','Q','b','m','f','e','\f', 0x19,'!','s','N', 0 , 0 ,'t','p','q','I','F'},
/* XXX 'f' probably not supported on F5 */
{"F5",'I', 0 ,'F','S','C','G','D','R','H','A','L',{-3, 3, 0},'Z', 0 ,'M','@','g','d','K','z','Q', 0 ,'m','f','e','\f', 0 , 0 , 0 ,'N','T','P', 0 , 0 , 0 , 0 , 0 },
{"D1",'I','i','F', 0 ,'C','G','D','R', 0 ,'A', 0 ,{ 0, 0, 0},'Z', 0 , 0 ,'@','g','d', 0 ,'z', 0 , 0 ,'m','f', 0 , 0 , 0 ,'!', 0 , 0 , 0 , 0 ,'t', 0 , 0 , 0 , 0 },
{"D2",'I','i','F', 0 ,'C','G','D','R', 0 ,'A', 0 ,{ 0, 0, 0},'Z', 0 , 0 ,'@','g','d', 0 ,'z', 0 , 0 ,'m','f','e', 0 , 0 ,'!', 0 ,'N', 0 , 0 ,'t', 0 , 0 , 0 , 0 },
{"D1",'I','i','F', 0 ,'C','G','D','R', 0 ,'A', 0 ,{ 0, 0, 0},'Z', 0 , 0 ,'@','g','d', 0 ,'z', 0 , 0 , 0 ,'f', 0 , 0 , 0 ,'!', 0 , 0 , 0 , 0 ,'t', 0 , 0 , 0 , 0 },
{"D2",'I','i','F', 0 ,'C','G','D','R', 0 ,'A', 0 ,{ 0, 0, 0},'Z', 0 , 0 ,'@','g','d', 0 ,'z', 0 , 0 , 0 ,'f','e', 0 , 0 ,'!', 0 ,'N', 0 , 0 ,'t', 0 , 0 , 0 , 0 },
{"D7",'I','i','F', 0 ,'C','G','D','R', 0 ,'A', 0 ,{ 0, 0, 0},'Z', 0 , 0 ,'@','g','d', 0 ,'z', 0 , 0 , 0 ,'f','e','\f', 0 ,'!', 0 ,'N', 0 , 0 ,'t', 0 , 0 , 0 , 0 },
{"D8",'I','i','F', 0 ,'C','G','D','R', 0 ,'A', 0 ,{ 0, 0, 0},'Z', 0 , 0 ,'@','g','d', 0 ,'z', 0 , 0 , 0 ,'f','e','\f', 0 ,'!', 0 ,'N', 0 , 0 ,'t', 0 , 0 , 0 , 0 },
};

Wyświetl plik

@ -150,9 +150,10 @@ putnbyte (unsigned char *pnt, unsigned int value, unsigned int nbytes)
#define get_IN_long_color(in) getbitfield(in+0x2C, 1, 0)
#define get_IN_emulation(in) getbitfield(in+0x2D, 1, 6)
#define get_IN_vrs_cga(in) getbitfield(in+0x2D, 1, 5)
#define get_IN_cmp_cga(in) getbitfield(in+0x2D, 1, 5)
#define get_IN_bg_back(in) getbitfield(in+0x2D, 1, 3)
#define get_IN_bg_front(in) getbitfield(in+0x2D, 1, 2)
#define get_IN_bg_fb(in) getbitfield(in+0x2D, 1, 1)
#define get_IN_has_back(in) getbitfield(in+0x2D, 1, 0)
#define get_IN_duplex_offset(in) getnbyte (in+0x2E, 2)

Wyświetl plik

@ -477,6 +477,10 @@
v104 2010-11-24, MAN
- never request more than s->buffer_size from scanner
- silence noisy set_window() calls from init_interlace()
v105 2010-12-02, MAN
- backup and restore image params around image processing code
- cache software crop/deskew parameters for use on backside of duplex
- fi-6110 does not support bgcolor or prepick
SANE FLOW DIAGRAM
@ -526,7 +530,7 @@
#include "fujitsu.h"
#define DEBUG 1
#define BUILD 104
#define BUILD 105
/* values for SANE_DEBUG_FUJITSU env var:
- errors 5
@ -1078,9 +1082,10 @@ init_inquire (struct fujitsu *s)
DBG (15, " long color scan: %d\n",get_IN_long_color(in));
DBG (15, " emulation mode: %d\n",get_IN_emulation(in));
DBG (15, " VRS CGA: %d\n",get_IN_vrs_cga(in));
DBG (15, " CMP/CGA: %d\n",get_IN_cmp_cga(in));
DBG (15, " background back: %d\n",get_IN_bg_back(in));
DBG (15, " background front: %d\n",get_IN_bg_front(in));
DBG (15, " background fb: %d\n",get_IN_bg_fb(in));
DBG (15, " back only scan: %d\n",get_IN_has_back(in));
s->duplex_raster_offset = get_IN_duplex_offset(in);
@ -1963,9 +1968,11 @@ init_model (struct fujitsu *s)
s->max_y_fb = 14173;
}
else if (strstr (s->model_name,"S1500")){
else if (strstr (s->model_name,"S1500")
|| strstr (s->model_name,"fi-6110")){
/*lies*/
s->has_MS_bg=0;
s->has_MS_prepick=0;
}
DBG (10, "init_model: finish\n");
@ -5949,6 +5956,48 @@ update_params (struct fujitsu * s)
return ret;
}
/* make backup of param data, in case original is overwritten */
SANE_Status
backup_params (struct fujitsu * s)
{
SANE_Status ret = SANE_STATUS_GOOD;
SANE_Parameters * params = &(s->params);
SANE_Parameters * params_bk = &(s->params_bk);
DBG (15, "backup_params: start\n");
params_bk->format = params->format;
params_bk->last_frame = params->last_frame;
params_bk->bytes_per_line = params->bytes_per_line;
params_bk->pixels_per_line = params->pixels_per_line;
params_bk->lines = params->lines;
params_bk->depth = params->depth;
DBG (10, "backup_params: finish\n");
return ret;
}
/* restore backup of param data, in case original was overwritten */
SANE_Status
restore_params (struct fujitsu * s)
{
SANE_Status ret = SANE_STATUS_GOOD;
SANE_Parameters * params = &(s->params);
SANE_Parameters * params_bk = &(s->params_bk);
DBG (15, "restore_params: start\n");
params->format = params_bk->format;
params->last_frame = params_bk->last_frame;
params->bytes_per_line = params_bk->bytes_per_line;
params->pixels_per_line = params_bk->pixels_per_line;
params->lines = params_bk->lines;
params->depth = params_bk->depth;
DBG (10, "restore_params: finish\n");
return ret;
}
/*
* Called by SANE when a page acquisition operation is to be started.
* commands: scanner control (lampon), send (lut), send (dither),
@ -6039,6 +6088,13 @@ sane_start (SANE_Handle handle)
return ret;
}
/* make backup copy of params because later functions overwrite */
ret = backup_params(s);
if (ret != SANE_STATUS_GOOD) {
DBG (5, "sane_start: ERROR: cannot backup params\n");
return ret;
}
/* start/stop endorser */
ret = endorser(s);
if (ret != SANE_STATUS_GOOD) {
@ -6057,6 +6113,13 @@ sane_start (SANE_Handle handle)
s->side = !s->side;
}
/* restore backup copy of params at the start of each image */
ret = restore_params(s);
if (ret != SANE_STATUS_GOOD) {
DBG (5, "sane_start: ERROR: cannot restore params\n");
return ret;
}
/* set clean defaults with new sheet of paper */
/* dont reset the transfer vars on backside of duplex page */
/* otherwise buffered back page will be lost */
@ -8614,18 +8677,26 @@ buffer_deskew(struct fujitsu *s, int side)
{
SANE_Status ret = SANE_STATUS_GOOD;
int x = 0, y = 0;
double slope = 0;
int bg_color = 0xdd;
int bg_color = 0xd6;
DBG (10, "buffer_deskew: start\n");
ret = sanei_magic_findSkew(&s->params,s->buffers[side],
s->resolution_x,s->resolution_y,&x,&y,&slope);
if(ret){
DBG (5, "buffer_despeck: bad findSkew, bailing\n");
ret = SANE_STATUS_GOOD;
goto cleanup;
/*only find skew on first image from a page, or if first image had error */
if(s->side == SIDE_FRONT || s->source == SOURCE_ADF_BACK || s->deskew_stat){
s->deskew_stat = sanei_magic_findSkew(
&s->params,s->buffers[side],s->resolution_x,s->resolution_y,
&s->deskew_vals[0],&s->deskew_vals[1],&s->deskew_slope);
if(s->deskew_stat){
DBG (5, "buffer_despeck: bad findSkew, bailing\n");
goto cleanup;
}
}
/* backside images can use a 'flipped' version of frontside data */
else{
s->deskew_slope *= -1;
s->deskew_vals[0] = s->params.pixels_per_line - s->deskew_vals[0];
}
/* tweak the bg color based on scanner settings */
@ -8638,7 +8709,9 @@ buffer_deskew(struct fujitsu *s, int side)
else if(s->bg_color == COLOR_BLACK)
bg_color = 0;
ret = sanei_magic_rotate(&s->params,s->buffers[side], x, y, slope, bg_color);
ret = sanei_magic_rotate(&s->params,s->buffers[side],
s->deskew_vals[0],s->deskew_vals[1],s->deskew_slope,bg_color);
if(ret){
DBG(5,"buffer_deskew: rotate error: %d",ret);
ret = SANE_STATUS_GOOD;
@ -8658,29 +8731,39 @@ buffer_crop(struct fujitsu *s, int side)
{
SANE_Status ret = SANE_STATUS_GOOD;
int top = 0;
int bot = 0;
int left = 0;
int right = 0;
DBG (10, "buffer_crop: start\n");
ret = sanei_magic_findEdges(&s->params,s->buffers[side],
s->resolution_x,s->resolution_y,&top,&bot,&left,&right);
if(ret){
DBG (5, "buffer_crop: bad edges, bailing\n");
ret = SANE_STATUS_GOOD;
goto cleanup;
/*only find edges on first image from a page, or if first image had error */
if(s->side == SIDE_FRONT || s->source == SOURCE_ADF_BACK || s->crop_stat){
s->crop_stat = sanei_magic_findEdges(
&s->params,s->buffers[side],s->resolution_x,s->resolution_y,
&s->crop_vals[0],&s->crop_vals[1],&s->crop_vals[2],&s->crop_vals[3]);
if(s->crop_stat){
DBG (5, "buffer_crop: bad edges, bailing\n");
goto cleanup;
}
DBG (15, "buffer_crop: t:%d b:%d l:%d r:%d\n",
s->crop_vals[0],s->crop_vals[1],s->crop_vals[2],s->crop_vals[3]);
/* we dont listen to the 'top' value, since fujitsu does not pad the top */
s->crop_vals[0] = 0;
}
/* backside images can use a 'flipped' version of frontside data */
else{
int left = s->crop_vals[2];
int right = s->crop_vals[3];
s->crop_vals[2] = s->params.pixels_per_line - right;
s->crop_vals[3] = s->params.pixels_per_line - left;
}
DBG (15, "buffer_crop: t:%d b:%d l:%d r:%d\n",top,bot,left,right);
/* we dont listen to the 'top' value, since fujitsu does not pad the top */
top = 0;
/* now crop the image */
/*FIXME: crop duplex backside at same time?*/
ret = sanei_magic_crop(&s->params,s->buffers[side],top,bot,left,right);
ret = sanei_magic_crop(&s->params,s->buffers[side],
s->crop_vals[0],s->crop_vals[1],s->crop_vals[2],s->crop_vals[3]);
if(ret){
DBG (5, "buffer_crop: bad crop, bailing\n");
ret = SANE_STATUS_GOOD;

Wyświetl plik

@ -502,6 +502,9 @@ struct fujitsu
*/
SANE_Parameters params;
/* also keep a backup copy, in case the software enhancement code overwrites*/
SANE_Parameters params_bk;
/* --------------------------------------------------------------------- */
/* values which are set by scanning functions to keep track of pages, etc */
int started;
@ -530,6 +533,15 @@ struct fujitsu
unsigned char * buffers[2];
/* --------------------------------------------------------------------- */
/* values used by the software enhancment code (deskew, crop, etc) */
SANE_Status deskew_stat;
int deskew_vals[2];
double deskew_slope;
SANE_Status crop_stat;
int crop_vals[4];
/* --------------------------------------------------------------------- */
/* values used by the compression functions, esp. jpeg with duplex */
int jpeg_stage;
@ -779,6 +791,8 @@ static SANE_Status set_window (struct fujitsu *s);
static SANE_Status get_pixelsize(struct fujitsu *s);
static SANE_Status update_params (struct fujitsu *s);
static SANE_Status backup_params (struct fujitsu *s);
static SANE_Status restore_params (struct fujitsu *s);
static SANE_Status start_scan (struct fujitsu *s);
static SANE_Status check_for_cancel(struct fujitsu *s);