update fujitsu backend to v 1.0.34

merge-requests/1/head
m. allan noah 2006-07-05 00:42:05 +00:00
rodzic 587c25825c
commit f9927937af
5 zmienionych plików z 207 dodań i 44 usunięć

Wyświetl plik

@ -1,3 +1,10 @@
2006-07-04 m. allan noah <anoah AT pfeiffer DOT edu>
* backend/fujitsu.[ch] backend/fujitsu-scsi.h:
update to v1.0.34, add S500 usb id, get more inq and vpd data,
allow background color setting for some scanners
* doc/descriptions/fujitsu.desc: version number update
2006-07-03 Julien Blache <jb@jblache.org>
* tools/sane-desc.c: Fix a typo in the udev header.

Wyświetl plik

@ -157,11 +157,18 @@ static scsiblk inquiryB = { inquiryC, sizeof (inquiryC) };
#define get_IN_vendor(in, buf) strncpy(buf, (char *)in + 0x08, 0x08)
#define get_IN_product(in, buf) strncpy(buf, (char *)in + 0x10, 0x010)
#define get_IN_version(in, buf) strncpy(buf, (char *)in + 0x20, 0x04)
#define get_IN_raster(in) getnbyte (in+0x2A, 2) /* offset between colors */
#define get_IN_color_offset(in) getnbyte (in+0x2A, 2) /* offset between colors */
/* these two only in some scanners */
#define get_IN_duplex_3091(in) getnbyte (in+0x2D, 1) /* duplex available */
#define get_IN_frontback(in) getnbyte (in+0x2E, 2) /* offset between front and back for duplex */
/* these only in some scanners */
#define get_IN_long_color(in) getbitfield(in+0x2C, 1, 0)
#define get_IN_long_gray(in) getbitfield(in+0x2C, 1, 1)
#define get_IN_duplex_3091(in) getbitfield(in+0x2D, 1, 0)
#define get_IN_bg_front(in) getbitfield(in+0x2D, 1, 2)
#define get_IN_bg_back(in) getbitfield(in+0x2D, 1, 3)
#define get_IN_emulation(in) getbitfield(in+0x2D, 1, 6)
#define get_IN_duplex_offset(in) getnbyte (in+0x2E, 2)
/* the VPD response */
#define get_IN_page_length(in) getnbyte(in + 0x04, 1)
@ -202,7 +209,7 @@ static scsiblk inquiryB = { inquiryC, sizeof (inquiryC) };
/* vendor unique section */
#define get_IN_operator_panel(in) getbitfield(in+0x20, 1, 1)
#define get_IN_barcode(in) getbitfield(in+0x20, 1, 2)
#define get_IN_imprinter(in) getbitfield(in+0x20, 1, 3)
#define get_IN_imprinter(in) getbitfield(in+0x20, 1, 3)
#define get_IN_duplex(in) getbitfield(in+0x20, 1, 4)
#define get_IN_transparency(in) getbitfield(in+0x20, 1, 5)
#define get_IN_flatbed(in) getbitfield(in+0x20, 1, 6)
@ -248,9 +255,17 @@ static scsiblk inquiryB = { inquiryC, sizeof (inquiryC) };
#define get_IN_compression_JPG_EXT(in) getbitfield(in+0x5a, 1, 2)
#define get_IN_compression_JPG_INDEP(in) getbitfield(in+0x5a, 1, 1)
#define get_IN_imprinter2(in) getbitfield(in+0x5c, 1, 7)
#define get_IN_imprinter2_stamp(in) getbitfield(in+0x5c, 1, 6)
#define get_IN_imprinter2_electrical(in) getbitfield(in+0x5c, 1, 5)
#define get_IN_imprinter_mechanical(in) getbitfield(in+0x5c, 1, 7)
#define get_IN_imprinter_stamp(in) getbitfield(in+0x5c, 1, 6)
#define get_IN_imprinter_electrical(in) getbitfield(in+0x5c, 1, 5)
#define get_IN_imprinter_max_id(in) getbitfield(in+0x5c, 0x0f, 0)
#define get_IN_imprinter_size(in) getbitfield(in+0x5d, 3, 0)
#define get_IN_connection(in) getbitfield(in+0x62, 3, 0)
#define get_IN_x_overscan_size(in) getnbyte(in + 0x64, 2)
#define get_IN_y_overscan_size(in) getnbyte(in + 0x66, 2)
/* ==================================================================== */
@ -404,7 +419,6 @@ static scsiblk readB = { readC, sizeof (readC) };
static unsigned char mode_selectC[] =
{ MODE_SELECT, 0x10, 0x00, 0x00, 0x00, 0x00 };
static scsiblk mode_selectB = { mode_selectC, sizeof (mode_selectC) };
#define set_MSEL_xfer_length(sb, val) sb[0x04] = (unsigned char)val
/* combined 4 byte header and 8 byte page
@ -418,9 +432,9 @@ static scsiblk mode_selectB = { mode_selectC, sizeof (mode_selectC) };
* 0x3c = Auto paper size detection
* 0x3d = Lamp light timer set
* 0x3e = Detect job separation sheet
* there is also possibly a 'descriptor block'
* there is also a 'descriptor block'
* and a 'vendor-specific block'
* fujitsu's seem not to use these two
* but fujitsu seems not to use these
*/
static unsigned char mode_select_sleepC[] = {
@ -430,13 +444,8 @@ static unsigned char mode_select_sleepC[] = {
static scsiblk mode_select_sleepB = {
mode_select_sleepC, sizeof (mode_select_sleepC)
};
/* time until the device internal power supply switches to Sleep Mode
* 0 = Default (15 min)
* 1 = 1 min
* 2 = 2 min
* 0x3c ..0xff = 60 min
*/
#define set_MSEL_sleep_mode(sb, val) sb[0x06]=val
/*
static unsigned char mode_select_duplexC[] = {
0x00, 0x00, 0x00, 0x00,
@ -445,12 +454,9 @@ static unsigned char mode_select_duplexC[] = {
static scsiblk mode_select_duplexB = {
mode_select_duplexC, sizeof (mode_select_duplexC)
};
*/
/* adf duplex reading transfer method
* 0 = front side - back side sequential transfer
* 1 = front side - back side alternate transfer
*/
#define set_MSEL_transfer_mode(sb, val) setbitfield(sb + 0x02, 0x01, 0, val)
*/
/*
static unsigned char mode_select_randC[] = {
0x00, 0x00, 0x00, 0x00,
@ -459,15 +465,20 @@ static unsigned char mode_select_randC[] = {
static scsiblk mode_select_randB = {
mode_select_randC, sizeof (mode_select_randC)
};
*/
static unsigned char mode_select_backingC[] = {
static unsigned char mode_select_bgC[] = {
0x00, 0x00, 0x00, 0x00,
0x37, 0x06, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
};
static scsiblk mode_select_backingB = {
mode_select_backingC, sizeof (mode_select_backingC)
static scsiblk mode_select_bgB = {
mode_select_bgC, sizeof (mode_select_bgC)
};
*/
#define set_MSEL_bg_enable(sb, val) setbitfield(sb + 6, 1, 7, val)
#define set_MSEL_bg_front(sb, val) setbitfield(sb + 6, 1, 5, val)
#define set_MSEL_bg_back(sb, val) setbitfield(sb + 6, 1, 4, val)
#define set_MSEL_bg_fb(sb, val) setbitfield(sb + 6, 1, 3, val)
/*
static unsigned char mode_select_dfeedC[] = {
0x00, 0x00, 0x00, 0x00,
@ -477,7 +488,7 @@ static scsiblk mode_select_dfeedB = {
mode_select_dfeedC, sizeof (mode_select_dfeedC)
};
*/
/*byte 0x06 is bitmask controlling monochrome color*/
static unsigned char mode_select_dropoutC[] = {
0x00, 0x00, 0x00, 0x00,
0x39, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
@ -493,7 +504,6 @@ static scsiblk mode_select_dropoutB = {
#define MSEL_dropout_BLUE 11
#define MSEL_dropout_CUSTOM 12
/*bytes 0x06-07 and 0x09 control paper size detection*/
/*
static unsigned char mode_select_autoC[] = {
0x00, 0x00, 0x00, 0x00,
@ -502,6 +512,9 @@ static unsigned char mode_select_autoC[] = {
static scsiblk mode_select_autoB = {
mode_select_autoC, sizeof (mode_select_autoC)
};
*/
/*
static unsigned char mode_select_lampC[] = {
0x00, 0x00, 0x00, 0x00,
0x3D, 0x06, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00

Wyświetl plik

@ -202,6 +202,10 @@
- add 4220C2 usb id
V 1.0.33 2006-06-14, MAN
- add Fi-5900 usb id and init_model section
V 1.0.34 2006-07-04, MAN
- add S500 usb id
- gather more data from inq and vpd
- allow background color setting
SANE FLOW DIAGRAM
@ -289,6 +293,8 @@ static const char color_Red[] = "Red";
static const char color_Green[] = "Green";
static const char color_Blue[] = "Blue";
static const char color_Default[] = "Default";
static const char color_White[] = "White";
static const char color_Black[] = "Black";
/* Also set via config file. */
static int global_buffer_size = 64 * 1024;
@ -502,6 +508,8 @@ find_scanners ()
DBG (15, "find_scanners: looking for 'usb 0x04c5 0x10e7'\n");
sanei_usb_attach_matching_devices("usb 0x04c5 0x10e7", attach_one_usb);
DBG (15, "find_scanners: looking for 'usb 0x04c5 0x10fe'\n");
sanei_usb_attach_matching_devices("usb 0x04c5 0x10fe", attach_one_usb);
}
for (dev = fujitsu_devList; dev; dev=dev->next) {
@ -749,13 +757,26 @@ init_inquire (struct fujitsu *s)
DBG (15, "init_inquire: Found %s scanner %s version %s at %s\n",
s->vendor_name, s->product_name, s->version_name, s->device_name);
/*some scanners (3091/2) list raster offsets here*/
/*some scanners list random data here*/
DBG (15, "inquiry options\n");
s->color_raster_offset = get_IN_raster(buffer);
s->color_raster_offset = get_IN_color_offset(buffer);
DBG (15, " color offset: %d lines\n",s->color_raster_offset);
s->duplex_raster_offset = get_IN_frontback(buffer);
/* FIXME: we dont store all of these? */
DBG (15, " long color scan: %d\n",get_IN_long_color(buffer));
DBG (15, " long gray scan: %d\n",get_IN_long_gray(buffer));
DBG (15, " 3091 duplex: %d\n",get_IN_duplex_3091(buffer));
s->has_bg_front = get_IN_bg_front(buffer);
DBG (15, " background front: %d\n",s->has_bg_front);
s->has_bg_back = get_IN_bg_back(buffer);
DBG (15, " background back: %d\n",s->has_bg_back);
DBG (15, " emulation mode: %d\n",get_IN_emulation(buffer));
s->duplex_raster_offset = get_IN_duplex_offset(buffer);
DBG (15, " duplex offset: %d lines\n",s->duplex_raster_offset);
DBG (10, "init_inquire: finish\n");
@ -770,12 +791,12 @@ static SANE_Status
init_vpd (struct fujitsu *s)
{
SANE_Status ret;
unsigned char buffer[0x64];
unsigned char buffer[0x68];
DBG (10, "init_vpd: start\n");
/* get EVPD */
set_IN_return_size (inquiryB.cmd, 0x64);
set_IN_return_size (inquiryB.cmd, 0x68);
set_IN_evpd (inquiryB.cmd, 1);
set_IN_page_code (inquiryB.cmd, 0xf0);
@ -783,7 +804,7 @@ init_vpd (struct fujitsu *s)
s, 1, 0,
inquiryB.cmd, inquiryB.size,
NULL, 0,
buffer, 0x64
buffer, 0x68
);
/* This scanner supports vital product data.
@ -1012,7 +1033,22 @@ init_vpd (struct fujitsu *s)
s->has_comp_JPG3 = get_IN_compression_JPG_INDEP (buffer);
DBG (15, " compression JPG3: %d\n", s->has_comp_JPG3);
/* FIXME: we dont store these? */
DBG (15, " imprinter mech: %d\n", get_IN_imprinter_mechanical(buffer));
DBG (15, " imprinter stamp: %d\n", get_IN_imprinter_stamp(buffer));
DBG (15, " imprinter elec: %d\n", get_IN_imprinter_electrical(buffer));
DBG (15, " imprinter max id: %d\n", get_IN_imprinter_max_id(buffer));
DBG (15, " imprinter size: %d\n", get_IN_imprinter_size(buffer));
DBG (15, " connection type: %d\n", get_IN_connection(buffer));
s->os_x_basic = get_IN_x_overscan_size(buffer);
DBG (15, " horizontal overscan: %d\n", s->os_x_basic);
s->os_y_basic = get_IN_y_overscan_size(buffer);
DBG (15, " vertical overscan: %d\n", s->os_y_basic);
}
/*FIXME no vendor vpd, set some defaults? */
else{
@ -1754,6 +1790,26 @@ sane_get_option_descriptor (SANE_Handle handle, SANE_Int option)
opt->constraint_type = SANE_CONSTRAINT_NONE;
}
/*background color*/
if(option==OPT_BG_COLOR){
s->bg_color_list[0] = color_Default;
s->bg_color_list[1] = color_White;
s->bg_color_list[2] = color_Black;
s->bg_color_list[3] = NULL;
opt->name = "bgcolor";
opt->title = "Background color";
opt->desc = "Set color of background for scans";
opt->type = SANE_TYPE_STRING;
opt->constraint_type = SANE_CONSTRAINT_STRING_LIST;
opt->constraint.string_list = s->bg_color_list;
opt->size = maxStringSize (opt->constraint.string_list);
if (s->has_bg_front || s->has_bg_back)
opt->cap = SANE_CAP_SOFT_SELECT | SANE_CAP_SOFT_DETECT | SANE_CAP_ADVANCED;
else
opt->cap = SANE_CAP_INACTIVE;
}
/*dropout color*/
if(option==OPT_DROPOUT_COLOR){
s->do_color_list[0] = color_Default;
@ -2251,6 +2307,20 @@ sane_control_option (SANE_Handle handle, SANE_Int option,
return SANE_STATUS_GOOD;
/* Advanced Group */
case OPT_BG_COLOR:
switch (s->bg_color) {
case COLOR_DEFAULT:
strcpy (val, color_Default);
break;
case COLOR_WHITE:
strcpy (val, color_White);
break;
case COLOR_BLACK:
strcpy (val, color_Black);
break;
}
return SANE_STATUS_GOOD;
case OPT_DROPOUT_COLOR:
switch (s->dropout_color) {
case COLOR_DEFAULT:
@ -2566,6 +2636,15 @@ sane_control_option (SANE_Handle handle, SANE_Int option,
return SANE_STATUS_GOOD;
/* Advanced Group */
case OPT_BG_COLOR:
if (!strcmp(val, color_Default))
s->bg_color = COLOR_DEFAULT;
else if (!strcmp(val, color_White))
s->bg_color = COLOR_WHITE;
else if (!strcmp(val, color_Black))
s->bg_color = COLOR_BLACK;
return mode_select_bg(s);
case OPT_DROPOUT_COLOR:
if (!strcmp(val, color_Default))
s->dropout_color = COLOR_DEFAULT;
@ -2725,6 +2804,49 @@ get_hardware_status (struct fujitsu *s)
return ret;
}
static SANE_Status
mode_select_bg (struct fujitsu *s)
{
int ret;
DBG (10, "mode_select_bg: start\n");
set_MSEL_xfer_length (mode_selectB.cmd, mode_select_bgB.size);
/* clear everything for defaults */
if(s->bg_color == COLOR_DEFAULT){
set_MSEL_bg_enable (mode_select_bgB.cmd, 0);
set_MSEL_bg_front (mode_select_bgB.cmd, 0);
set_MSEL_bg_back (mode_select_bgB.cmd, 0);
set_MSEL_bg_fb (mode_select_bgB.cmd, 0);
}
else{
set_MSEL_bg_enable (mode_select_bgB.cmd, 1);
if(s->bg_color == COLOR_BLACK){
set_MSEL_bg_front (mode_select_bgB.cmd, 1);
set_MSEL_bg_back (mode_select_bgB.cmd, 1);
set_MSEL_bg_fb (mode_select_bgB.cmd, 1);
}
else{
set_MSEL_bg_front (mode_select_bgB.cmd, 0);
set_MSEL_bg_back (mode_select_bgB.cmd, 0);
set_MSEL_bg_fb (mode_select_bgB.cmd, 0);
}
}
ret = do_cmd (
s, 1, 0,
mode_selectB.cmd, mode_selectB.size,
mode_select_bgB.cmd, mode_select_bgB.size,
NULL, 0
);
DBG (10, "mode_select_bg: finish\n");
return ret;
}
static SANE_Status
mode_select_dropout (struct fujitsu *s)
{

Wyświetl plik

@ -36,6 +36,7 @@ enum fujitsu_Option
OPT_RIF,
OPT_ADVANCED_GROUP,
OPT_BG_COLOR,
OPT_DROPOUT_COLOR,
OPT_SLEEP_TIME,
OPT_DUPLEX_OFFSET,
@ -92,6 +93,9 @@ struct fujitsu
int color_raster_offset; /* offset between r and b scan line and */
/* between b and g scan line (0 or 4) */
int has_bg_front; /* background color can be changed for f/r */
int has_bg_back;
int duplex_raster_offset; /* offset between front and rear page when */
/* when scanning 3091 style duplex */
@ -191,6 +195,10 @@ struct fujitsu
/*FIXME: barcode data? */
/* overscan size in pixels comes from scanner in basic res units */
int os_x_basic;
int os_y_basic;
/* --------------------------------------------------------------------- */
/* immutable values which are hard coded because they are not in vpd */
/* this section replaces all the old 'switch (s->model)' code */
@ -204,17 +212,23 @@ struct fujitsu
int has_back; /* not all duplex scanners can do adf back side only */
int color_interlace; /* different models interlace colors differently */
int duplex_interlace; /* different models interlace sides differently */
int has_MS_dropout; /* dropout color specified in mode select data */
int has_SW_dropout; /* dropout color specified in set window data */
int window_vid; /* some models want different vendor ID in set window */
int ghs_in_rs;
/*int has_MS_prepick;
int has_MS_sleep;
int has_MS_background;
int has_MS_multifeed;*/
int has_SW_dropout; /* dropout color specified in set window data */
int has_MS_dropout; /* dropout color specified in mode select data */
/*int has_MS_buffered;
int has_MS_paperlen;*/
int reverse_by_mode[6]; /* mode specific */
/* --------------------------------------------------------------------- */
/* changeable SANE_Option structs provide our interface to frontend. */
/* some options require lists of strings or numbers, we keep them here */
/* instead of in global vars so that they can differ for each scanner */
/* these are loaded in init_options(), but may be changed by other funcs */
/* long array of option structs */
SANE_Option_Descriptor opt[NUM_OPTIONS];
@ -244,6 +258,7 @@ struct fujitsu
/*ipc group*/
/*advanced group*/
SANE_String_Const bg_color_list[4];
SANE_String_Const do_color_list[5];
SANE_String_Const lamp_color_list[5];
SANE_Range sleep_time_range;
@ -279,6 +294,7 @@ struct fujitsu
int gamma; /* not currently user settable */
/*advanced group*/
int bg_color;
int dropout_color;
int lamp_color;
int sleep_time;
@ -375,11 +391,14 @@ struct fujitsu
#define MODE_COLOR_HALFTONE WD_comp_CH
#define MODE_COLOR WD_comp_CG
/* these are same as scsi data to make code easier */
#define COLOR_DEFAULT MSEL_dropout_DEFAULT
#define COLOR_RED MSEL_dropout_RED
#define COLOR_GREEN MSEL_dropout_GREEN
#define COLOR_BLUE MSEL_dropout_BLUE
/* these are same as dropout scsi data to make code easier */
#define COLOR_DEFAULT 0
#define COLOR_GREEN 8
#define COLOR_RED 9
#define COLOR_BLUE 11
#define COLOR_WHITE 1
#define COLOR_BLACK 2
#define COLOR_INTERLACE_NONE 0
#define COLOR_INTERLACE_3091 1
@ -496,6 +515,8 @@ static SANE_Status scanner_control (struct fujitsu *s, int function);
static SANE_Status mode_select_dropout(struct fujitsu *s);
static SANE_Status mode_select_bg(struct fujitsu *s);
static SANE_Status set_sleep_mode(struct fujitsu *s);
int get_current_side (struct fujitsu *s);

Wyświetl plik

@ -11,7 +11,7 @@
:backend "fujitsu" ; name of backend
:url "http://www2.pfeiffer.edu/~anoah/fujitsu/"
:version "1.0.33" ; version of backend
:version "1.0.34" ; 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"
:devicetype :scanner ; start of a list of devices....