446
451
- support hardware based auto length detection
447
452
v97 2009-09-14, MAN
448
453
- use sanei_magic to provide software deskew, autocrop and despeckle
454
v98 2010-02-09, MAN (SANE 1.0.21)
450
455
- clean up #include lines and copyright
451
456
- add SANE_I18N to static strings
452
457
- don't fail if scsi buffer is too small
453
458
- disable bg_color for S1500
454
459
- enable flatbed for M3092
461
- sense_handler(): collect rs_info for any ILI, not just EOM
462
- do_usb_cmd(): use rs_info whenever set, not just EOF
463
- read_from_*(): better handling of EOF from lower level functions
464
- sane_read(): improve duplexing logic
466
- store more Request Sense data in scanner struct
467
- clear Request Sense data at start of every do_cmd() call
468
- track per-side ILI and global EOM flags
469
- set per-side EOF flag if ILI and EOM are set
471
- fix compilation bug when jpeg is enabled
473
- fix infinite loop when scan is an odd number of lines
475
- remove compiled-in default config file
476
- initial support for new fi-6xxx machines
478
- never request more than s->buffer_size from scanner
479
- silence noisy set_window() calls from init_interlace()
481
- backup and restore image params around image processing code
482
- cache software crop/deskew parameters for use on backside of duplex
483
- fi-6110 does not support bgcolor or prepick
484
v106 2011-01-30, MAN (SANE 1.0.22)
485
- dont call mode_select with a page code the scanner does not support
456
487
SANE FLOW DIAGRAM
729
DBG (5, "sane_get_devices: no config file '%s', using defaults\n", FUJITSU_CONFIG_FILE);
731
DBG (15, "sane_get_devices: looking for 'scsi FUJITSU'\n");
732
sanei_config_attach_matching_devices ("scsi FUJITSU", attach_one_scsi);
734
DBG (15, "sane_get_devices: looking for 'usb 0x04c5 0x1041'\n");
735
sanei_usb_attach_matching_devices("usb 0x04c5 0x1041", attach_one_usb);
737
DBG (15, "sane_get_devices: looking for 'usb 0x04c5 0x1042'\n");
738
sanei_usb_attach_matching_devices("usb 0x04c5 0x1042", attach_one_usb);
740
DBG (15, "sane_get_devices: looking for 'usb 0x04c5 0x1078'\n");
741
sanei_usb_attach_matching_devices("usb 0x04c5 0x1078", attach_one_usb);
743
DBG (15, "sane_get_devices: looking for 'usb 0x04c5 0x1095'\n");
744
sanei_usb_attach_matching_devices("usb 0x04c5 0x1095", attach_one_usb);
746
DBG (15, "sane_get_devices: looking for 'usb 0x04c5 0x1096'\n");
747
sanei_usb_attach_matching_devices("usb 0x04c5 0x1096", attach_one_usb);
749
DBG (15, "sane_get_devices: looking for 'usb 0x04c5 0x1097'\n");
750
sanei_usb_attach_matching_devices("usb 0x04c5 0x1097", attach_one_usb);
752
DBG (15, "sane_get_devices: looking for 'usb 0x04c5 0x10ad'\n");
753
sanei_usb_attach_matching_devices("usb 0x04c5 0x10ad", attach_one_usb);
755
DBG (15, "sane_get_devices: looking for 'usb 0x04c5 0x10ae'\n");
756
sanei_usb_attach_matching_devices("usb 0x04c5 0x10ae", attach_one_usb);
758
DBG (15, "sane_get_devices: looking for 'usb 0x04c5 0x10af'\n");
759
sanei_usb_attach_matching_devices("usb 0x04c5 0x10af", attach_one_usb);
761
DBG (15, "sane_get_devices: looking for 'usb 0x04c5 0x10cf'\n");
762
sanei_usb_attach_matching_devices("usb 0x04c5 0x10cf", attach_one_usb);
764
DBG (15, "sane_get_devices: looking for 'usb 0x04c5 0x10e0'\n");
765
sanei_usb_attach_matching_devices("usb 0x04c5 0x10e0", attach_one_usb);
767
DBG (15, "sane_get_devices: looking for 'usb 0x04c5 0x10e1'\n");
768
sanei_usb_attach_matching_devices("usb 0x04c5 0x10e1", attach_one_usb);
770
DBG (15, "sane_get_devices: looking for 'usb 0x04c5 0x10e2'\n");
771
sanei_usb_attach_matching_devices("usb 0x04c5 0x10e2", attach_one_usb);
773
DBG (15, "sane_get_devices: looking for 'usb 0x04c5 0x10e6'\n");
774
sanei_usb_attach_matching_devices("usb 0x04c5 0x10e6", attach_one_usb);
776
DBG (15, "sane_get_devices: looking for 'usb 0x04c5 0x10e7'\n");
777
sanei_usb_attach_matching_devices("usb 0x04c5 0x10e7", attach_one_usb);
779
DBG (15, "sane_get_devices: looking for 'usb 0x04c5 0x10f2'\n");
780
sanei_usb_attach_matching_devices("usb 0x04c5 0x10f2", attach_one_usb);
782
DBG (15, "sane_get_devices: looking for 'usb 0x04c5 0x10fe'\n");
783
sanei_usb_attach_matching_devices("usb 0x04c5 0x10fe", attach_one_usb);
785
DBG (15, "sane_get_devices: looking for 'usb 0x04c5 0x1135'\n");
786
sanei_usb_attach_matching_devices("usb 0x04c5 0x1135", attach_one_usb);
788
DBG (15, "sane_get_devices: looking for 'usb 0x04c5 0x114a'\n");
789
sanei_usb_attach_matching_devices("usb 0x04c5 0x114a", attach_one_usb);
791
DBG (15, "sane_get_devices: looking for 'usb 0x04c5 0x114d'\n");
792
sanei_usb_attach_matching_devices("usb 0x04c5 0x114d", attach_one_usb);
794
DBG (15, "sane_get_devices: looking for 'usb 0x04c5 0x114e'\n");
795
sanei_usb_attach_matching_devices("usb 0x04c5 0x114e", attach_one_usb);
797
DBG (15, "sane_get_devices: looking for 'usb 0x04c5 0x114f'\n");
798
sanei_usb_attach_matching_devices("usb 0x04c5 0x114f", attach_one_usb);
800
DBG (15, "sane_get_devices: looking for 'usb 0x04c5 0x1150\n");
801
sanei_usb_attach_matching_devices("usb 0x04c5 0x1150", attach_one_usb);
803
DBG (15, "sane_get_devices: looking for 'usb 0x04c5 0x1155'\n");
804
sanei_usb_attach_matching_devices("usb 0x04c5 0x1155", attach_one_usb);
806
DBG (15, "sane_get_devices: looking for 'usb 0x04c5 0x116f'\n");
807
sanei_usb_attach_matching_devices("usb 0x04c5 0x116f", attach_one_usb);
809
DBG (15, "sane_get_devices: looking for 'usb 0x04c5 0x1174'\n");
810
sanei_usb_attach_matching_devices("usb 0x04c5 0x1174", attach_one_usb);
812
DBG (15, "sane_get_devices: looking for 'usb 0x04c5 0x1175'\n");
813
sanei_usb_attach_matching_devices("usb 0x04c5 0x1175", attach_one_usb);
815
DBG (15, "sane_get_devices: looking for 'usb 0x04c5 0x1176'\n");
816
sanei_usb_attach_matching_devices("usb 0x04c5 0x1176", attach_one_usb);
818
DBG (15, "sane_get_devices: looking for 'usb 0x04c5 0x1177'\n");
819
sanei_usb_attach_matching_devices("usb 0x04c5 0x1177", attach_one_usb);
821
DBG (15, "sane_get_devices: looking for 'usb 0x04c5 0x1178'\n");
822
sanei_usb_attach_matching_devices("usb 0x04c5 0x1178", attach_one_usb);
824
DBG (15, "sane_get_devices: looking for 'usb 0x04c5 0x11a2'\n");
825
sanei_usb_attach_matching_devices("usb 0x04c5 0x11a2", attach_one_usb);
760
DBG (5, "sane_get_devices: missing required config file '%s'!\n",
761
FUJITSU_CONFIG_FILE);
828
764
/*delete missing scanners from list*/
5986
/* make backup of param data, in case original is overwritten */
5988
backup_params (struct fujitsu * s)
5990
SANE_Status ret = SANE_STATUS_GOOD;
5991
SANE_Parameters * params = &(s->params);
5992
SANE_Parameters * params_bk = &(s->params_bk);
5994
DBG (15, "backup_params: start\n");
5996
params_bk->format = params->format;
5997
params_bk->last_frame = params->last_frame;
5998
params_bk->bytes_per_line = params->bytes_per_line;
5999
params_bk->pixels_per_line = params->pixels_per_line;
6000
params_bk->lines = params->lines;
6001
params_bk->depth = params->depth;
6003
DBG (10, "backup_params: finish\n");
6007
/* restore backup of param data, in case original was overwritten */
6009
restore_params (struct fujitsu * s)
6011
SANE_Status ret = SANE_STATUS_GOOD;
6012
SANE_Parameters * params = &(s->params);
6013
SANE_Parameters * params_bk = &(s->params_bk);
6015
DBG (15, "restore_params: start\n");
6017
params->format = params_bk->format;
6018
params->last_frame = params_bk->last_frame;
6019
params->bytes_per_line = params_bk->bytes_per_line;
6020
params->pixels_per_line = params_bk->pixels_per_line;
6021
params->lines = params_bk->lines;
6022
params->depth = params_bk->depth;
6024
DBG (10, "restore_params: finish\n");
6014
6029
* Called by SANE when a page acquisition operation is to be started.
6015
6030
* commands: scanner control (lampon), send (lut), send (dither),
7010
7044
/* buffer front side */
7011
ret = read_from_scanner(s, SIDE_FRONT);
7013
DBG(5,"sane_read: front returning %d\n",ret);
7045
if(!s->eof_rx[SIDE_FRONT]){
7046
ret = read_from_scanner(s, SIDE_FRONT);
7048
DBG(5,"sane_read: front returning %d\n",ret);
7017
7053
/* buffer back side */
7018
ret = read_from_scanner(s, SIDE_BACK);
7020
DBG(5,"sane_read: back returning %d\n",ret);
7054
if(!s->eof_rx[SIDE_BACK]){
7055
ret = read_from_scanner(s, SIDE_BACK);
7057
DBG(5,"sane_read: back returning %d\n",ret);
7023
7061
} /* end alt pnm */
7025
7063
/* simplex or non-alternating duplex */
7064
else if(!s->eof_rx[s->side]){
7027
7065
ret = read_from_scanner(s, s->side);
7029
7067
DBG(5,"sane_read: side %d returning %d\n",s->side,ret);
7903
7970
/* copy the rs return data into the scanner struct
7904
so that the caller can use it if he wants
7905
memcpy(&s->rs_buffer,sensed_data,RS_return_size);
7971
so that the caller can use it if he wants */
7972
s->rs_info = get_RS_information (sensed_data);
7973
s->rs_eom = get_RS_EOM (sensed_data);
7974
s->rs_ili = get_RS_ILI (sensed_data);
7908
DBG (5, "Sense=%#02x, ASC=%#02x, ASCQ=%#02x, EOM=%d, ILI=%d, info=%#08x\n", sense, asc, ascq, eom, ili, info);
7976
DBG (5, "Sense=%#02x, ASC=%#02x, ASCQ=%#02x, EOM=%d, ILI=%d, info=%#08lx\n", sense, asc, ascq, s->rs_eom, s->rs_ili, (unsigned long)s->rs_info);
7910
7978
switch (sense) {
8629
8705
SANE_Status ret = SANE_STATUS_GOOD;
8633
int bg_color = 0xdd;
8707
int bg_color = 0xd6;
8635
8709
DBG (10, "buffer_deskew: start\n");
8637
ret = sanei_magic_findSkew(&s->params,s->buffers[side],
8638
s->resolution_x,s->resolution_y,&x,&y,&slope);
8640
DBG (5, "buffer_despeck: bad findSkew, bailing\n");
8641
ret = SANE_STATUS_GOOD;
8711
/*only find skew on first image from a page, or if first image had error */
8712
if(s->side == SIDE_FRONT || s->source == SOURCE_ADF_BACK || s->deskew_stat){
8714
s->deskew_stat = sanei_magic_findSkew(
8715
&s->params,s->buffers[side],s->resolution_x,s->resolution_y,
8716
&s->deskew_vals[0],&s->deskew_vals[1],&s->deskew_slope);
8719
DBG (5, "buffer_despeck: bad findSkew, bailing\n");
8723
/* backside images can use a 'flipped' version of frontside data */
8725
s->deskew_slope *= -1;
8726
s->deskew_vals[0] = s->params.pixels_per_line - s->deskew_vals[0];
8645
8729
/* tweak the bg color based on scanner settings */
8673
8759
SANE_Status ret = SANE_STATUS_GOOD;
8680
8761
DBG (10, "buffer_crop: start\n");
8682
ret = sanei_magic_findEdges(&s->params,s->buffers[side],
8683
s->resolution_x,s->resolution_y,&top,&bot,&left,&right);
8685
DBG (5, "buffer_crop: bad edges, bailing\n");
8686
ret = SANE_STATUS_GOOD;
8690
DBG (15, "buffer_crop: t:%d b:%d l:%d r:%d\n",top,bot,left,right);
8692
/* we dont listen to the 'top' value, since fujitsu does not pad the top */
8763
/*only find edges on first image from a page, or if first image had error */
8764
if(s->side == SIDE_FRONT || s->source == SOURCE_ADF_BACK || s->crop_stat){
8766
s->crop_stat = sanei_magic_findEdges(
8767
&s->params,s->buffers[side],s->resolution_x,s->resolution_y,
8768
&s->crop_vals[0],&s->crop_vals[1],&s->crop_vals[2],&s->crop_vals[3]);
8771
DBG (5, "buffer_crop: bad edges, bailing\n");
8775
DBG (15, "buffer_crop: t:%d b:%d l:%d r:%d\n",
8776
s->crop_vals[0],s->crop_vals[1],s->crop_vals[2],s->crop_vals[3]);
8778
/* we dont listen to the 'top' value, since fujitsu does not pad the top */
8779
s->crop_vals[0] = 0;
8781
/* backside images can use a 'flipped' version of frontside data */
8783
int left = s->crop_vals[2];
8784
int right = s->crop_vals[3];
8786
s->crop_vals[2] = s->params.pixels_per_line - right;
8787
s->crop_vals[3] = s->params.pixels_per_line - left;
8695
8790
/* now crop the image */
8696
/*FIXME: crop duplex backside at same time?*/
8697
ret = sanei_magic_crop(&s->params,s->buffers[side],top,bot,left,right);
8791
ret = sanei_magic_crop(&s->params,s->buffers[side],
8792
s->crop_vals[0],s->crop_vals[1],s->crop_vals[2],s->crop_vals[3]);
8699
8795
DBG (5, "buffer_crop: bad crop, bailing\n");
8700
8796
ret = SANE_STATUS_GOOD;