Applied Henning's patch, Fixed some compiler warnings.

merge-requests/1/head
Karl Heinz Kremer 2006-06-11 19:46:09 +00:00
rodzic 1dbe87750e
commit 3d057d04c6
6 zmienionych plików z 137 dodań i 22 usunięć

Wyświetl plik

@ -1,3 +1,31 @@
2006-06-11 Henning Meier-Geinitz <henning@meier-geinitz.de>
(patch applied by Karl Heinz Kremer <khk@khk.net>
* doc/descriptions/epson.desc: Added CX-4800. Added Perfection
4990 (bug #301795).
* backend/epson_usb.c: Added CX-4800 (bug #303341).
* backend/epson.c: Fixed segfault when a scanner isn't
recognized. Added "Flatbed" as the only possible source option for
MOD_SOURCE in this case (bug #303340).
Epson CX4800 and CX6400 were detected as "unknown model". This
changes request_identity2 to 0 in the EpsonCmdRec for the "D7"
level, which skips the call to get_identity2_information(). The
second bug was that the return status of
get_identity2_information() was not checked in attach(). This
actually allowed the scanner to be used but with inaccurate
parameters (e.g. "Unknown model", default color depth, etc)
because the scanner was already closed before probing for the rest
of the parameters (bug #301478, #303342).
The Epson Perfection 4990 photo/GT-X800 wrongly return 3200 dpi as
their maximum resolution. This workaround enables teh full 4800
dpi (bug #302090, patch from Claus Boje <claus@egehuset.dk>).
* backend/epson.conf.in: Detect some more epson SCSI scanners
(GT-6000, GT-9000) which report "EPSON SC" instead of "EPSON" as
SCSI manufacturer ID (bug #303269).
* sanei/sanei_pio.c: Don't do a busy loop when looking for
scanners. This froze the backend when the scanner was switched
off. Also CPU time is much reduced (bug #301926).
2006-06-11 Gerard Klaver <gerard at gkall dot hobby dot nl> 2006-06-11 Gerard Klaver <gerard at gkall dot hobby dot nl>
* include/Makefile.in font_6x11.h added * include/Makefile.in font_6x11.h added

Wyświetl plik

@ -14,10 +14,11 @@
Copyright (C) 2000 Mike Porter <mike@udel.edu> (mjp) Copyright (C) 2000 Mike Porter <mike@udel.edu> (mjp)
Copyright (C) 2003 EPSON KOWA Corporation Copyright (C) 2003 EPSON KOWA Corporation
Copyright (C) 1999-2005 Karl Heinz Kremer <khk@khk.net> Copyright (C) 1999-2005 Karl Heinz Kremer <khk@khk.net>
Copyright (C) 2006 Claus Boje <claus@egehuset.dk>
*/ */
#define SANE_EPSON_VERSION "SANE Epson Backend v0.2.45 - 2000-01-09" #define SANE_EPSON_VERSION "SANE Epson Backend v0.2.46 - 2006-06-11"
#define SANE_EPSON_BUILD 245 #define SANE_EPSON_BUILD 246
/* /*
This file is part of the SANE package. This file is part of the SANE package.
@ -59,6 +60,8 @@
If you do not wish that, delete this exception notice. */ If you do not wish that, delete this exception notice. */
/* /*
2006-06-11 Applied patch from Henning. Fixed a number of compiler warnings
2006-03-12 Added support for perfetion 4990 photo 4800 dpi
2005-01-09 "flaming hack to get USB scanners working without timeouts under linux" 2005-01-09 "flaming hack to get USB scanners working without timeouts under linux"
submitted by "Steve" (in comment to bug #300830) submitted by "Steve" (in comment to bug #300830)
2004-12-18 Added USB IDs for CX-4600 and CX-3650 2004-12-18 Added USB IDs for CX-4600 and CX-3650
@ -453,7 +456,7 @@ static EpsonCmdRec 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, 0, 'p','q'}, {"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, 0, 'p','q'},
{"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}, {"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},
{"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, 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, 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', 0, 0, 0, '!', 0, 0, 0, 0, 0, 0, 0}, {"D7", 'I', 0, '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, 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', 0, 0, '!', 0, 0, 0, 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', 0, 0, '!', 0, 0, 0, 0, 0, 0, 0},
}; };
@ -2080,13 +2083,13 @@ attach (const char *dev_name, Epson_Device * *devp, int type)
*/ */
if (buf[0] != TYPE_PROCESSOR if (buf[0] != TYPE_PROCESSOR
|| strncmp (buf + 8, "EPSON", 5) != 0 || strncmp ((char *) (buf + 8), "EPSON", 5) != 0
|| (strncmp (buf + 16, "SCANNER ", 8) != 0 || (strncmp ((char *) buf + 16, "SCANNER ", 8) != 0
&& strncmp (buf + 14, "SCANNER ", 8) != 0 && strncmp ((char *) buf + 14, "SCANNER ", 8) != 0
&& strncmp (buf + 14, "Perfection", 10) != 0 && strncmp ((char *) buf + 14, "Perfection", 10) != 0
&& strncmp (buf + 16, "Perfection", 10) != 0 && strncmp ((char *) buf + 16, "Perfection", 10) != 0
&& strncmp (buf + 16, "Expression", 10) != 0 && strncmp ((char *) buf + 16, "Expression", 10) != 0
&& strncmp (buf + 16, "GT", 2) != 0)) && strncmp ((char *) buf + 16, "GT", 2) != 0))
{ {
DBG (1, "attach: device doesn't look like an EPSON scanner\n"); DBG (1, "attach: device doesn't look like an EPSON scanner\n");
close_scanner (s); close_scanner (s);
@ -2219,7 +2222,7 @@ attach (const char *dev_name, Epson_Device * *devp, int type)
if (s->hw->cmd->request_identity2 != 0) if (s->hw->cmd->request_identity2 != 0)
{ {
get_identity2_information (s); status = get_identity2_information (s);
if (status != SANE_STATUS_GOOD) if (status != SANE_STATUS_GOOD)
return status; return status;
} /* request identity 2 */ } /* request identity 2 */
@ -2354,6 +2357,7 @@ attach (const char *dev_name, Epson_Device * *devp, int type)
{ {
DBG (1, "Extended status flag request failed\n"); DBG (1, "Extended status flag request failed\n");
dev->sane.model = strdup ("Unknown model"); dev->sane.model = strdup ("Unknown model");
*source_list_add++ = FBF_STR;
} }
else else
{ {
@ -2478,6 +2482,21 @@ attach (const char *dev_name, Epson_Device * *devp, int type)
SANE_FIX ((buf[10] << 8 | buf[9]) * 25.4 / dev->dpi_range.max); SANE_FIX ((buf[10] << 8 | buf[9]) * 25.4 / dev->dpi_range.max);
dev->tpu_y_range.quant = 0; dev->tpu_y_range.quant = 0;
/*
* Check for Perfection 4990 photo/GT-X800 scanner.
* This scanner only report 3200 dpi back.
* The scanner fysical supports 4800 dpi.
* This is simulated here...
* Futher details read:
* EPSON Programming guide for EPSON Color Image Scanner Perfection 4990
*/
if (strncmp((char *) buf + 0x1A,"GT-X800",7) == 0)
{
dev->tpu_x_range.max = (dev->tpu_x_range.max/32)*48;
dev->tpu_y_range.max = (dev->tpu_y_range.max/32)*48;
DBG (5, "dpi_range.max %x \n", dev->dpi_range.max);
}
DBG (5, "tpu tlx %f tly %f brx %f bry %f [mm]\n", DBG (5, "tpu tlx %f tly %f brx %f bry %f [mm]\n",
SANE_UNFIX (dev->tpu_x_range.min), SANE_UNFIX (dev->tpu_x_range.min),
SANE_UNFIX (dev->tpu_y_range.min), SANE_UNFIX (dev->tpu_y_range.min),
@ -4944,7 +4963,7 @@ sane_start (SANE_Handle handle)
len = result[3] << 8 | result[2]; len = result[3] << 8 | result[2];
buf = alloca (len); buf = alloca (len);
receive (s, buf, len, &status); /* reveive actual status data */ receive (s, buf, len, &status); /* receive actual status data */
if (buf[0] & 0x80) if (buf[0] & 0x80)
{ {
@ -5949,7 +5968,6 @@ get_identity_information (SANE_Handle handle)
/* we need to correct for the difference in size between /* we need to correct for the difference in size between
the EpsonIdentRec and the EpsonHdrRec */ the EpsonIdentRec and the EpsonHdrRec */
int correction = sizeof (EpsonIdentRec) - sizeof (EpsonHdrRec); int correction = sizeof (EpsonIdentRec) - sizeof (EpsonHdrRec);
for (n = (count - correction), buf = ident->buf; n; n -= k, buf += k) for (n = (count - correction), buf = ident->buf; n; n -= k, buf += k)
{ {
switch (*buf) switch (*buf)
@ -5982,6 +6000,53 @@ get_identity_information (SANE_Handle handle)
DBG (1, "maximum scan area: x %d y %d\n", x, y); DBG (1, "maximum scan area: x %d y %d\n", x, y);
k = 5; k = 5;
/*
* Check for Perfection 4990 photo/GT-X800 scanner.
* This scanner only report 3200 dpi back.
* The scanner fysical supports 4800 dpi.
* This is simulated here...
* Futher details read:
* EPSON Programming guide for EPSON Color Image Scanner Perfection 4990
*/
if (s->hw->cmd->request_extended_status != 0)
{
u_char *buf;
u_char params[2];
EpsonHdr head;
params[0] = ESC;
params[1] = s->hw->cmd->request_extended_status;
if (NULL != (head = (EpsonHdr) command (s, params, 2, &status)))
{
buf = &head->buf[0x1A];
DBG (1, "product name %x %x %x %x %x %x %x %x \n", buf[0], buf[1],buf[2],buf[3],buf[4], buf[5],buf[6], buf[7] );
if (strncmp((char *) buf,"GT-X800",7) == 0)
{
int val = 0x12 << 8 | 0xC0;
s->hw->res_list_size++;
s->hw->res_list =
(SANE_Int *) realloc (s->hw->res_list,
s->hw->res_list_size * sizeof (SANE_Int));
if (NULL == s->hw->res_list)
{
DBG (1, "out of memory (line %d)\n", __LINE__);
return SANE_STATUS_NO_MEM;
}
s->hw->res_list[s->hw->res_list_size - 1] = (SANE_Int) val;
x = (x/32)*48;
y = (y/32)*48;
DBG (1, "resolution (dpi): %d\n", val);
DBG (1, "maximum scan area GT-X800: x %d y %d\n", x, y);
}
}
}
continue; continue;
} }
default: default:

Wyświetl plik

@ -4,8 +4,8 @@
# #
# SCSI scanner: # SCSI scanner:
scsi EPSON scsi EPSON
# for the GT-6500, comment out the previous line and uncomment the following line: # for the GT-6500:
#scsi scsi "EPSON SC"
# #
# Parallel port scanner: # Parallel port scanner:
#pio 0x278 #pio 0x278

Wyświetl plik

@ -37,6 +37,7 @@ SANE_Word sanei_epson_usb_product_ids[] = {
0x811, /* PM-A870 / Stylus Photo RX620/RX630 */ 0x811, /* PM-A870 / Stylus Photo RX620/RX630 */
0x814, /* PM-A700 */ 0x814, /* PM-A700 */
0x815, /* LP-A500 / AcuLaser CX11 */ 0x815, /* LP-A500 / AcuLaser CX11 */
0x819, /* CX4800 */
0x820, /* CX4200 */ 0x820, /* CX4200 */
0 /* last entry - this is used for devices that are specified 0 /* last entry - this is used for devices that are specified
in the config file as "usb <vendor> <product>" */ in the config file as "usb <vendor> <product>" */

Wyświetl plik

@ -151,6 +151,12 @@
:usbid "0x04b8" "0x0128" :usbid "0x04b8" "0x0128"
:status :complete :status :complete
:model "Perfection 4990"
:comment "US version of the GT-X800"
:interface "USB"
:usbid "0x04b8" "0x012a"
:status :complete
:model "Expression 636" :model "Expression 636"
:comment "US version of GT-9500" :comment "US version of GT-9500"
:interface "SCSI" :interface "SCSI"
@ -196,6 +202,11 @@
:usbid "0x04b8" "0x080d" :usbid "0x04b8" "0x080d"
:status :good :status :good
:model "CX-4800"
:interface "USB"
:usbid "0x04b8" "0x0819"
:status :good
:model "CX-5200" :model "CX-5200"
:interface "USB" :interface "USB"
:usbid "0x04b8" "0x0801" :usbid "0x04b8" "0x0801"

Wyświetl plik

@ -101,6 +101,7 @@ inb (u_long port)
#include <sys/types.h> #include <sys/types.h>
#include <sys/wait.h> #include <sys/wait.h>
#include <unistd.h> #include <unistd.h>
#include <time.h>
#include "sane/saneopts.h" #include "sane/saneopts.h"
@ -145,7 +146,7 @@ typedef struct
{ {
u_long base; /* i/o base address */ u_long base; /* i/o base address */
int fd; /* >= 0 when using /dev/port */ int fd; /* >= 0 when using /dev/port */
int max_polls; /* forever if <= 0 */ int max_time_seconds;/* forever if <= 0 */
u_int in_use; /* port in use? */ u_int in_use; /* port in use? */
} }
PortRec, *Port; PortRec, *Port;
@ -204,7 +205,9 @@ pio_inb (const Port port, u_char * val, u_long addr)
static inline int static inline int
pio_wait (const Port port, u_char val, u_char mask) pio_wait (const Port port, u_char val, u_char mask)
{ {
int n, stat = 0; int stat = 0;
long poll_count = 0;
time_t start = time(NULL);
DBG (DL60, "wait on port 0x%03lx for %02x mask %02x\n", DBG (DL60, "wait on port 0x%03lx for %02x mask %02x\n",
port->base, (int) val, (int) mask); port->base, (int) val, (int) mask);
@ -213,21 +216,28 @@ pio_wait (const Port port, u_char val, u_char mask)
DBG (DL61, " NACKNLG %s\n", DBG (DL61, " NACKNLG %s\n",
(mask & PIO_STAT_NACKNLG) ? (val & PIO_STAT_NACKNLG ? "on" : "off") (mask & PIO_STAT_NACKNLG) ? (val & PIO_STAT_NACKNLG ? "on" : "off")
: "-"); : "-");
for (;;)
for (n = 1; (port->max_polls <= 0) || (n <= port->max_polls); n++)
{ {
++poll_count;
stat = inb (port->base + PIO_STAT); stat = inb (port->base + PIO_STAT);
if ((stat & mask) == (val & mask)) if ((stat & mask) == (val & mask))
{ {
DBG (DL60, "got %02x after %d tries\n", stat, n); DBG (DL60, "got %02x after %ld tries\n", stat, poll_count);
DBG (DL61, " BUSY %s\n", stat & PIO_STAT_BUSY ? "on" : "off"); DBG (DL61, " BUSY %s\n", stat & PIO_STAT_BUSY ? "on" : "off");
DBG (DL61, " NACKNLG %s\n", DBG (DL61, " NACKNLG %s\n",
stat & PIO_STAT_NACKNLG ? "on" : "off"); stat & PIO_STAT_NACKNLG ? "on" : "off");
return stat; return stat;
} }
if(poll_count>1000)
{
if ((port->max_time_seconds>0) && (time(NULL)-start >= port->max_time_seconds))
break;
usleep(1);
}
} }
DBG (DL60, "got %02x aborting after %d\n", stat, port->max_polls); DBG (DL60, "got %02x aborting after %ld\n", stat, poll_count);
DBG (DL61, " BUSY %s\n", stat & PIO_STAT_BUSY ? "on" : "off"); DBG (DL61, " BUSY %s\n", stat & PIO_STAT_BUSY ? "on" : "off");
DBG (DL61, " NACKNLG %s\n", stat & PIO_STAT_NACKNLG ? "on" : "off"); DBG (DL61, " NACKNLG %s\n", stat & PIO_STAT_NACKNLG ? "on" : "off");
DBG (1, "polling time out, abort\n"); DBG (1, "polling time out, abort\n");
@ -450,7 +460,7 @@ pio_open (const char *dev, SANE_Status * status)
} }
port[n].base = base; port[n].base = base;
port[n].fd = -1; port[n].fd = -1;
port[n].max_polls = 0; port[n].max_time_seconds = 10;
port[n].in_use = 1; port[n].in_use = 1;
if (ioperm (port[n].base, 3, 1)) if (ioperm (port[n].base, 3, 1))