add X74 support to lexmark backend

- patch from "Torsten Houwaart" <ToHo@gmx.de>
merge-requests/1/head
Stphane Voltz 2010-12-23 16:24:33 +01:00
rodzic 162da73c00
commit 91832dccb3
9 zmienionych plików z 1501 dodań i 483 usunięć

Wyświetl plik

@ -1,3 +1,7 @@
2010-12-24 Stéphane Voltz <stef.dev@free.fr>
* backend/lexmark*.[ch]: applied X74 support patch by Torsten Houwaart
<ToHo@gmx.de>
2010-12-23 Mike Kelly <mike@piratehaven.org> 2010-12-23 Mike Kelly <mike@piratehaven.org>
* backends/avision.[ch]: * backends/avision.[ch]:
- Bumped build number to 293. - Bumped build number to 293.

Wyświetl plik

@ -2,7 +2,8 @@
(C) 2003-2004 Lexmark International, Inc. (Original Source code) (C) 2003-2004 Lexmark International, Inc. (Original Source code)
(C) 2005 Fred Odendaal (C) 2005 Fred Odendaal
(C) 2006-2009 Stéphane Voltz <stef.dev@free.fr> (C) 2006-2010 Stéphane Voltz <stef.dev@free.fr>
(C) 2010 "Torsten Houwaart" <ToHo@gmx.de> X74 support
This file is part of the SANE package. This file is part of the SANE package.
@ -47,7 +48,7 @@
#include "lexmark.h" #include "lexmark.h"
#define LEXMARK_CONFIG_FILE "lexmark.conf" #define LEXMARK_CONFIG_FILE "lexmark.conf"
#define BUILD 21 #define BUILD 30
#define MAX_OPTION_STRING_SIZE 255 #define MAX_OPTION_STRING_SIZE 255
static Lexmark_Device *first_lexmark_device = 0; static Lexmark_Device *first_lexmark_device = 0;
@ -78,6 +79,10 @@ static SANE_Int x1200_dpi_list[] = {
4, 75, 150, 300, 600 4, 75, 150, 300, 600
}; };
static SANE_Int x74_dpi_list[] = {
75, 150, 300, 600
};
static SANE_Range threshold_range = { static SANE_Range threshold_range = {
SANE_FIX (0.0), /* minimum */ SANE_FIX (0.0), /* minimum */
SANE_FIX (100.0), /* maximum */ SANE_FIX (100.0), /* maximum */
@ -103,6 +108,7 @@ static SANE_Range x_range = {
static SANE_Range y_range = { static SANE_Range y_range = {
0, /* minimum */ 0, /* minimum */
6848, /* maximum */ 6848, /* maximum */
/* 7032, for X74 */
8 /* quantization */ 8 /* quantization */
}; };
@ -170,6 +176,9 @@ init_options (Lexmark_Device * dev)
case X1200_USB2_SENSOR: case X1200_USB2_SENSOR:
od->constraint.word_list = x1200_dpi_list; od->constraint.word_list = x1200_dpi_list;
break; break;
case X74_SENSOR:
od->constraint.word_list = x74_dpi_list;
break;
} }
dev->val[OPT_RESOLUTION].w = 75; dev->val[OPT_RESOLUTION].w = 75;
@ -369,7 +378,7 @@ attachLexmark (SANE_String_Const devname)
status = SANE_STATUS_GOOD; status = SANE_STATUS_GOOD;
/* put the id of the model you want to fake here */ /* put the id of the model you want to fake here */
vendor = 0x043d; vendor = 0x043d;
product = 0x007c; /* X11xx */ product = 0x007c; /* X11xx */
variant = 0xb2; variant = 0xb2;
#else #else
variant = 0; variant = 0;
@ -392,10 +401,9 @@ attachLexmark (SANE_String_Const devname)
DBG (2, "attachLexmark: testing device `%s': 0x%04x:0x%04x, variant=%d\n", DBG (2, "attachLexmark: testing device `%s': 0x%04x:0x%04x, variant=%d\n",
devname, vendor, product, variant); devname, vendor, product, variant);
if (sanei_lexmark_low_assign_model (lexmark_device, if (sanei_lexmark_low_assign_model (lexmark_device,
devname, devname,
vendor, vendor,
product, product, variant) != SANE_STATUS_GOOD)
variant) != SANE_STATUS_GOOD)
{ {
DBG (2, "attachLexmark: unsupported device `%s': 0x%04x:0x%04x\n", DBG (2, "attachLexmark: unsupported device `%s': 0x%04x:0x%04x\n",
devname, vendor, product); devname, vendor, product);
@ -444,7 +452,8 @@ sane_init (SANE_Int * version_code, SANE_Auth_Callback authorize)
DBG_INIT (); DBG_INIT ();
DBG (1, "SANE Lexmark backend version %d.%d.%d-devel\n", SANE_CURRENT_MAJOR, V_MINOR, BUILD); DBG (1, "SANE Lexmark backend version %d.%d.%d-devel\n", SANE_CURRENT_MAJOR,
V_MINOR, BUILD);
auth_callback = authorize; auth_callback = authorize;
@ -1106,18 +1115,19 @@ sane_start (SANE_Handle handle)
/* We may have been rewound too far, so move forward the distance from /* We may have been rewound too far, so move forward the distance from
the edge to the home position */ the edge to the home position */
sanei_lexmark_low_move_fwd (0x01a8, lexmark_device, sanei_lexmark_low_move_fwd (0x01a8, lexmark_device,
lexmark_device->shadow_regs); lexmark_device->shadow_regs);
/* Scan backwards until we find home */ /* Scan backwards until we find home */
sanei_lexmark_low_search_home_bwd (lexmark_device); sanei_lexmark_low_search_home_bwd (lexmark_device);
} }
/* do calibration before offset detection , use sensor max dpi, not motor's one */ /* do calibration before offset detection , use sensor max dpi, not motor's one */
resolution = lexmark_device->val[OPT_RESOLUTION].w; resolution = lexmark_device->val[OPT_RESOLUTION].w;
if(resolution > 600) if (resolution > 600)
{ {
resolution = 600; resolution = 600;
} }
sanei_lexmark_low_set_scan_regs (lexmark_device, resolution, 0, SANE_FALSE); sanei_lexmark_low_set_scan_regs (lexmark_device, resolution, 0, SANE_FALSE);
status = sanei_lexmark_low_calibration (lexmark_device); status = sanei_lexmark_low_calibration (lexmark_device);
if (status != SANE_STATUS_GOOD) if (status != SANE_STATUS_GOOD)
@ -1138,8 +1148,10 @@ sane_start (SANE_Handle handle)
/* Set the shadow registers for scan with the options (resolution, mode, /* Set the shadow registers for scan with the options (resolution, mode,
size) set in the front end. Pass the offset so we can get the vert. size) set in the front end. Pass the offset so we can get the vert.
start. */ start. */
sanei_lexmark_low_set_scan_regs (lexmark_device, lexmark_device->val[OPT_RESOLUTION].w, offset, SANE_TRUE); sanei_lexmark_low_set_scan_regs (lexmark_device,
lexmark_device->val[OPT_RESOLUTION].w,
offset, SANE_TRUE);
if (sanei_lexmark_low_start_scan (lexmark_device) == SANE_STATUS_GOOD) if (sanei_lexmark_low_start_scan (lexmark_device) == SANE_STATUS_GOOD)
{ {
DBG (2, "sane_start: scan started\n"); DBG (2, "sane_start: scan started\n");
@ -1202,7 +1214,7 @@ sane_read (SANE_Handle handle, SANE_Byte * data,
return SANE_STATUS_INVAL; return SANE_STATUS_INVAL;
bytes_read = sanei_lexmark_low_read_scan_data (data, max_length, bytes_read = sanei_lexmark_low_read_scan_data (data, max_length,
lexmark_device); lexmark_device);
if (bytes_read < 0) if (bytes_read < 0)
return SANE_STATUS_IO_ERROR; return SANE_STATUS_IO_ERROR;
else if (bytes_read == 0) else if (bytes_read == 0)

Wyświetl plik

@ -4,3 +4,5 @@ usb 0x043d 0x007c
usb 0x043d 0x007d usb 0x043d 0x007d
# Dell A920 # Dell A920
usb 0x413c 0x5105 usb 0x413c 0x5105
# X74
usb 0x43d 0x0060

Wyświetl plik

@ -1,8 +1,9 @@
/************************************************************************** /************************************************************************
lexmark.h - SANE library for Lexmark scanners. lexmark.h - SANE library for Lexmark scanners.
Copyright (C) 2003-2004 Lexmark International, Inc. (original source) Copyright (C) 2003-2004 Lexmark International, Inc. (original source)
Copyright (C) 2005 Fred Odendaal Copyright (C) 2005 Fred Odendaal
Copyright (C) 2006-2009 Stéphane Voltz <stef.dev@free.fr> Copyright (C) 2006-2010 Stéphane Voltz <stef.dev@free.fr>
Copyright (C) 2010 "Torsten Houwaart" <ToHo@gmx.de> X74 support
This file is part of the SANE package. This file is part of the SANE package.
@ -109,6 +110,8 @@ typedef struct Lexmark_Model
SANE_String_Const model; SANE_String_Const model;
SANE_Int motor_type; SANE_Int motor_type;
SANE_Int sensor_type; SANE_Int sensor_type;
SANE_Int HomeEdgePoint1;
SANE_Int HomeEdgePoint2;
} Lexmark_Model; } Lexmark_Model;
/* /*
@ -118,7 +121,7 @@ typedef struct Lexmark_Sensor
{ {
SANE_Int id; SANE_Int id;
SANE_Int offset_startx; /* starting x for offset calibration */ SANE_Int offset_startx; /* starting x for offset calibration */
SANE_Int offset_endx; /* end x for offset calibration */ SANE_Int offset_endx; /* end x for offset calibration */
SANE_Int offset_threshold; /* target threshold for offset calibration */ SANE_Int offset_threshold; /* target threshold for offset calibration */
SANE_Int xoffset; /* number of unusable pixels on the start of the sensor */ SANE_Int xoffset; /* number of unusable pixels on the start of the sensor */
SANE_Int default_gain; /* value of the default gain for a scan */ SANE_Int default_gain; /* value of the default gain for a scan */
@ -130,8 +133,8 @@ typedef struct Lexmark_Sensor
SANE_Int green_shading_target; SANE_Int green_shading_target;
SANE_Int blue_shading_target; SANE_Int blue_shading_target;
SANE_Int gray_shading_target; SANE_Int gray_shading_target;
SANE_Int offset_fallback; /* offset to use in case offset calibration fails */ SANE_Int offset_fallback; /* offset to use in case offset calibration fails */
SANE_Int gain_fallback; /* gain to use in case offset calibration fails */ SANE_Int gain_fallback; /* gain to use in case offset calibration fails */
} Lexmark_Sensor; } Lexmark_Sensor;
typedef enum typedef enum
@ -233,12 +236,14 @@ Lexmark_Device;
/* motors and sensors type defines */ /* motors and sensors type defines */
#define X1100_MOTOR 1 #define X1100_MOTOR 1
#define A920_MOTOR 2 #define A920_MOTOR 2
#define X74_MOTOR 3
#define X1100_B2_SENSOR 3 #define X1100_B2_SENSOR 4
#define A920_SENSOR 4 #define A920_SENSOR 5
#define X1100_2C_SENSOR 5 #define X1100_2C_SENSOR 6
#define X1200_SENSOR 6 /* X1200 on USB 1.0 */ #define X1200_SENSOR 7 /* X1200 on USB 1.0 */
#define X1200_USB2_SENSOR 7 /* X1200 on USB 2.0 */ #define X1200_USB2_SENSOR 8 /* X1200 on USB 2.0 */
#define X74_SENSOR 9
/* Non-static Function Proto-types (called by lexmark.c) */ /* Non-static Function Proto-types (called by lexmark.c) */
SANE_Status sanei_lexmark_low_init (Lexmark_Device * dev); SANE_Status sanei_lexmark_low_init (Lexmark_Device * dev);
@ -247,20 +252,22 @@ SANE_Status sanei_lexmark_low_open_device (Lexmark_Device * dev);
void sanei_lexmark_low_close_device (Lexmark_Device * dev); void sanei_lexmark_low_close_device (Lexmark_Device * dev);
SANE_Bool sanei_lexmark_low_search_home_fwd (Lexmark_Device * dev); SANE_Bool sanei_lexmark_low_search_home_fwd (Lexmark_Device * dev);
void sanei_lexmark_low_move_fwd (SANE_Int distance, Lexmark_Device * dev, void sanei_lexmark_low_move_fwd (SANE_Int distance, Lexmark_Device * dev,
SANE_Byte * regs); SANE_Byte * regs);
SANE_Bool sanei_lexmark_low_X74_search_home (Lexmark_Device * dev,
SANE_Byte * regs);
SANE_Bool sanei_lexmark_low_search_home_bwd (Lexmark_Device * dev); SANE_Bool sanei_lexmark_low_search_home_bwd (Lexmark_Device * dev);
SANE_Int sanei_lexmark_low_find_start_line (Lexmark_Device * dev); SANE_Int sanei_lexmark_low_find_start_line (Lexmark_Device * dev);
SANE_Status sanei_lexmark_low_set_scan_regs (Lexmark_Device * dev, SANE_Status sanei_lexmark_low_set_scan_regs (Lexmark_Device * dev,
SANE_Int resolution, SANE_Int resolution,
SANE_Int offset, SANE_Int offset,
SANE_Bool calibrated); SANE_Bool calibrated);
SANE_Status sanei_lexmark_low_start_scan (Lexmark_Device * dev); SANE_Status sanei_lexmark_low_start_scan (Lexmark_Device * dev);
long sanei_lexmark_low_read_scan_data (SANE_Byte * data, SANE_Int size, long sanei_lexmark_low_read_scan_data (SANE_Byte * data, SANE_Int size,
Lexmark_Device * dev); Lexmark_Device * dev);
SANE_Status sanei_lexmark_low_assign_model (Lexmark_Device * dev, SANE_Status sanei_lexmark_low_assign_model (Lexmark_Device * dev,
SANE_String_Const devname, SANE_Int vendor, SANE_String_Const devname,
SANE_Int product, SANE_Int vendor, SANE_Int product,
SANE_Byte mainboard); SANE_Byte mainboard);
/* /*
* scanner calibration functions * scanner calibration functions

Plik diff jest za duży Load Diff

Wyświetl plik

@ -1,6 +1,7 @@
/* sane - Scanner Access Now Easy. /* sane - Scanner Access Now Easy.
Copyright (C) 2006-2007 Stéphane Voltz <stef.dev@free.fr> Copyright (C) 2006-2010 Stéphane Voltz <stef.dev@free.fr>
Copyright (C) 2010 "Torsten Houwaart" <ToHo@gmx.de> X74 support
This file is part of the SANE package. This file is part of the SANE package.
@ -49,8 +50,10 @@ static Lexmark_Model model_list[] = {
"Lexmark X1100", /* name */ "Lexmark X1100", /* name */
"Lexmark", /* vendor */ "Lexmark", /* vendor */
"X1100/rev. B2", /* model */ "X1100/rev. B2", /* model */
X1100_MOTOR, /* X1100 series has 2 sensors */ /* X1100 series has 2 sensors */
X1100_B2_SENSOR}, X1100_B2_SENSOR,
1235, /* first x-coordinate of Home Point */
1258}, /* second x-coordinate of Home Point */
{ {
0x043d, /* vendor id */ 0x043d, /* vendor id */
0x007c, /* product id */ 0x007c, /* product id */
@ -60,7 +63,9 @@ static Lexmark_Model model_list[] = {
"X1100/rev. 2C", /* model */ "X1100/rev. 2C", /* model */
A920_MOTOR, /* X1100 series has 2 sensors, 2C or B2. It A920_MOTOR, /* X1100 series has 2 sensors, 2C or B2. It
is detected at sane_open() */ is detected at sane_open() */
X1100_2C_SENSOR}, X1100_2C_SENSOR,
1235, /* first x-coordinate of Home Point */
1258}, /* second x-coordinate of Home Point */
{ {
0x413c, /* vendor id */ 0x413c, /* vendor id */
0x5105, /* product id */ 0x5105, /* product id */
@ -69,7 +74,9 @@ static Lexmark_Model model_list[] = {
"Dell", /* vendor */ "Dell", /* vendor */
"A920", /* model */ "A920", /* model */
A920_MOTOR, A920_MOTOR,
A920_SENSOR}, A920_SENSOR,
1235, /* first x-coordinate of Home Point */
1258}, /* second x-coordinate of Home Point */
{ {
0x043d, /* vendor id */ 0x043d, /* vendor id */
0x007d, /* product id */ 0x007d, /* product id */
@ -78,7 +85,9 @@ static Lexmark_Model model_list[] = {
"Lexmark", /* vendor */ "Lexmark", /* vendor */
"X1200/USB1.1", /* model */ "X1200/USB1.1", /* model */
A920_MOTOR, A920_MOTOR,
X1200_SENSOR}, X1200_SENSOR,
1235, /* first x-coordinate of Home Point */
1258}, /* second x-coordinate of Home Point */
{ {
0x043d, /* vendor id */ 0x043d, /* vendor id */
0x007d, /* product id */ 0x007d, /* product id */
@ -87,7 +96,20 @@ static Lexmark_Model model_list[] = {
"Lexmark", /* vendor */ "Lexmark", /* vendor */
"X1200/USB2.0", /* model */ "X1200/USB2.0", /* model */
A920_MOTOR, A920_MOTOR,
X1200_USB2_SENSOR}, X1200_USB2_SENSOR,
1235, /* first x-coordinate of Home Point */
1258}, /* second x-coordinate of Home Point */
{
0x043d, /* vendor id */
0x0060, /* product id */
0x00, /* submodel id */
"Lexmark X74", /* name */
"Lexmark", /* vendor */
"X74", /* model */
X74_MOTOR,
X74_SENSOR,
1222, /* first x-coordinate of Home Point */
1322}, /* second x-coordinate of Home Point */
{ /* termination model, must be last */ { /* termination model, must be last */
0, 0, 0, NULL, NULL, NULL, 0, 0} 0, 0, 0, NULL, NULL, NULL, 0, 0, 0, 0}
}; /* end models description */ }; /* end models description */

Wyświetl plik

@ -1,6 +1,7 @@
/* sane - Scanner Access Now Easy. /* sane - Scanner Access Now Easy.
Copyright (C) 2006-2007 Stéphane Voltz <stef.dev@free.fr> Copyright (C) 2006-2010 Stéphane Voltz <stef.dev@free.fr>
Copyright (C) 2010 "Torsten Houwaart" <ToHo@gmx.de> X74 support
This file is part of the SANE package. This file is part of the SANE package.
@ -45,7 +46,7 @@ static Lexmark_Sensor sensor_list[] = {
{ {
X1100_B2_SENSOR, X1100_B2_SENSOR,
/* start x, end x and target average for offset calibration */ /* start x, end x and target average for offset calibration */
48,80,6, 48, 80, 6,
/* usable pixel sensor startx */ /* usable pixel sensor startx */
106, 106,
/* default gain */ /* default gain */
@ -55,12 +56,11 @@ static Lexmark_Sensor sensor_list[] = {
/* shading correction targets */ /* shading correction targets */
260, 260, 260, 260, 260, 260, 260, 260,
/* offset and gain fallback */ /* offset and gain fallback */
0x70, 17 0x70, 17},
},
{ {
X1100_2C_SENSOR, X1100_2C_SENSOR,
/* start x, end x and target average for offset calibration */ /* start x, end x and target average for offset calibration */
48,80,12, 48, 80, 12,
/* usable pixel sensor startx */ /* usable pixel sensor startx */
106, 106,
/* default gain */ /* default gain */
@ -70,12 +70,11 @@ static Lexmark_Sensor sensor_list[] = {
/* shading correction */ /* shading correction */
260, 260, 260, 260, 260, 260, 260, 260,
/* offset and gain fallback */ /* offset and gain fallback */
0x70, 11 0x70, 11},
}, { /* USB 1.1 settings */
{ /* USB 1.1 settings */
X1200_SENSOR, X1200_SENSOR,
/* start x, end x and target average for offset calibration */ /* start x, end x and target average for offset calibration */
32,64,15, 32, 64, 15,
/* usable pixel sensor startx */ /* usable pixel sensor startx */
136, 136,
/* default gain */ /* default gain */
@ -85,12 +84,11 @@ static Lexmark_Sensor sensor_list[] = {
/* shading correction */ /* shading correction */
260, 260, 260, 260, 260, 260, 260, 260,
/* offset and gain fallback */ /* offset and gain fallback */
0x86, 16 0x86, 16},
}, { /* this one is a 1200 on USB2.0 */
{ /* this one is a 1200 on USB2.0 */
X1200_USB2_SENSOR, X1200_USB2_SENSOR,
/* start x, end x and target average for offset calibration */ /* start x, end x and target average for offset calibration */
32,64,12, 32, 64, 12,
/* usable pixel sensor startx */ /* usable pixel sensor startx */
136, 136,
/* default gain */ /* default gain */
@ -100,12 +98,11 @@ static Lexmark_Sensor sensor_list[] = {
/* shading correction */ /* shading correction */
260, 260, 260, 260, 260, 260, 260, 260,
/* offset and gain fallback */ /* offset and gain fallback */
0x86, 16 0x86, 16},
},
{ {
A920_SENSOR, A920_SENSOR,
/* start x, end x and target average for offset calibration */ /* start x, end x and target average for offset calibration */
48,80,6, 48, 80, 6,
/* usable pixel sensor startx */ /* usable pixel sensor startx */
106, 106,
/* default gain */ /* default gain */
@ -115,8 +112,23 @@ static Lexmark_Sensor sensor_list[] = {
/* gain calibration target */ /* gain calibration target */
260, 260, 260, 260, 260, 260, 260, 260,
/* offset and gain fallback */ /* offset and gain fallback */
0x70, 13 0x70, 13},
}, {
X74_SENSOR,
/* start x TDONE, end x and target average for offset calibration */
/*36,68,12, */
20, 52, 12,
/* usable pixel sensor startx */
/*104, */
104,
/* default gain */
10,
/* gain calibration target */
130, 145, 150, 145,
/* gain calibration target */
260, 260, 260, 260,
/* offset and gain fallback */
0x70, 13},
/* termination list sensor, must be last */ /* termination list sensor, must be last */
{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}
}; };

Wyświetl plik

@ -69,6 +69,12 @@
:usbid "0x043d" "0x007c" :usbid "0x043d" "0x007c"
:status :untested :status :untested
:model "X74"
:interface "USB"
:usbid "0x043d" "0x0060"
:status :good
:comment "Supports 75, 150, 300, 600 dpi"
:model "X12xx" :model "X12xx"
:interface "USB" :interface "USB"
:usbid "0x043d" "0x007d" :usbid "0x043d" "0x007d"

Wyświetl plik

@ -18,6 +18,7 @@ The scanners that should work with this backend are:
.nf .nf
Vendor Model status Vendor Model status
\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\- \-\-\-\-\-\-\-\-\-\-\- \-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\- \-\-\-\-\-\-\-\-\-\-\-
Lexmark X74 good
Lexmark X1110 untested Lexmark X1110 untested
Lexmark X1140 untested Lexmark X1140 untested
Lexmark X1150 good Lexmark X1150 good
@ -140,6 +141,8 @@ The backend was originaly written by Fred Odendaal.
.TP .TP
The new version is currently developped by St\['e]phane Voltz. The new version is currently developped by St\['e]phane Voltz.
.I http://stef.dev.free.fr/sane/lexmark .I http://stef.dev.free.fr/sane/lexmark
.TP
X74 support was written by Torsten Houwaart (<ToHo@gmx.de>)
.SH "CREDITS" .SH "CREDITS"
.TP .TP
Many thanks go to: Many thanks go to: