Sane patches/observations on solaris 2.6/umax s6-e

Michael Polo (mikep@Polo.NET)
Thu, 2 Apr 1998 14:29:19 -0800

Hi everyone,

First, I think sane is awesome. I've been a long time sun
user for a long time, and it's great to be able to finally
scan things without having to struggle with crippled PC
software. Just having a command line option makes automating
things so easy - though it's not as 'sexy' as a windoze command
line interface that locks the screen during scans, requires
you enter some data into a window every 3 seconds, etc...

By the way, on large scans, the scanner seems to back up. Is
there a buffer size to change somewhere to make it scan in one
pass without pausing? I have 128Mb of memory and I thought if
the scsi bus could keep up, the system could. Any ideas?

Anyway, I just wanted to give people a rundown on how I
got SANE working on Solaris with my UMAX S6-E scanner.

I got bit a quite a number of times during the install process,
but finally got it going. I added some diffs at the end - I hope
they're in the right format.

1) You need gnu make, the sun make won't work. (I usually install
gnu make as 'gmake' to avoid confusion)

you can get it as a precompiled package at
http://sunsite.unc.edu/pub/packages/solaris

Here's the make error that goes away with gnu make:

> making all in backend
> make: Fatal error in reader: Makefile, line 70: More than one % pattern
> on right hand side

The relevant lines of backend/Makefile are:

: libsane-%.la: %.lo %-s.lo $(EXTRA) $(LIBOBJS)
: @$(LIBTOOL) $(MLINK) $(CC) -export-dynamic -o $@ $(LDFLAGS) $^ \
: -rpath $(libdir) -version-info $(V_MAJOR):$(V_MINOR):0

I'm not sure how to recode this to work with sun's make. It uses gnu make
to do a lot of busy-work. Ideas anyone?

2) You need gcc with the current source, but I made a set of patches
(below) to get it to work with the sun workshop compiler.

I got gcc 2.7.2.3 for solaris 2.6 as a precompiled package at
http://sunsite.unc.edu/pub/packages/solaris

3) You should install the scg scsi driver *BEFORE* you run
configure in the sane directory - otherwise configure won't set up
SANE to work with the scg stuff properly.
(remember that you should 'reboot -- -rv' too)

4) Even with gcc, there's a syntax error in tools/find-scanner.c (add
a comma to the end of line 350, after "/dev/sg/6"

5) I'm using a UMAX S6-E scanner, which doesn't work with the
*current* sane backend - you have to apply the umax patch.

This one took me a while to figure out. I kept on getting
really strange scsi errors otherwise. I read the umax manual
pages and it said you need a scsi card. So I GOT A SECOND
SBUS SCSI CARD. I thought that accessing the disk drive on the
same scsi chain was screwing up the scan. Didn't make any
difference. (what a pain!)

What made the difference was applying the patch.

I figured out I read the comment from the umax man page wrong:

Vendor Product id: Remark:
-------- -------------- -----------
UMAX Vista-S6 all modes ok
UMAX Vista-S6E RGB only in preview-mode
UMAX UMAX S-6E RGB only in preview-mode
UMAX UMAX S-6EG RGB only in preview-mode

I read it as:
'full scans work in any mode, but preview scans only work
in RGB'

but I see it really meant:
'You can only scan in RGB when in preview mode, but full
scans can't use RGB'

Well, I applied sane-umax-0.71h.tar.gz and things started
working.

whoa! cool!

Even with everything fixed, I get lots of messages like:

handle_incomplete: 1 retry cnt: 27
handle_incomplete: 1 retry cnt: 27
handle_incomplete: 1 retry cnt: 27
handle_incomplete: 1 retry cnt: 27
handle_incomplete: 1 retry cnt: 27

Why doesn't Joerg Schilling just release the source code to
his scsi driver so people can fix the device naming convention
stuff and possibly change/disable the error messages? It's
kind of frustrating (but I don't want to look a gift horse in
the mouth because the driver *IS* available)

Anyway, kind of long winded, Hope this helps!

Mike

mikep "at" polo "dot" net

*** backend/coolscan.c Thu Apr 2 13:32:49 1998
--- backend/coolscan.c.~1~ Mon Feb 23 20:45:37 1998
***************
*** 749,759 ****
static int
send_one_LUT(Coolscan_t *s, SANE_Word *LUT, int reg) {
int i;
! /* unsigned char gamma[send.size+2048], *gamma_p;*/
! unsigned char *gamma, *gamma_p;
! int rc;
!
! gamma = (unsigned char *) (malloc(send.size + 2048));

DBG(5,"send LUT\n");

--- 749,755 ----
static int
send_one_LUT(Coolscan_t *s, SANE_Word *LUT, int reg) {
int i;
! unsigned char gamma[send.size+2048], *gamma_p;

DBG(5,"send LUT\n");

***************
*** 768,777 ****
*gamma_p++ = (unsigned char) LUT[i];
}

! rc = do_scsi_cmd(s->sfd, gamma, send.size+2048, NULL, 0);
! free(gamma);
!
! return rc;
}


--- 764,770 ----
*gamma_p++ = (unsigned char) LUT[i];
}

! return do_scsi_cmd(s->sfd, gamma, send.size+2048, NULL, 0);
}

*** backend/dmc.c Thu Apr 2 13:35:35 1998
--- backend/dmc.c.~1~ Mon Feb 23 23:16:17 1998
***************
*** 397,406 ****
return SANE_STATUS_INVAL;
}
c->imageMode = mode;
! c->val[OPT_TL_X].w = c->tl_x_range.min;
! c->val[OPT_TL_Y].w = c->tl_y_range.min;
! c->val[OPT_BR_X].w = c->br_x_range.min;
! c->val[OPT_BR_Y].w = c->br_y_range.min;
return SANE_STATUS_GOOD;
}

--- 397,406 ----
return SANE_STATUS_INVAL;
}
c->imageMode = mode;
! c->val[OPT_TL_X] = c->tl_x_range.min;
! c->val[OPT_TL_Y] = c->tl_y_range.min;
! c->val[OPT_BR_X] = c->br_x_range.min;
! c->val[OPT_BR_Y] = c->br_y_range.min;
return SANE_STATUS_GOOD;
}

