forwarded message from Peter Fales

David Mosberger-Tang (David.Mosberger@acm.org)
Sun, 19 Dec 1999 16:16:20 -0800

--pZZmKD1tXo
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit

I'm resending this as I currently don't have the time to do much SANE
development. Could someone merge this patch into the CVS tree?

Thanks,

--david

--pZZmKD1tXo
Content-Type: message/rfc822
Content-Transfer-Encoding: 7bit

Mime-Version: 1.0
Content-Type: multipart/mixed; boundary=dDRMvlgZJXvWKvBx
Return-Path: <psfales@lucent.com>
Received: from localhost (dyn1-tnt4-67.chicago.il.ameritech.net [199.179.164.67])
by panda.mostang.com (8.9.3/8.9.3) with SMTP id SAA05007
for <davidm@mostang.com>; Tue, 14 Dec 1999 18:07:42 -0800
Received: from localhost (4764 bytes) by localhost
via sendmail with P:stdio/R:inet_hosts/T:smtp
(sender: <psfales>) (ident <psfales> using unix)
id <m11y3rQ-00AIp8C@localhost>
for <davidm@mostang.com>; Tue, 14 Dec 1999 20:08:12 -0600 (CST)
(Smail-3.2.0.101 1997-Dec-17 #3 built 1999-Jul-8)
Message-ID: <19991214200811.A22601@lucent.com>
X-Mailer: Mutt 0.95i
From: Peter Fales <psfales@lucent.com>
To: David Mosberger-Tang <davidm@mostang.com>
Subject: Re: Kodak DC-20/25 Backend
Date: Tue, 14 Dec 1999 20:08:12 -0600

--dDRMvlgZJXvWKvBx
Content-Type: text/plain; charset=us-ascii

David,

I saw that the 991212 version came out recently. Here are a few
more patches to the DC-25 backend. I thought I sent these back in
October, but apparently they didn't make it in:

- The most significant is a retry capability for missing data or bad checksums
in the data from the camera. This has resulted in a dramatic
reduction in download failures.

- Include HAVE_CFMAKERAW in config.h.in and dc25.c.

- Updated dc25.desc

- Symbol clash in xscanimage with recent version of the gimp library

Peter Fales

--dDRMvlgZJXvWKvBx
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment; filename="sane-devel-19991212+DC25.patch"

diff -r sane-devel-19991212/backend/dc25.c sane-devel-19991212+DC25/backend/dc25.c
101a102
> #include <sane/config.h>
345a347,352
> /*
> * List of speeds to try to establish connection with the camera.
> * Check 9600 first, as it's the speed the camera comes up in, then
> * 115200, as that is the one most likely to be configured from a
> * previous run
> */
347,348c354,356
< { B19200, { 0x19, 0x20 } },
< { B38400, { 0x38, 0x40 } },

---
> #ifdef B115200
> 				  { B115200, { 0x11, 0x52 } },
> #endif
352,354c360,361
< #ifdef B115200
< 				  { B115200, { 0x11, 0x52 } }
< #endif
---
> 				  {  B38400, { 0x38, 0x40 } },
> 				  {  B19200, { 0x19, 0x20 } },
426c433
< #ifdef HAVE_cfmakeraw
---
> #ifdef HAVE_CFMAKERAW
435c442
< 	tty_new.c_cc[VTIME] = 10;
---
> 	tty_new.c_cc[VTIME] = 50;
584a592
> 	int retries=0;
589,590c597,604
< 	for (n = 0; n < sz && (r = read (fd, (char *)&buf[n], sz - n)) > 0; n += r)
< 		;
---
> 	while ( retries++ < 5 ) {
> 	
> 		/*
> 		 * If this is not the first time through, then it must be
> 		 * a retry - signal the camera that we didn't like what
> 		 * we got.  In either case, start filling the packet
> 		 */
> 		if ( retries != 1 ) {
592,595c606,611
< 	if (r <= 0) {
< 		DBG (2,"read_data: error: read returned -1\n");
< 		return -1;
< 	}
---
> 			DBG (2, "Attempt retry %d\n",retries);
> 			c=0xe3;
> 			if (write (fd, (char *)&c, 1) != 1) {
> 				DBG (2,"read_data: error: write ack\n");
> 				return -1;
> 			}
597,600c613
< 	if (n < sz || read (fd, &rcsum, 1) != 1) {
< 		DBG (2,"read_data: error: buffer underrun or no checksum\n");
< 		return -1;
< 	}
---
> 		}
602,603c615,621
< 	for (i = 0, ccsum = 0; i < n; i++)
< 		ccsum ^= buf[i];
---
> 		for (n = 0; n < sz && (r = read (fd, (char *)&buf[n], sz - n)) > 0; n += r)
> 			;
> 	
> 		if (r <= 0) {
> 			DBG (2,"read_data: error: read returned -1\n");
> 			continue;
> 		}
605,607c623,637
< 	if (ccsum != rcsum) {
< 		DBG (2,"read_data: error: bad checksum (%02x != %02x)\n",rcsum, ccsum);
< 		return -1;
---
> 		if (n < sz || read (fd, &rcsum, 1) != 1) {
> 			DBG (2,"read_data: error: buffer underrun or no checksum\n");
> 			continue;
> 		}
> 
> 		for (i = 0, ccsum = 0; i < n; i++)
> 			ccsum ^= buf[i];
> 
> 		if (ccsum != rcsum) {
> 			DBG (2,"read_data: error: bad checksum (%02x != %02x)\n",rcsum, ccsum);
> 			continue;
> 		}
> 		
> 		/* If we got this far, then the packet is OK */
> 		break;
diff -r sane-devel-19991212/backend/dc25.desc sane-devel-19991212+DC25/backend/dc25.desc
4,5c4,5
< :version "1.1"  			; version of backend
< :status :alpha     			; :alpha, :beta, :stable, :new
---
> :version "1.2"  			; version of backend
> :status :beta     			; :alpha, :beta, :stable, :new
7c7
< :url "http://www.megsinet.net/~psfales/DC-25.html";
---
> :url "http://peter.fales.com/DC-25.html";
13c13
< :comment "DC-20 is untested!"		;
---
> :comment "DC-20 untested by author but reported to work"	;
diff -r sane-devel-19991212/frontend/xscanimage.c sane-devel-19991212+DC25/frontend/xscanimage.c
78c78
<     STANDALONE, GIMP_EXTENSION
---
>     STANDALONE, GIMP_EXTENSION_FIX_COLLISION
304c304
<   scan_win.mode = GIMP_EXTENSION;
---
>   scan_win.mode = GIMP_EXTENSION_FIX_COLLISION;
459c459
<   if (scan_win.mode == GIMP_EXTENSION)
---
>   if (scan_win.mode == GIMP_EXTENSION_FIX_COLLISION)
806c806
<   if (scan_win.mode == GIMP_EXTENSION && scan_win.tile)
---
>   if (scan_win.mode == GIMP_EXTENSION_FIX_COLLISION && scan_win.tile)
diff -r sane-devel-19991212/include/sane/config.h.in sane-devel-19991212+DC25/include/sane/config.h.in
325a326,328
> /* Define if you have cfmakeraw() */
> #undef HAVE_CFMAKERAW
> 

--dDRMvlgZJXvWKvBx--

--pZZmKD1tXo--

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