sane-backends/sane-backends-1.0.21-epson2-fixes.patch

201 lines
7.8 KiB
Diff
Raw Normal View History

From 4387ef574d47f1a66c2798245ae4a02801adc030 Mon Sep 17 00:00:00 2001
From: Nils Philippsen <nils@redhat.com>
Date: Tue, 8 Feb 2011 10:53:50 +0100
Subject: [PATCH] patch: epson2-fixes
Squashed commit of the following:
commit c8975a03814cec2774fbcaf1cc511d073f13c140
Author: Alessandro Zummo <a.zummo@towertech.it>
Date: Sat Feb 5 18:13:24 2011 +0100
epson2: try to avoid a division by zero
(cherry picked from commit 71f68035b32dc90a5e5f5adbc55de5947bc350e4)
commit b24669ceaec25615ce0fe6a90ff600fc97131d42
Author: Olaf Meeuwissen <olaf.meeuwissen@avasys.jp>
Date: Sun Dec 12 16:25:17 2010 +0100
epson2: fixed issue when a scan is cancelled
(cherry picked from commit 9a89932ab4624925794532ab5e5610e3b0190d53)
commit 05904547c6a745570213db47a813f4354e16c640
Author: Alessandro Zummo <a.zummo@towertech.it>
Date: Sun Dec 12 15:55:17 2010 +0100
epson2: do not reset networked scanners after scan
(cherry picked from commit 98df227f22d560cf41589c5ee1f2b74d1690827e)
commit de8ee42fb19d617460a0aab56ce03df5222be399
Author: Alessandro Zummo <a.zummo@towertech.it>
Date: Sun Dec 12 13:56:52 2010 +0100
epson2: fixed segfault when attaching network devices
(cherry picked from commit 14d0ca4364a31e2c0ce2d03ce4fd5a391b12cae5)
commit 28836509cfff226fcdde3ca8ce1e29baf0c9b97c
Author: Nils Philippsen <nils@redhat.com>
Date: Tue Feb 8 10:49:40 2011 +0100
Fix list of supported commands for levels D1 and D2
(cherry picked from commit a0980a91aebc5a8dd43be5136b3cb5e7f2beb458)
Conflicts:
ChangeLog
commit 368e87dd5f01af8004c879fbc36a24723b1394ac
Author: Julien BLACHE <jb@jblache.org>
Date: Wed Jun 23 18:21:35 2010 +0200
epson2: use proper ISO C initializers
(cherry picked from commit 55879ed53918c6a99075f4661b7c9fd4a23d5dcc)
commit fd7a78a1447eb67f89bf46eddb414a42a323145f
Author: Julien BLACHE <jb@jblache.org>
Date: Wed Jun 23 18:21:35 2010 +0200
epson2: add missing prototype for esci_get_scanning_parameter()
(cherry picked from commit 1226081046ee9d0f7fe2b15d33741cc6a64b102f)
commit 88c24177599e1dd42124a1e9cc0ebe039ab9591a
Author: Julien BLACHE <jb@jblache.org>
Date: Wed Jun 23 18:21:35 2010 +0200
epson2: fix signed/unsigned type mismatch
(cherry picked from commit 37418beaabd77294f7f7bd78a5886df9d5d7258e)
---
backend/epson2-cct.c | 8 ++++++--
backend/epson2-commands.h | 1 +
backend/epson2-ops.c | 11 ++++++++---
backend/epson2.c | 2 +-
backend/epson2_net.c | 4 ++--
backend/epson2_net.h | 2 +-
6 files changed, 19 insertions(+), 9 deletions(-)
diff --git a/backend/epson2-cct.c b/backend/epson2-cct.c
index 8692411..8ebed70 100644
--- a/backend/epson2-cct.c
+++ b/backend/epson2-cct.c
@@ -488,7 +488,11 @@ const struct epson_profile epson_cct_profiles[] = {
{1.0000, 0.0000, 0.0000, 0.0000, 1.0000, 0.0000, 0.0000, 0.0000, 1.0000},
{1.4431,-0.4193,-0.0238,-0.0915, 1.1507,-0.0592,-0.0226,-0.1978, 1.2204}}},
- { 0xFF, { } } /* terminator */
+ {0xFF, /* terminator */
+ {{0, 0, 0, 0, 0, 0, 0, 0, 0},
+ {0, 0, 0, 0, 0, 0, 0, 0, 0},
+ {0, 0, 0, 0, 0, 0, 0, 0, 0},
+ {0, 0, 0, 0, 0, 0, 0, 0, 0}}}
};
/* cat hw-data.c | grep '{"' | cut -d ',' -f1,2 | awk '{ print $0 " },"}' */
@@ -605,5 +609,5 @@ const struct epson_profile_map epson_cct_models[] = {
{"PID 0853", 0x9F },
{"GT-X820", 0xA1 },
- { } /* terminator */
+ {NULL, 0x00 } /* terminator */
};
diff --git a/backend/epson2-commands.h b/backend/epson2-commands.h
index 24ad9c1..4be065a 100644
--- a/backend/epson2-commands.h
+++ b/backend/epson2-commands.h
@@ -46,6 +46,7 @@ SANE_Status esci_request_status(SANE_Handle handle, unsigned char *scanner_statu
SANE_Status esci_request_extended_identity(SANE_Handle handle, unsigned char *buf);
SANE_Status esci_request_scanner_status(SANE_Handle handle, unsigned char *buf);
SANE_Status esci_set_scanning_parameter(SANE_Handle handle, unsigned char *buf);
+SANE_Status esci_get_scanning_parameter(SANE_Handle handle, unsigned char *buf);
SANE_Status esci_request_command_parameter(SANE_Handle handle, unsigned char *buf);
SANE_Status esci_request_focus_position(SANE_Handle handle,
unsigned char *position);
diff --git a/backend/epson2-ops.c b/backend/epson2-ops.c
index 0d2db5d..0b8a7ea 100644
--- a/backend/epson2-ops.c
+++ b/backend/epson2-ops.c
@@ -86,8 +86,8 @@ static struct EpsonCmd 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 ,'t','p','q','I','F'},
/* XXX 'f' probably not supported on F5 */
{"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 , 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 ,'m','f', 0 , 0 , 0 ,'!', 0 , 0 , 0 , 0 ,'t', 0 , 0 , 0 , 0 },
- {"D2",'I','i','F', 0 ,'C','G','D','R', 0 ,'A', 0 ,{ 0, 0, 0},'Z', 0 , 0 ,'@','g','d', 0 ,'z', 0 , 0 ,'m','f','e', 0 , 0 ,'!', 0 ,'N', 0 , 0 ,'t', 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 ,'t', 0 , 0 , 0 , 0 },
+ {"D2",'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 ,'N', 0 , 0 ,'t', 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','e','\f', 0 ,'!', 0 ,'N', 0 , 0 ,'t', 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','\f', 0 ,'!', 0 ,'N', 0 , 0 ,'t', 0 , 0 , 0 , 0 },
};
@@ -1342,6 +1342,9 @@ e2_init_parameters(Epson_Scanner * s)
#endif
}
+ if (s->params.bytes_per_line == 0)
+ return SANE_STATUS_INVAL;
+
/*
* Calculate correction for line_distance in D1 scanner:
* Start line_distance lines earlier and add line_distance lines at the end
@@ -1646,7 +1649,8 @@ e2_scan_finish(Epson_Scanner * s)
esci_eject(s);
/* XXX required? */
- esci_reset(s);
+ if (s->hw->connection != SANE_EPSON_NET)
+ esci_reset(s);
}
void
@@ -1721,6 +1725,7 @@ e2_ext_read(struct Epson_Scanner *s)
if (s->buf[buf_len] & FSG_STATUS_CANCEL_REQ) {
DBG(0, "%s: cancel request received\n", __func__);
+ e2_cancel(s);
return SANE_STATUS_CANCELLED;
}
diff --git a/backend/epson2.c b/backend/epson2.c
index 8e29f9f..bdd9c27 100644
--- a/backend/epson2.c
+++ b/backend/epson2.c
@@ -775,7 +775,7 @@ attach_one_usb(const char *dev)
static SANE_Status
attach_one_net(const char *dev)
{
- char name[18];
+ char name[39+4];
DBG(7, "%s: dev = %s\n", __func__, dev);
diff --git a/backend/epson2_net.c b/backend/epson2_net.c
index a0c0f89..c7b4873 100644
--- a/backend/epson2_net.c
+++ b/backend/epson2_net.c
@@ -52,10 +52,10 @@ sanei_epson_net_read_raw(Epson_Scanner *s, unsigned char *buf, size_t wanted,
}
int
-sanei_epson_net_read(Epson_Scanner *s, unsigned char *buf, size_t wanted,
+sanei_epson_net_read(Epson_Scanner *s, unsigned char *buf, ssize_t wanted,
SANE_Status * status)
{
- size_t size;
+ ssize_t size;
ssize_t read = 0;
unsigned char header[12];
diff --git a/backend/epson2_net.h b/backend/epson2_net.h
index d7df09a..6a6e8d8 100644
--- a/backend/epson2_net.h
+++ b/backend/epson2_net.h
@@ -4,7 +4,7 @@
#include <sys/types.h>
#include "../include/sane/sane.h"
-extern int sanei_epson_net_read(struct Epson_Scanner *s, unsigned char *buf, size_t buf_size,
+extern int sanei_epson_net_read(struct Epson_Scanner *s, unsigned char *buf, ssize_t buf_size,
SANE_Status *status);
extern int sanei_epson_net_write(struct Epson_Scanner *s, unsigned int cmd, const unsigned char *buf,
size_t buf_size, size_t reply_len,
--
1.7.4