Re: Epson GT9000

Christian Bucher (bucher@navd.alcatel.de)
Wed, 03 Jun 1998 14:34:02 +0200

This is a multi-part message in MIME format.
--------------1FBDF1229EF3D4F801326BAC
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit

Colm Buckley wrote:
>
> Hi folks -
>
> I'd just like to report (I don't know whether this has been done
> before), that the sane-epson backend does *not* work with the Epson
> GT9000. I have such a scanner, and a good knowledge of C and Unix - is
> there any way I can help to get this scanner working with SANE?
>
> Colm
>
> --
> Colm Buckley B.A. B.F. # Trinity College, Dublin 2, Ireland.
> colm@tuatha.org | colm@lspace.org # +353 87 2469146 # whois cb3765
> http://www.tuatha.org/~cbuckley/ # finger cbuckley@tuatha.org
> Out of my mind. Back in five minutes.
>
> --
> Source code, list archive, and docs: http://www.mostang.com/sane/
> To unsubscribe: echo unsubscribe sane-devel | mail majordomo@mostang.com

With this patch it should work. Thanks to Colm and Derek for helping.

christian

-- 
Christian Bucher

phone: +43 1 5488640 mobil: +43 676 4208334

mailto:bucher@navd.alcatel.de mailto:cbucher@vernetzt.at --------------1FBDF1229EF3D4F801326BAC Content-Type: text/plain; charset=us-ascii; name="epson.1.patch" Content-Transfer-Encoding: 7bit Content-Disposition: inline; filename="epson.1.patch"

