We managed to get the sane-epson library of sane-0.73 to work for an
Epson GT9500 scanner on AIX 4.2.1 with
CC=cc ./configure --disable-shared
using the patch appended.
(Note that this _includes_ a patch by Christian Bucher for a GT9000
which has been posted earlier this month).
--
Holger Frahm email: frahm@itp.uni-hannover.de
WWW: http://www.itp.uni-hannover.de/~frahm
Phone: +49 (511) 762-2234, FAX: +49 (511) 762-3023
--ELM899133886-22328-0_
Content-Type: text/plain; charset=ISO-8859-1
Content-Disposition: attachment; filename=epson.2.patch
Content-Description: /tmp/epson.2.patch
Content-Transfer-Encoding: 7bit
*** backend/epson.c.orig Mon Jun 29 17:01:22 1998
--- backend/epson.c Mon Jun 29 17:14:30 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,106 ----
#define EPSON_LEVEL_B1 2
#define EPSON_LEVEL_B2 3
#define EPSON_LEVEL_B3 4
+ #define EPSON_LEVEL_B4 5
+ #define EPSON_LEVEL_B5 6
+ #define EPSON_LEVEL_B6 7
#define EPSON_LEVEL_DEFAULT EPSON_LEVEL_B3
***************
*** 130,135 ****
--- 134,145 ----
{"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}
+ ,
+ {"B5", 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 1}
+ ,
+ {"B6", 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;
--- 157,163 ----
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 ****
--- 167,183 ----
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;
--- 217,230 ----
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)
--- 231,251 ----
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)
***************
*** 557,563 ****
u_char status;
u_short count;
! u_char buf[0];
}
EpsonHdrRec, *EpsonHdr;
--- 588,594 ----
u_char status;
u_short count;
! u_char buf[1];
}
EpsonHdrRec, *EpsonHdr;
***************
*** 571,577 ****
u_char type;
u_char level;
! u_char buf[0];
}
EpsonIdentRec, *EpsonIdent;
--- 602,608 ----
u_char type;
u_char level;
! u_char buf[1];
}
EpsonIdentRec, *EpsonIdent;
***************
*** 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)
{
--- 629,649 ----
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);
--- 663,679 ----
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);
***************
*** 709,721 ****
}
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
{
--- 750,764 ----
}
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)
{
--- 774,801 ----
{
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);
! /* HF s->hw->res_list_size = 0; */
! s->hw->res_list_size = 1;
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);
}
--- 808,814 ----
if (NULL == s->hw->res_list)
{
! DBG (0, "no mem\n");
exit (0);
}
--ELM899133886-22328-0_--
--
Source code, list archive, and docs: http://www.mostang.com/sane/
To unsubscribe: echo unsubscribe sane-devel | mail majordomo@mostang.com