Package: scanbuttond
Version: 0.2.3.cvs20090713-2
Severity: wishlist
Tags: upstream patch
The scansnap driver does not support the ScanSnap S1500. Looking at the
source, it looks like the scansnap backend is simply a copy of the Epson
backend and does not actually support Fujitsu scanners.
The attached patch is a crude attempt to add support for the button on the
S1500. I used usbmon to reverse-engineer the USB protocol.
The patched daemon seems to work but there are a few problems:
>From the kernel log:
usb 6-2: usbfs: process 17746 (scanbuttond) did not claim interface 0 before use
scanbuttond[17627] trap invalid opcode ip:7ffbaf8ac278 sp:7fffb147fb18 error:0
in libscanbtnd-backend_snapscan.so.1.0.0[7ffbaf8ac000+2000]
>From system log:
scanbuttond: libusbi: could not claim interface for device 006:005. (EBUSY)
scanbuttond: scanbtnd_open failed, error code: -16
I think the second error occurs when a scan is in progress.
-- System Information:
Debian Release: squeeze/sid
APT prefers testing
APT policy: (500, 'testing'), (1, 'experimental')
Architecture: amd64 (x86_64)
Kernel: Linux 2.6.38-rc4 (SMP w/2 CPU cores)
Locale: LANG=en_US.UTF-8, LC_CTYPE=en_CA.utf8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/bash
Versions of packages scanbuttond depends on:
ii libc6 2.11.2-7 Embedded GNU C Library: Shared lib
ii libsane 1.0.21-7 API library for scanners
ii libusb-0.1-4 2:0.1.12-16 userspace USB programming library
Versions of packages scanbuttond recommends:
ii sane-utils 1.0.21-7 API library for scanners -- utilit
scanbuttond suggests no packages.
-- Configuration Files:
/etc/default/scanbuttond changed [not included]
/etc/scanbuttond/buttonpressed.sh.example [Errno 2] No such file or directory:
u'/etc/scanbuttond/buttonpressed.sh.example'
-- no debconf information
diff -u -ur scanbuttond-0.2.3.cvs20090713/backends/snapscan.c scanbuttond-0.2.3.cvs20090713.nas/backends/snapscan.c
--- scanbuttond-0.2.3.cvs20090713/backends/snapscan.c 2007-02-11 18:26:45.000000000 -0600
+++ scanbuttond-0.2.3.cvs20090713.nas/backends/snapscan.c 2011-02-20 16:53:17.374669705 -0600
@@ -29,13 +29,14 @@
static char* backend_name = "Snapscan USB";
-#define NUM_SUPPORTED_USB_DEVICES 4
+#define NUM_SUPPORTED_USB_DEVICES 5
static int supported_usb_devices[NUM_SUPPORTED_USB_DEVICES][3] = {
{ 0x04b8, 0x0121, 4 }, // Epson Perfection 2480
{ 0x04b8, 0x011f, 4 }, // Epson Perfection 1670
{ 0x04b8, 0x0122, 4 }, // Epson Perfection 3490
- { 0x04b8, 0x0120, 4 } // Epson Perfection 1270
+ { 0x04b8, 0x0120, 4 }, // Epson Perfection 1270
+ { 0x04c5, 0x11a2, 1 },
};
// TODO: check if this backend really works on the Epson 2580 too...
@@ -43,7 +44,8 @@
{ "Epson", "Perfection 2480 / 2580" },
{ "Epson", "Perfection 1670" },
{ "Epson", "Perfection 3490 / 3590" },
- { "Epson", "Perfection 1270" }
+ { "Epson", "Perfection 1270" },
+ { "Fujitsu", "ScanSnap S1500" },
};
@@ -227,7 +229,16 @@
}
}
-
+static unsigned char CMD[] = {
+ 0x43, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0xc2,
+ 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x0a,
+ 0x00, 0x00, 0x00,
+ };
int scanbtnd_get_button(scanner_t* scanner)
{
@@ -235,59 +246,33 @@
int num_bytes;
int button = 0;
- bytes[0] = 0x03;
- bytes[1] = 0x00;
- bytes[2] = 0x00;
- bytes[3] = 0x00;
- bytes[4] = 0x14;
- bytes[5] = 0x00;
-
if (!scanner->is_open)
return -EINVAL;
- num_bytes = snapscan_write(scanner, (void*)bytes, 6);
- if (num_bytes != 6) {
+ num_bytes = snapscan_write(scanner, (void*)CMD, sizeof CMD);
+ if (num_bytes != (sizeof CMD)) {
syslog(LOG_WARNING, "snapscan-backend: communication error: "
- "write length:%d (expected:%d)", num_bytes, 6);
+ "write length:%d (expected:%d)", num_bytes, sizeof CMD);
snapscan_flush(scanner);
return 0;
}
- num_bytes = snapscan_read(scanner, (void*)bytes, 8);
- if (num_bytes != 8 || bytes[0] != 0xF9) {
+ num_bytes = snapscan_read(scanner, (void*)bytes, 10);
+ if (num_bytes != 10) {
syslog(LOG_WARNING, "snapscan-backend: communication error: "
- "read length:%d (expected:%d), "
- "byte[0]:%x (expected:%x)",
- num_bytes, 8, bytes[0], 0xF9);
+ "read length:%d (expected:%d)",
+ num_bytes, sizeof CMD);
snapscan_flush(scanner);
return 0;
}
-
- num_bytes = snapscan_read(scanner, (void*)bytes, 20);
- if (num_bytes != 20 || bytes[0] != 0xF0) {
- syslog(LOG_WARNING, "snapscan-backend: communication error: "
- "read length:%d (expected:%d), "
- "byte[0]:%x (expected:%x)",
- num_bytes, 20, bytes[0], 0xF0);
- snapscan_flush(scanner);
- return 0;
- }
- if (bytes[2] == 0x06) {
- switch (bytes[18] & 0xF0) {
- case 0x10: button = 1; break;
- case 0x20: button = 2; break;
- case 0x40: button = 3; break;
- case 0x80: button = 4; break;
- default: button = 0; break;
- }
+ if (bytes[4] == 0x01) {
+ button = 1;
}
-
- num_bytes = snapscan_read(scanner, (void*)bytes, 8);
- if (num_bytes != 8 || bytes[0] != 0xFB) {
+ num_bytes = snapscan_read(scanner, (void*)bytes, 13);
+ if (num_bytes != 13) {
syslog(LOG_WARNING, "snapscan-backend: communication error: "
- "read length:%d (expected:%d), "
- "byte[0]:%x (expected:%x)",
- num_bytes, 8, bytes[0], 0xFB);
+ "read length:%d (expected:%d)",
+ num_bytes, 13);
snapscan_flush(scanner);
return 0;
}