*** backend/epson.c~ Sat May 9 21:53:44 1998 --- backend/epson.c Wed Jun 3 14:03:31 1998 *************** *** 60,65 **** --- 60,66 ---- #include <stdio.h> #include <string.h> #include <stdlib.h> + #include <ctype.h> #include <sane/sane.h> #include <sane/saneopts.h> *************** *** 97,102 **** --- 98,104 ---- #define EPSON_LEVEL_B1 2 #define EPSON_LEVEL_B2 3 #define EPSON_LEVEL_B3 4 + #define EPSON_LEVEL_B4 5 #define EPSON_LEVEL_DEFAULT EPSON_LEVEL_B3 *************** *** 130,135 **** --- 132,139 ---- {"B2", 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 1, 0, 1} , {"B3", 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 1} + , + {"B4", 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 1} }; /* TODO: speed */ *************** *** 147,153 **** cmd[4] = buf_size; memcpy (cmd + 6, buf, buf_size); ! if (SANE_STATUS_GOOD == (*status = sanei_scsi_cmd (fd, cmd, sizeof (cmd) + buf_size, NULL, NULL))) return buf_size; return 0; --- 151,157 ---- cmd[4] = buf_size; memcpy (cmd + 6, buf, buf_size); ! if (SANE_STATUS_GOOD == (*status = sanei_scsi_cmd (fd, cmd, 6 + buf_size, NULL, NULL))) return buf_size; return 0; *************** *** 157,162 **** --- 161,177 ---- send (Epson_Scanner * s, const void *buf, size_t buf_size, SANE_Status * status) { + DBG( 3, "send buf, size = %u\n", buf_size); + /* + { + size_t k; + const char * s = buf; + + for( k = 0; k < buf_size; k++) { + DBG( 3, "buf[%u] %02x %c\n", k, s[ k], isprint( s[ k]) ? s[ k] : '.'); + } + } + */ if (s->hw->is_scsi) { return scsi_write (s->fd, buf, buf_size, status); *************** *** 196,209 **** static int receive (Epson_Scanner * s, void *buf, size_t buf_size, SANE_Status * status) { if (s->hw->is_scsi) { ! return scsi_read (s->fd, buf, buf_size, status); } else { - int n; if (buf_size == (n = sanei_pio_read (s->fd, buf, buf_size))) *status = SANE_STATUS_GOOD; --- 211,224 ---- static int receive (Epson_Scanner * s, void *buf, size_t buf_size, SANE_Status * status) { + int n; if (s->hw->is_scsi) { ! n = scsi_read (s->fd, buf, buf_size, status); } else { if (buf_size == (n = sanei_pio_read (s->fd, buf, buf_size))) *status = SANE_STATUS_GOOD; *************** *** 210,220 **** else *status = SANE_STATUS_INVAL; - return n; } ! /* never reached */ } static SANE_Status inquiry (int fd, int page_code, void *buf, size_t * buf_size) --- 225,245 ---- else *status = SANE_STATUS_INVAL; } ! DBG( 3, "receive buf, expected = %u, got = %u\n", buf_size, n); ! /* ! { ! int k; ! const char * s = buf; ! ! for( k = 0; k < n; k++) { ! DBG( 3, "buf[%u] %02x %c\n", k, s[ k], isprint( s[ k]) ? s[ k] : '.'); ! } } + */ + return n; + } static SANE_Status inquiry (int fd, int page_code, void *buf, size_t * buf_size) *************** *** 598,612 **** if (SANE_STATUS_GOOD != *status) return (EpsonHdr) 0; ! buf = (u_char *) head; ! receive (s, buf, 1, status); if (SANE_STATUS_GOOD != *status) return (EpsonHdr) 0; - buf++; ! DBG (4, "code %02x\n", (int) head->code); switch (head->code) { --- 623,643 ---- if (SANE_STATUS_GOOD != *status) return (EpsonHdr) 0; ! buf = (u_char *) head; + if( s->hw->is_scsi) { + receive (s, buf, 4, status); + /* buf += 4;*/ + } else { + receive (s, buf, 1, status); + buf += 1; + } + if (SANE_STATUS_GOOD != *status) return (EpsonHdr) 0; ! DBG (4, "code 0x%02x\n", (int) head->code); switch (head->code) { *************** *** 626,638 **** break; case STX: - receive (s, buf, 3, status); if (SANE_STATUS_GOOD != *status) return (EpsonHdr) 0; - /* buf += 3; */ - DBG (4, "status %02x\n", (int) head->status); DBG (4, "count %d\n", (int) head->count); --- 657,673 ---- break; case STX: + if( s->hw->is_scsi) { + /* nope */ + } else { + receive (s, buf, 3, status); + /* buf += 3;*/ + } + if (SANE_STATUS_GOOD != *status) return (EpsonHdr) 0; DBG (4, "status %02x\n", (int) head->status); DBG (4, "count %d\n", (int) head->count); *************** *** 708,721 **** return status; } ! if (buf[0] != TYPE_PROCESSOR ! || strncmp (buf + 8, "EPSON", 5) != 0 ! || strncmp (buf + 16, "SCANNER ", 8) != 0) ! { ! DBG (1, "attach: device doesn't look like an Epson scanner\n"); ! myclose (s); ! return SANE_STATUS_INVAL; ! } } else { --- 743,758 ---- return status; } ! if (buf[0] != TYPE_PROCESSOR ! || strncmp (buf + 8, "EPSON", 5) != 0 ! || (strncmp (buf + 16, "SCANNER ", 8) != 0 && ! strncmp (buf + 14, "SCANNER ", 8) != 0)) ! { ! DBG (1, "attach: device doesn't look like an Epson scanner\n"); ! myclose (s); ! return SANE_STATUS_INVAL; ! } ! } else { *************** *** 731,752 **** { EpsonIdent ident = (EpsonIdent) command (s, "\033I", 2, &status); ! u_char *buf = ident->buf; int n, k; ! DBG (1, "type %3c %02x\n", ident->type, ident->type); ! DBG (1, "level %3c %02x\n", ident->level, ident->level); s->hw->res_list_size = 0; s->hw->res_list = (SANE_Int *) calloc (s->hw->res_list_size, sizeof (SANE_Int)); if (NULL == s->hw->res_list) { ! DBG (0, "problem\n"); exit (0); } ! for (n = ident->count; n; n -= k, buf += k) { switch (*buf) { --- 768,794 ---- { EpsonIdent ident = (EpsonIdent) command (s, "\033I", 2, &status); ! u_char *buf; int n, k; ! if( NULL == ident) { ! DBG (0, "ident failed\n"); ! return status; ! } + DBG (1, "type %3c 0x%02x\n", ident->type, ident->type); + DBG (1, "level %3c 0x%02x\n", ident->level, ident->level); + s->hw->res_list_size = 0; s->hw->res_list = (SANE_Int *) calloc (s->hw->res_list_size, sizeof (SANE_Int)); if (NULL == s->hw->res_list) { ! DBG (0, "no mem\n"); exit (0); } ! for (n = ident->count, buf = ident->buf; n; n -= k, buf += k) { switch (*buf) { *************** *** 759,765 **** if (NULL == s->hw->res_list) { ! DBG (0, "problem\n"); exit (0); } --- 801,807 ---- if (NULL == s->hw->res_list) { ! DBG (0, "no mem\n"); exit (0); }

--------------1FBDF1229EF3D4F801326BAC--

--
Source code, list archive, and docs: http://www.mostang.com/sane/
To unsubscribe: echo unsubscribe sane-devel | mail majordomo@mostang.com