*** backend/s9036.c Thu Apr 2 13:45:11 1998
--- backend/s9036.c.~1~ Mon Jan 19 20:38:28 1998
***************
*** 182,189 ****
static void
wait_ready (int fd)
{
! #define WAIT_READY_READ_SIZE 4
! /* const READ_SIZE = 4;*/

const Byte scsi_read[] =
{
--- 182,188 ----
static void
wait_ready (int fd)
{
! const READ_SIZE = 4;

const Byte scsi_read[] =
{
***************
*** 190,201 ****
0x28, 0x00, /* opcode, lun */
0x80, /* data type 80 == read time left */
0x00, 0x00, 0x00, /* reserved */
! 0x00, 0x00, WAIT_READY_READ_SIZE, /* transfer length */
0x00, /* control byte */
};

! Byte result[WAIT_READY_READ_SIZE];
! size_t size = WAIT_READY_READ_SIZE;
SANE_Status status;

while (1)
--- 189,200 ----
0x28, 0x00, /* opcode, lun */
0x80, /* data type 80 == read time left */
0x00, 0x00, 0x00, /* reserved */
! 0x00, 0x00, READ_SIZE, /* transfer length */
0x00, /* control byte */
};

! Byte result[READ_SIZE];
! size_t size = READ_SIZE;
SANE_Status status;

while (1)
***************
*** 203,209 ****
status = sanei_scsi_cmd (fd, scsi_read, sizeof (scsi_read),
result, &size);

! if (status != SANE_STATUS_GOOD || size != WAIT_READY_READ_SIZE)
{
/*
Command failed, the assembler code of the windows scan library
--- 202,208 ----
status = sanei_scsi_cmd (fd, scsi_read, sizeof (scsi_read),
result, &size);

! if (status != SANE_STATUS_GOOD || size != READ_SIZE)
{
/*
Command failed, the assembler code of the windows scan library
***************
*** 235,242 ****
static SANE_Status
get_read_sizes (int fd, int *lines_available, int *bpl, int *total_lines)
{
! #define GET_READ_SIZES_READ_SIZE 24
! /* const READ_SIZE = 24;*/

const Byte scsi_read[] =
{
--- 234,240 ----
static SANE_Status
get_read_sizes (int fd, int *lines_available, int *bpl, int *total_lines)
{
! const READ_SIZE = 24;

const Byte scsi_read[] =
{
***************
*** 243,259 ****
0x28, 0x00, /* opcode, lun */
0x81, /* data type 81 == read time left */
0x00, 0x00, 0x00, /* reserved */
! 0x00, 0x00, GET_READ_SIZES_READ_SIZE, /* transfer length */
0x00, /* control byte */
};

! Byte result[GET_READ_SIZES_READ_SIZE];
! size_t size = GET_READ_SIZES_READ_SIZE;
SANE_Status status;

status = sanei_scsi_cmd (fd, scsi_read, sizeof (scsi_read), result, &size);

! if (status != SANE_STATUS_GOOD || size != GET_READ_SIZES_READ_SIZE)
{
/* Command failed */
return SANE_STATUS_IO_ERROR;
--- 241,257 ----
0x28, 0x00, /* opcode, lun */
0x81, /* data type 81 == read time left */
0x00, 0x00, 0x00, /* reserved */
! 0x00, 0x00, READ_SIZE, /* transfer length */
0x00, /* control byte */
};

! Byte result[READ_SIZE];
! size_t size = READ_SIZE;
SANE_Status status;

status = sanei_scsi_cmd (fd, scsi_read, sizeof (scsi_read), result, &size);

! if (status != SANE_STATUS_GOOD || size != READ_SIZE)
{
/* Command failed */
return SANE_STATUS_IO_ERROR;
***************
*** 526,538 ****
static SANE_Status
attach (const char *devname, S9036_Device ** devp)
{
! #define ATTACH_SCSI_INQ_LEN 55
! /* const Byte SCSI_INQ_LEN = 55;*/
const Byte scsi_inquiry[] =
{
! 0x12, 0x00, 0x00, 0x00, ATTACH_SCSI_INQ_LEN, 0x00
};
! Byte result[ATTACH_SCSI_INQ_LEN];

int fd;
S9036_Device *dev;
--- 524,535 ----
static SANE_Status
attach (const char *devname, S9036_Device ** devp)
{
! const Byte SCSI_INQ_LEN = 55;
const Byte scsi_inquiry[] =
{
! 0x12, 0x00, 0x00, 0x00, SCSI_INQ_LEN, 0x00
};
! Byte result[SCSI_INQ_LEN];

int fd;
S9036_Device *dev;
***************
*** 560,566 ****
size = sizeof (result);
status = sanei_scsi_cmd (fd, scsi_inquiry, sizeof (scsi_inquiry),
result, &size);
! if (status != SANE_STATUS_GOOD || size != ATTACH_SCSI_INQ_LEN)
{
DBG (1, "attach: inquiry failed (%s)\n", sane_strstatus (status));
sanei_scsi_close (fd);
--- 557,563 ----
size = sizeof (result);
status = sanei_scsi_cmd (fd, scsi_inquiry, sizeof (scsi_inquiry),
result, &size);
! if (status != SANE_STATUS_GOOD || size != SCSI_INQ_LEN)
{
DBG (1, "attach: inquiry failed (%s)\n", sane_strstatus (status));
sanei_scsi_close (fd);

*** tools/find-scanner.c Thu Apr 2 13:52:20 1998
--- tools/find-scanner.c.~1~ Mon Feb 23 21:23:17 1998
***************
*** 347,353 ****
"/dev/scg2a", "/dev/scg2b", "/dev/scg2c", "/dev/scg2d",
"/dev/scg2e", "/dev/scg2f", "/dev/scg2g",
"/dev/sg/0", "/dev/sg/1", "/dev/sg/2", "/dev/sg/3",
! "/dev/sg/4", "/dev/sg/5", "/dev/sg/6",
#endif
0
};
--- 347,353 ----
"/dev/scg2a", "/dev/scg2b", "/dev/scg2c", "/dev/scg2d",
"/dev/scg2e", "/dev/scg2f", "/dev/scg2g",
"/dev/sg/0", "/dev/sg/1", "/dev/sg/2", "/dev/sg/3",
! "/dev/sg/4", "/dev/sg/5", "/dev/sg/6"
#endif
0
};

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