diff --git a/backend/fujitsu-scsi.h b/backend/fujitsu-scsi.h index 941f0ddb4..39a3a7355 100644 --- a/backend/fujitsu-scsi.h +++ b/backend/fujitsu-scsi.h @@ -765,8 +765,14 @@ static scsiblk hw_statusB = { hw_statusC, sizeof (hw_statusC) }; * pattern number, three builtin and five downloadable * supported; higher numbers = error. */ -#define set_WD_halftone(sb, val) putnbyte(sb + 0x1b, val, 2) -#define get_WD_halftone(sb) getnbyte(sb + 0x1b, 2) +#define set_WD_ht_type(sb, val) sb[0x1b] = val +#define get_WD_ht_type(sb) sb[0x1b] +#define WD_ht_type_DEFAULT 0 +#define WD_ht_type_DITHER 1 +#define WD_ht_type_DIFFUSION 2 + +#define set_WD_ht_pattern(sb, val) sb[0x1c] = val +#define get_WD_ht_pattern(sb) sb[0x1c] /* 0x1d - Reverse image, padding type * 3091: bit 7=1: reverse black&white diff --git a/backend/fujitsu.c b/backend/fujitsu.c index b756187a1..8a2f4d1fc 100644 --- a/backend/fujitsu.c +++ b/backend/fujitsu.c @@ -342,9 +342,12 @@ - simplify sane_start() and fix interlaced duplex jpeg support - simplify sane_read() and add non-interlaced duplex jpeg support - removed unused code - v67 2008-06-30, MAN + v67 2008-07-01, MAN - add IPC/DTC/SDTC options - call check_for_cancel() in sane_cancel, unless s->reader flag is set + v68 2008-07-02, MAN + - add halftone type and pattern options + - support M3097G with IPC and CMP options via modified VPD response SANE FLOW DIAGRAM @@ -405,7 +408,7 @@ #include "fujitsu.h" #define DEBUG 1 -#define BUILD 67 +#define BUILD 68 /* values for SANE_DEBUG_FUJITSU env var: - errors 5 @@ -434,7 +437,9 @@ static const char string_Off[] = "Off"; static const char string_DTC[] = "DTC"; static const char string_SDTC[] = "SDTC"; -static const char string_Disable[] = "Disable"; + +static const char string_Dither[] = "Dither"; +static const char string_Diffusion[] = "Diffusion"; static const char string_Red[] = "Red"; static const char string_Green[] = "Green"; @@ -1017,22 +1022,46 @@ init_vpd (struct fujitsu *s) set_IN_page_length(buffer,0x5f); } - /* some versions of 3097 have short vpd, fill in missing part */ - /* FIXME: do we need another block for devices with IPC? */ + /* M3097G has short vpd, fill in missing part */ else if (strstr (s->model_name, "M3097G") && (ret == SANE_STATUS_GOOD || ret == SANE_STATUS_EOF) && get_IN_page_length (buffer) == 0x19){ unsigned char vpd3097g[] = { 0, 0, -0xc2, 0x08, 0, 0, 0, 0, 0, 0, 0xed, 0xbf, 0, 1, 0, 0, 0, 0, +0xc2, 0x08, 0, 0, 0, 0, 0, 0, 0xed, 0xbf, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -0, 0, 0xff, 0xff, 0xff, 0, 0x45, 0x35, 0x40, 0xe0, 0, 0, 0, 0, 0, 0, +0, 0, 0xff, 0xff, 0xff, 0, 0x45, 0x35, 0, 0xe0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; DBG (5, "init_vpd: M3097G repair\n"); set_IN_page_length(buffer,0x5f); - memcpy(buffer+0x19+5,vpd3097g,sizeof(vpd3097g)); + memcpy(buffer+0x1e,vpd3097g,sizeof(vpd3097g)); + + /*IPC*/ + if(strstr (s->model_name, "i")){ + DBG (5, "init_vpd: M3097G IPC repair\n"); + + /*subwin cmd*/ + buffer[0x2b] = 1; + + /*rif/dtc/sdtc/outline/emph/sep/mirr/wlf*/ + buffer[0x58] = 0xff; + + /*subwin/diffusion*/ + buffer[0x59] = 0xc0; + } + + /*CMP*/ + if(strstr (s->model_name, "m")){ + DBG (5, "init_vpd: M3097G CMP repair\n"); + + /*4megs*/ + buffer[0x23] = 0x40; + + /*mh/mr/mmr*/ + buffer[0x5a] = 0xe0; + } } DBG (15, "init_vpd: length=%0x\n",get_IN_page_length (buffer)); @@ -2519,6 +2548,48 @@ sane_get_option_descriptor (SANE_Handle handle, SANE_Int option) opt->cap = SANE_CAP_INACTIVE; } + if(option==OPT_HT_TYPE){ + i=0; + s->ht_type_list[i++]=string_Default; + s->ht_type_list[i++]=string_Dither; + s->ht_type_list[i++]=string_Diffusion; + s->ht_type_list[i]=NULL; + + opt->name = "ht-type"; + opt->title = "Halftone type"; + opt->desc = "Control type of halftone filter"; + opt->type = SANE_TYPE_STRING; + opt->unit = SANE_UNIT_NONE; + + opt->constraint_type = SANE_CONSTRAINT_STRING_LIST; + opt->constraint.string_list = s->ht_type_list; + opt->size = maxStringSize (opt->constraint.string_list); + + if(s->has_diffusion && s->mode == MODE_HALFTONE ) + opt->cap = SANE_CAP_SOFT_SELECT | SANE_CAP_SOFT_DETECT; + else + opt->cap = SANE_CAP_INACTIVE; + } + + if(option==OPT_HT_PATTERN){ + opt->name = "ht-pattern"; + opt->title = "Halftone pattern"; + opt->desc = "Control pattern of halftone filter"; + opt->type = SANE_TYPE_INT; + opt->unit = SANE_UNIT_NONE; + + opt->constraint_type = SANE_CONSTRAINT_RANGE; + opt->constraint.range = &s->ht_pattern_range; + s->ht_pattern_range.min=0; + s->ht_pattern_range.max=s->num_internal_dither - 1; + s->ht_pattern_range.quant=1; + + if (s->num_internal_dither && s->mode == MODE_HALFTONE) + opt->cap = SANE_CAP_SOFT_SELECT | SANE_CAP_SOFT_DETECT; + else + opt->cap = SANE_CAP_INACTIVE; + } + if(option==OPT_OUTLINE){ opt->name = "outline"; opt->title = "Outline"; @@ -3739,6 +3810,24 @@ sane_control_option (SANE_Handle handle, SANE_Int option, *val_p = s->rif; return SANE_STATUS_GOOD; + case OPT_HT_TYPE: + switch (s->ht_type) { + case WD_ht_type_DEFAULT: + strcpy (val, string_Default); + break; + case WD_ht_type_DITHER: + strcpy (val, string_Dither); + break; + case WD_ht_type_DIFFUSION: + strcpy (val, string_Diffusion); + break; + } + return SANE_STATUS_GOOD; + + case OPT_HT_PATTERN: + *val_p = s->ht_pattern; + return SANE_STATUS_GOOD; + case OPT_OUTLINE: *val_p = s->outline; return SANE_STATUS_GOOD; @@ -4340,6 +4429,19 @@ sane_control_option (SANE_Handle handle, SANE_Int option, s->rif = val_c; return SANE_STATUS_GOOD; + case OPT_HT_TYPE: + if (!strcmp(val, string_Default)) + s->ht_type = WD_ht_type_DEFAULT; + else if (!strcmp(val, string_Dither)) + s->ht_type = WD_ht_type_DITHER; + else if (!strcmp(val, string_Diffusion)) + s->ht_type = WD_ht_type_DIFFUSION; + return SANE_STATUS_GOOD; + + case OPT_HT_PATTERN: + s->ht_pattern = val_c; + return SANE_STATUS_GOOD; + case OPT_OUTLINE: s->outline = val_c; return SANE_STATUS_GOOD; @@ -5688,6 +5790,11 @@ set_window (struct fujitsu *s) set_WD_bitsperpixel (desc1, s->params.depth); + if(s->mode == MODE_HALFTONE){ + set_WD_ht_type(desc1, s->ht_type); + set_WD_ht_pattern(desc1, s->ht_pattern); + } + set_WD_rif (desc1, s->rif); set_WD_compress_type(desc1, COMP_NONE); diff --git a/backend/fujitsu.h b/backend/fujitsu.h index 17a68a3f8..2a91bfdb3 100644 --- a/backend/fujitsu.h +++ b/backend/fujitsu.h @@ -37,6 +37,8 @@ enum fujitsu_Option /*IPC*/ OPT_RIF, + OPT_HT_TYPE, + OPT_HT_PATTERN, OPT_OUTLINE, OPT_EMPHASIS, OPT_SEPARATION, @@ -354,9 +356,11 @@ struct fujitsu SANE_Range threshold_range; /*ipc group*/ + SANE_String_Const ht_type_list[4]; + SANE_Range ht_pattern_range; SANE_Range emphasis_range; - SANE_String_Const wl_follow_list[5]; - SANE_String_Const ipc_mode_list[5]; + SANE_String_Const wl_follow_list[4]; + SANE_String_Const ipc_mode_list[4]; SANE_Range gamma_curve_range; SANE_Range threshold_curve_range; SANE_Range variance_range; @@ -412,6 +416,8 @@ struct fujitsu /* ipc */ int rif; + int ht_type; + int ht_pattern; int outline; int emphasis; int separation; diff --git a/doc/descriptions/fujitsu.desc b/doc/descriptions/fujitsu.desc index 905505cbd..97f29dbd6 100644 --- a/doc/descriptions/fujitsu.desc +++ b/doc/descriptions/fujitsu.desc @@ -11,9 +11,9 @@ :backend "fujitsu" ; name of backend :url "http://www.thebility.com/fujitsu/" -:version "65" ; version of backend +:version "68" ; version of backend :manpage "sane-fujitsu" ; name of manpage (if it exists) -:comment "Backend re-written for SANE release 1.0.18, see sane-fujitsu manpage" +:comment "Backend updated for SANE release 1.1.0, see sane-fujitsu manpage" :devicetype :scanner ; start of a list of devices.... ; other types: :stillcam, :vidcam, ; :meta, :api diff --git a/doc/sane-fujitsu.man b/doc/sane-fujitsu.man index e19ec284f..bb017c5be 100644 --- a/doc/sane-fujitsu.man +++ b/doc/sane-fujitsu.man @@ -1,4 +1,4 @@ -.TH sane-fujitsu 5 "2008-06-24" "@PACKAGEVERSION@" "SANE Scanner Access Now Easy" +.TH sane-fujitsu 5 "2008-07-03" "@PACKAGEVERSION@" "SANE Scanner Access Now Easy" .IX sane-fujitsu .SH NAME @@ -10,71 +10,21 @@ The library implements a SANE (Scanner Access Now Easy) backend which provides access to most Fujitsu flatbed and ADF scanners. -This document describes the rewritten backend, version 21 and greater. +This document describes backend version 68, which shipped with SANE 1.1.0. -The backend supports lineart, halftone, grayscale, and color -scanning for most USB and SCSI scanners, depending on hardware capabilities. -Most simple scanning related features are exposed. -This version features at least basic support for many more models. -See KNOWN ISSUES. +.SH SUPPORTED HARDWARE +This version has at least basic support for every model which speaks the +Fujitsu SCSI and SCSI-over-USB protocols, with many scanners having nearly +complete support. Specifically, the SCSI M309x and M409x series, the SCSI +fi-series, most of the USB fi-series, and the USB ScanSnap S5xx scanners +are supported. Please see the list at www.sane-project.org for details. -.SH HARDWARE SUPPORT -The following scanners are thought to have at least basic scanning -capability, either because they have been tested with a prior -version, or because documentation indicates they are compatible -with a tested model. -.PP -.RS -.ft CR -.nf -WORKGROUP SIZED SCANNERS: --------------------------------------- -SCSI: SCSI/USB: USB: ------------- ------------ ------------ -M3091DC fi-4120C fi-5110C -M3092DC fi-4220C fi-5110EOX -SP-93GX fi-4120C2 fi-5110EOX2 - fi-4220C2 fi-5110EOXM - fi-5120C S500 - fi-5220C S500M -.fi -.ft R -.RE -.P -.PP -.RS -.ft CR -.nf -DEPARTMENTAL SIZED SCANNERS: --------------------------------------- -SCSI: SCSI/USB: ------------- ------------ -M3093GX/DG fi-4340C -M3096G/GX fi-4530C -M3097G+/DG fi-5530C -fi-4640S -fi-4750C -.fi -.ft R -.RE -.P -.PP -.RS -.ft CR -.nf -PRODUCTION SIZED SCANNERS: --------------------------------------- -SCSI: SCSI/USB: ------------- ------------ -M3099G/GH/GX fi-5650C -M4097D fi-5750C -fi-4750L fi-5900C -fi-4860C -M4099D -.fi -.ft R -.RE -.P +This backend may support other Fujitsu scanners. The best +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 with test results, positive or negative. + +.SH UNSUPPORTED HARDWARE The following scanners are known NOT to work with this backend, either because they have a non-fujitsu chipset, or an unsupported interface type. Some of these scanners may be supported by another @@ -83,39 +33,30 @@ backend. .RS .ft CR .nf -UNSUPPORTED SCANNERS: -------------------------------------- SCSI: SERIAL: USB: ------------ ------------ ------------ -ScanStation M3093E/DE/EX fi-4110EOX2 +ScanStation M3093E/DE/EX fi-4110EOX/2 ScanPartner M3096EX fi-4010CU -SP-Jr M3097E+/DE -SP-10/10C M3099A/EH/EX -SP-15C/300C +SP-Jr M3097E+/DE S300/S300M +SP-10/10C M3099A/EH/EX fi-60F +SP-15C/300C fi-5015C SP-600C/620C .fi .ft R .RE .P -This backend may support scanners not listed here. The best -way to determine level of support is to test the scanner directly. -Fujitsu equipment has historically been good enough to not be -damaged by incorrect commands if the scanner is incompatible. -Please contact the author with test results, positive or negative. .SH OPTIONS -A modest effort has been made to expose the standard options to the API. -This allows a frontend to set scanning region, resolution, bit-depth, -color mode, and enable the automatic document feeder. The fujitsu backend -supports the following basic options for most scanners: +Effort has been made to expose all hardware options, including: .PP -source s +source s .RS Selects the source for the scan. Options may include "Flatbed", "ADF Front", "ADF Back", "ADF Duplex". .RE .PP -mode m +mode m .RS Selects the mode for the scan. Options may include "Lineart", "Halftone", "Gray", and "Color". @@ -139,10 +80,14 @@ Sets paper size. Used by scanner to determine centering of scan coordinates when using ADF and to detect double feed errors. .RE .PP -Other options will be available based on the capabilities of the scanner. -Use 'scanimage --help' to get a list. Be aware that some options may +Other options will be available based on the capabilities of the scanner: +machines with IPC or DTC will have additional enhancement options, those +with CMP will have compression options, those with endorser will have a +group of imprinter options. + +Use 'scanimage --help' to get a list, but be aware that some options may appear only when another option has been set, and that advanced options -may be hidden by the frontend. +may be hidden by some frontend programs. .PP .SH CONFIGURATION FILE The configuration file "fujitsu.conf" is used to tell the backend how to look @@ -214,36 +159,14 @@ enables debugging output to stderr. Valid values are: 35 Useless noise .RE -.SH OLDER VERSIONS -Backend versions prior to this were numbered with a two part version, -or with no version number at all. At the time this version was written, -all older versions were retroactively renumbered, 1.0.2 - 1.0.20. -.PP -The current backend may have lost support for some feature you were using. -The last of the "old" backends, 1.0.20, is still available as source from: -.PP -http://www.thebility.com/fujitsu/ -.PP -If you find that you need to use the older version, please contact the -author, to try and get those features restored to a later version. - .SH KNOWN ISSUES -.PP -.RS -All IPC, imprinter options are disabled. -.br -.br -Most scanner specific 'quirks' are not accounted for, making it possible +- Some scanner specific 'quirks' are not accounted for, making it possible to set some options in ways that the scanner does not support. .br -.br -Some flatbed options are affected by adf settings. -.br -.br -Any model that does not support VPD during inquiry will not function. -.RE +- Any model that does not support VPD during inquiry will not function until +an override is added to the backend. -.SH HISTORY +.SH CREDITS m3091 backend: Frederik Ramm .br m3096g backend: Randolph Bentson @@ -278,7 +201,8 @@ sane(7), sane-scsi(5), sane-usb(5), sane-sp15c(5), -sane-avision(5) +sane-avision(5), +sane-epjitsu(5) .SH AUTHOR m. allan noah: