Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
Menu
Open sidebar
adam.huang
Config
Commits
68550588
Commit
68550588
authored
Jan 28, 2014
by
Igor Pečovnik
Browse files
source change
parent
0fe94fc2
Changes
53
Expand all
Hide whitespace changes
Inline
Side-by-side
src/scanbuttond-0.2.3/backends/niash.h
deleted
100644 → 0
View file @
0fe94fc2
// niash.h: Niash device backend
// This file is part of scanbuttond.
// This file is part of scanbuttond.
// Copyleft )c( 2005 by Bernhard Stiftner
// Copyleft )c( 2005 by Dirk Wriedt
//
// This program is free software; you can redistribute it and/or
// modify it under the terms of the GNU General Public License as
// published by the Free Software Foundation; either version 2 of the
// License, or (at your option) any later version.
//
// This program is distributed in the hope that it will be useful, but
// WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
// General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program; if not, write to the Free Software
// Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
#ifndef __NIASH_H_INCLUDED
#define __NIASH_H_INCLUDED
#include "scanbuttond/backend.h"
#endif
src/scanbuttond-0.2.3/backends/plustek.c
deleted
100644 → 0
View file @
0fe94fc2
// plustek.c: Plustek device backend
// This file is part of scanbuttond.
// Copyleft )c( 2005 by Hans Verkuil
// Copyleft )c( 2005-2006 by Bernhard Stiftner
//
// This program is free software; you can redistribute it and/or
// modify it under the terms of the GNU General Public License as
// published by the Free Software Foundation; either version 2 of the
// License, or (at your option) any later version.
//
// This program is distributed in the hope that it will be useful, but
// WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
// General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program; if not, write to the Free Software
// Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
#include <errno.h>
#include <syslog.h>
#include "scanbuttond/scanbuttond.h"
#include "scanbuttond/libusbi.h"
#include "plustek.h"
static
char
*
backend_name
=
"Plustek USB"
;
#define NUM_SUPPORTED_USB_DEVICES 8
static
int
supported_usb_devices
[
NUM_SUPPORTED_USB_DEVICES
][
3
]
=
{
// vendor, product, num_buttons
{
0x04a9
,
0x2207
,
1
},
// CanoScan N1220U
{
0x04a9
,
0x2208
,
1
},
// CanoScan CanoScan D660U
{
0x04a9
,
0x2206
,
1
},
// CanoScan N650U
{
0x04a9
,
0x220d
,
3
},
// CanoScan LiDE 20
{
0x04a9
,
0x2220
,
3
},
// CanoScan LiDE 25
{
0x04a9
,
0x220e
,
3
},
// CanoScan LiDE 30
{
0x04b8
,
0x011d
,
4
},
// Epson Perfection 1260
{
0x03f0
,
0x0605
,
2
}
// HP ScanJet 2200c (maybe only 1 button?)
};
static
char
*
usb_device_descriptions
[
NUM_SUPPORTED_USB_DEVICES
][
2
]
=
{
{
"Canon"
,
"CanoScan N1220U"
},
{
"Canon"
,
"CanoScan D660U"
},
{
"Canon"
,
"CanoScan N650U"
},
{
"Canon"
,
"CanoScan LiDE 20"
},
{
"Canon"
,
"CanoScan LiDE 25"
},
{
"Canon"
,
"CanoScan LiDE 30"
},
{
"Epson"
,
"Perfection 1260"
},
{
"Hewlett-Packard"
,
"ScanJet 2200c"
}
};
libusb_handle_t
*
libusb_handle
;
scanner_t
*
plustek_scanners
=
NULL
;
// returns -1 if the scanner is unsupported, or the index of the
// corresponding vendor-product pair in the supported_usb_devices array.
int
plustek_match_libusb_scanner
(
libusb_device_t
*
device
)
{
int
index
;
for
(
index
=
0
;
index
<
NUM_SUPPORTED_USB_DEVICES
;
index
++
)
{
if
(
supported_usb_devices
[
index
][
0
]
==
device
->
vendorID
&&
supported_usb_devices
[
index
][
1
]
==
device
->
productID
)
{
break
;
}
}
if
(
index
>=
NUM_SUPPORTED_USB_DEVICES
)
return
-
1
;
return
index
;
}
void
plustek_attach_libusb_scanner
(
libusb_device_t
*
device
)
{
const
char
*
descriptor_prefix
=
"plustek:libusb:"
;
int
index
=
plustek_match_libusb_scanner
(
device
);
if
(
index
<
0
)
return
;
// unsupported
scanner_t
*
scanner
=
(
scanner_t
*
)
malloc
(
sizeof
(
scanner_t
));
scanner
->
vendor
=
usb_device_descriptions
[
index
][
0
];
scanner
->
product
=
usb_device_descriptions
[
index
][
1
];
scanner
->
connection
=
CONNECTION_LIBUSB
;
scanner
->
internal_dev_ptr
=
(
void
*
)
device
;
scanner
->
lastbutton
=
0
;
scanner
->
sane_device
=
(
char
*
)
malloc
(
strlen
(
device
->
location
)
+
strlen
(
descriptor_prefix
)
+
1
);
strcpy
(
scanner
->
sane_device
,
descriptor_prefix
);
strcat
(
scanner
->
sane_device
,
device
->
location
);
scanner
->
num_buttons
=
supported_usb_devices
[
index
][
2
];
scanner
->
is_open
=
0
;
scanner
->
next
=
plustek_scanners
;
plustek_scanners
=
scanner
;
}
void
plustek_detach_scanners
(
void
)
{
scanner_t
*
next
;
while
(
plustek_scanners
!=
NULL
)
{
next
=
plustek_scanners
->
next
;
free
(
plustek_scanners
->
sane_device
);
free
(
plustek_scanners
);
plustek_scanners
=
next
;
}
}
void
plustek_scan_devices
(
libusb_device_t
*
devices
)
{
int
index
;
libusb_device_t
*
device
=
devices
;
while
(
device
!=
NULL
)
{
index
=
plustek_match_libusb_scanner
(
device
);
if
(
index
>=
0
)
plustek_attach_libusb_scanner
(
device
);
device
=
device
->
next
;
}
}
int
plustek_init_libusb
(
void
)
{
libusb_device_t
*
devices
;
libusb_handle
=
libusb_init
();
devices
=
libusb_get_devices
(
libusb_handle
);
plustek_scan_devices
(
devices
);
return
0
;
}
const
char
*
scanbtnd_get_backend_name
(
void
)
{
return
backend_name
;
}
int
scanbtnd_init
(
void
)
{
plustek_scanners
=
NULL
;
syslog
(
LOG_INFO
,
"plustek-backend: init"
);
return
plustek_init_libusb
();
}
int
scanbtnd_rescan
(
void
)
{
libusb_device_t
*
devices
;
plustek_detach_scanners
();
plustek_scanners
=
NULL
;
libusb_rescan
(
libusb_handle
);
devices
=
libusb_get_devices
(
libusb_handle
);
plustek_scan_devices
(
devices
);
return
0
;
}
const
scanner_t
*
scanbtnd_get_supported_devices
(
void
)
{
return
plustek_scanners
;
}
int
scanbtnd_open
(
scanner_t
*
scanner
)
{
int
result
=
-
ENOSYS
;
if
(
scanner
->
is_open
)
return
-
EINVAL
;
switch
(
scanner
->
connection
)
{
case
CONNECTION_LIBUSB
:
// if devices have been added/removed, return -ENODEV to
// make scanbuttond update its device list
if
(
libusb_get_changed_device_count
()
!=
0
)
return
-
ENODEV
;
result
=
libusb_open
((
libusb_device_t
*
)
scanner
->
internal_dev_ptr
);
break
;
}
if
(
result
==
0
)
scanner
->
is_open
=
1
;
return
result
;
}
int
scanbtnd_close
(
scanner_t
*
scanner
)
{
int
result
=
-
ENOSYS
;
if
(
!
scanner
->
is_open
)
return
-
EINVAL
;
switch
(
scanner
->
connection
)
{
case
CONNECTION_LIBUSB
:
result
=
libusb_close
((
libusb_device_t
*
)
scanner
->
internal_dev_ptr
);
break
;
}
if
(
result
==
0
)
scanner
->
is_open
=
0
;
return
result
;
}
int
plustek_read
(
scanner_t
*
scanner
,
void
*
buffer
,
int
bytecount
)
{
switch
(
scanner
->
connection
)
{
case
CONNECTION_LIBUSB
:
return
libusb_read
((
libusb_device_t
*
)
scanner
->
internal_dev_ptr
,
buffer
,
bytecount
);
break
;
}
return
-
1
;
}
int
plustek_write
(
scanner_t
*
scanner
,
void
*
buffer
,
int
bytecount
)
{
switch
(
scanner
->
connection
)
{
case
CONNECTION_LIBUSB
:
return
libusb_write
((
libusb_device_t
*
)
scanner
->
internal_dev_ptr
,
buffer
,
bytecount
);
break
;
}
return
-
1
;
}
void
plustek_flush
(
scanner_t
*
scanner
)
{
switch
(
scanner
->
connection
)
{
case
CONNECTION_LIBUSB
:
libusb_flush
((
libusb_device_t
*
)
scanner
->
internal_dev_ptr
);
break
;
}
}
int
scanbtnd_get_button
(
scanner_t
*
scanner
)
{
/*
Note 1: I strongly suspect that the command 0x01 0x69 0x00 0x01 will return
a button bitmask. For my Canon N1220U it returns 0x04, which happens to
be the bit I have to test against to see if the scanner button was pressed.
However, this has to be tested on other scanners to see if this is true.
UPDATE by BS: The LIDE 20 also returns 0x04, but it has three buttons!
So this guess is probably wrong. (Thanks to Christian Bucher for this info)
Note 2: This works on my Canon N1220U. Whether this is Canon specific or
if it works for all 'plustek usb' type scanners is something I don't know.
Note 3: You must have run sane-find-scanner once. Sane apparently initializes
something on the scanner allowing this to work. Otherwise all you get is 0x00.
Note 4: by /cbx
On my CanoScan LIDE20, the default value is $62 and the bits for the
buttons are as follows:
Scan: $72 ==> 0x10
Copy: $6a ==> 0x08
Mail: $66 ==> 0x04
*/
unsigned
char
bytes
[
255
];
int
num_bytes
;
int
button
=
0
;
bytes
[
0
]
=
1
;
bytes
[
1
]
=
2
;
bytes
[
2
]
=
0
;
bytes
[
3
]
=
1
;
if
(
!
scanner
->
is_open
)
return
-
EINVAL
;
num_bytes
=
plustek_write
(
scanner
,
(
void
*
)
bytes
,
4
);
if
(
num_bytes
!=
4
)
{
plustek_flush
(
scanner
);
return
0
;
}
num_bytes
=
plustek_read
(
scanner
,
(
void
*
)
bytes
,
1
);
if
(
num_bytes
!=
1
)
{
plustek_flush
(
scanner
);
return
0
;
}
// by BS: This is my first attempt to get rid of the
// hardcoded button bitmask. Note that I do not own any device
// supported by this backend, so this code is based on guessing.
// Tested on the LIDE 20, should work for 1-button devices, too.
switch
(
scanner
->
num_buttons
)
{
case
1
:
if
((
bytes
[
0
]
&
0x04
)
!=
0
)
button
=
1
;
break
;
case
2
:
if
((
bytes
[
0
]
&
0x08
)
!=
0
)
button
=
1
;
if
((
bytes
[
0
]
&
0x04
)
!=
0
)
button
=
2
;
break
;
case
3
:
if
((
bytes
[
0
]
&
0x10
)
!=
0
)
button
=
1
;
if
((
bytes
[
0
]
&
0x08
)
!=
0
)
button
=
2
;
if
((
bytes
[
0
]
&
0x04
)
!=
0
)
button
=
3
;
break
;
case
4
:
// only tested for the Epson Perfection 1260...
// seems to be a bit odd compared to the other cases...
if
((
bytes
[
0
]
&
0x08
)
!=
0
)
button
=
1
;
if
((
bytes
[
0
]
&
0x10
)
!=
0
)
button
=
2
;
if
((
bytes
[
0
]
&
0x20
)
!=
0
)
button
=
3
;
if
((
bytes
[
0
]
&
0x40
)
!=
0
)
button
=
4
;
break
;
}
return
button
;
}
const
char
*
scanbtnd_get_sane_device_descriptor
(
scanner_t
*
scanner
)
{
return
scanner
->
sane_device
;
}
int
scanbtnd_exit
(
void
)
{
syslog
(
LOG_INFO
,
"plustek-backend: exit"
);
plustek_detach_scanners
();
libusb_exit
(
libusb_handle
);
return
0
;
}
src/scanbuttond-0.2.3/backends/plustek.h
deleted
100644 → 0
View file @
0fe94fc2
// plustek.h: Plustek device backend
// This file is part of scanbuttond.
// Copyleft )c( 2005 by Hans Verkuil
// Copyleft )c( 2005 by Bernhard Stiftner
//
// This program is free software; you can redistribute it and/or
// modify it under the terms of the GNU General Public License as
// published by the Free Software Foundation; either version 2 of the
// License, or (at your option) any later version.
//
// This program is distributed in the hope that it will be useful, but
// WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
// General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program; if not, write to the Free Software
// Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
#ifndef __PLUSTEK_H_INCLUDED
#define __PLUSTEK_H_INCLUDED
#include "scanbuttond/backend.h"
#endif
src/scanbuttond-0.2.3/backends/plustek_umax.c
deleted
100644 → 0
View file @
0fe94fc2
// plustek_umax.c: Plustek device backend for UMAX models
// This file is part of scanbuttond.
// Copyleft )c( 2005 by Hans Verkuil
// Copyleft )c( 2005-2006 by Bernhard Stiftner
//
// This program is free software; you can redistribute it and/or
// modify it under the terms of the GNU General Public License as
// published by the Free Software Foundation; either version 2 of the
// License, or (at your option) any later version.
//
// This program is distributed in the hope that it will be useful, but
// WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
// General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program; if not, write to the Free Software
// Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
#include <errno.h>
#include <syslog.h>
#include "scanbuttond/scanbuttond.h"
#include "scanbuttond/libusbi.h"
#include "plustek_umax.h"
static
char
*
backend_name
=
"Plustek USB for UMAX"
;
#define NUM_SUPPORTED_USB_DEVICES 1
static
int
supported_usb_devices
[
NUM_SUPPORTED_USB_DEVICES
][
3
]
=
{
// vendor, product, num_buttons
{
0x1606
,
0x0060
,
4
}
// UMAX Astra 3400 (3450?)
};
static
char
*
usb_device_descriptions
[
NUM_SUPPORTED_USB_DEVICES
][
2
]
=
{
{
"UMAX"
,
"Astra 3400/3450"
}
};
libusb_handle_t
*
libusb_handle
;
scanner_t
*
plustek_scanners
=
NULL
;
// returns -1 if the scanner is unsupported, or the index of the
// corresponding vendor-product pair in the supported_usb_devices array.
int
plustek_match_libusb_scanner
(
libusb_device_t
*
device
)
{
int
index
;
for
(
index
=
0
;
index
<
NUM_SUPPORTED_USB_DEVICES
;
index
++
)
{
if
(
supported_usb_devices
[
index
][
0
]
==
device
->
vendorID
&&
supported_usb_devices
[
index
][
1
]
==
device
->
productID
)
{
break
;
}
}
if
(
index
>=
NUM_SUPPORTED_USB_DEVICES
)
return
-
1
;
return
index
;
}
void
plustek_attach_libusb_scanner
(
libusb_device_t
*
device
)
{
const
char
*
descriptor_prefix
=
"plustek:libusb:"
;
int
index
=
plustek_match_libusb_scanner
(
device
);
if
(
index
<
0
)
return
;
// unsupported
scanner_t
*
scanner
=
(
scanner_t
*
)
malloc
(
sizeof
(
scanner_t
));
scanner
->
vendor
=
usb_device_descriptions
[
index
][
0
];
scanner
->
product
=
usb_device_descriptions
[
index
][
1
];
scanner
->
connection
=
CONNECTION_LIBUSB
;
scanner
->
internal_dev_ptr
=
(
void
*
)
device
;
scanner
->
lastbutton
=
0
;
scanner
->
sane_device
=
(
char
*
)
malloc
(
strlen
(
device
->
location
)
+
strlen
(
descriptor_prefix
)
+
1
);
strcpy
(
scanner
->
sane_device
,
descriptor_prefix
);
strcat
(
scanner
->
sane_device
,
device
->
location
);
scanner
->
num_buttons
=
supported_usb_devices
[
index
][
2
];
scanner
->
is_open
=
0
;
scanner
->
next
=
plustek_scanners
;
plustek_scanners
=
scanner
;
}
void
plustek_detach_scanners
(
void
)
{
scanner_t
*
next
;
while
(
plustek_scanners
!=
NULL
)
{
next
=
plustek_scanners
->
next
;
free
(
plustek_scanners
->
sane_device
);
free
(
plustek_scanners
);
plustek_scanners
=
next
;
}
}
void
plustek_scan_devices
(
libusb_device_t
*
devices
)
{
int
index
;
libusb_device_t
*
device
=
devices
;
while
(
device
!=
NULL
)
{
index
=
plustek_match_libusb_scanner
(
device
);
if
(
index
>=
0
)
plustek_attach_libusb_scanner
(
device
);
device
=
device
->
next
;
}
}
int
plustek_init_libusb
(
void
)
{
libusb_device_t
*
devices
;
libusb_handle
=
libusb_init
();
devices
=
libusb_get_devices
(
libusb_handle
);
plustek_scan_devices
(
devices
);
return
0
;
}
const
char
*
scanbtnd_get_backend_name
(
void
)
{
return
backend_name
;
}
int
scanbtnd_init
(
void
)
{
plustek_scanners
=
NULL
;
syslog
(
LOG_INFO
,
"plustek-umax-backend: init"
);
return
plustek_init_libusb
();
}
int
scanbtnd_rescan
(
void
)
{
libusb_device_t
*
devices
;
plustek_detach_scanners
();
plustek_scanners
=
NULL
;
libusb_rescan
(
libusb_handle
);
devices
=
libusb_get_devices
(
libusb_handle
);
plustek_scan_devices
(
devices
);
return
0
;
}
const
scanner_t
*
scanbtnd_get_supported_devices
(
void
)
{
return
plustek_scanners
;
}
int
scanbtnd_open
(
scanner_t
*
scanner
)
{
int
result
=
-
ENOSYS
;
if
(
scanner
->
is_open
)
return
-
EINVAL
;
switch
(
scanner
->
connection
)
{
case
CONNECTION_LIBUSB
:
// if devices have been added/removed, return -ENODEV to
// make scanbuttond update its device list
if
(
libusb_get_changed_device_count
()
!=
0
)
return
-
ENODEV
;
result
=
libusb_open
((
libusb_device_t
*
)
scanner
->
internal_dev_ptr
);
break
;
}
if
(
result
==
0
)
scanner
->
is_open
=
1
;
return
result
;
}
int
scanbtnd_close
(
scanner_t
*
scanner
)
{
int
result
=
-
ENOSYS
;
if
(
!
scanner
->
is_open
)
return
-
EINVAL
;
switch
(
scanner
->
connection
)
{
case
CONNECTION_LIBUSB
:
result
=
libusb_close
((
libusb_device_t
*
)
scanner
->
internal_dev_ptr
);
break
;
}
if
(
result
==
0
)
scanner
->
is_open
=
0
;
return
result
;
}
int
plustek_read
(
scanner_t
*
scanner
,
void
*
buffer
,
int
bytecount
)
{
switch
(
scanner
->
connection
)
{
case
CONNECTION_LIBUSB
:
return
libusb_read
((
libusb_device_t
*
)
scanner
->
internal_dev_ptr
,
buffer
,
bytecount
);
break
;
}
return
-
1
;
}
int
plustek_write
(
scanner_t
*
scanner
,
void
*
buffer
,
int
bytecount
)
{
switch
(
scanner
->
connection
)
{
case
CONNECTION_LIBUSB
:
return
libusb_write
((
libusb_device_t
*
)
scanner
->
internal_dev_ptr
,
buffer
,
bytecount
);
break
;
}
return
-
1
;
}
void
plustek_flush
(
scanner_t
*
scanner
)
{
switch
(
scanner
->
connection
)
{
case
CONNECTION_LIBUSB
:
libusb_flush
((
libusb_device_t
*
)
scanner
->
internal_dev_ptr
);
break
;
}
}
int
scanbtnd_get_button
(
scanner_t
*
scanner
)
{
unsigned
char
bytes
[
255
];
int
num_bytes
;
int
button
=
0
;
bytes
[
0
]
=
1
;
bytes
[
1
]
=
2
;
bytes
[
2
]
=
0
;
bytes
[
3
]
=
1
;
if
(
!
scanner
->
is_open
)
return
-
EINVAL
;
num_bytes
=
plustek_write
(
scanner
,
(
void
*
)
bytes
,
4
);
if
(
num_bytes
!=
4
)
{
plustek_flush
(
scanner
);
return
0
;
}
num_bytes
=
plustek_read
(
scanner
,
(
void
*
)
bytes
,
1
);
if
(
num_bytes
!=
1
)
{
plustek_flush
(
scanner
);
return
0
;
}
switch
(
scanner
->
num_buttons
)
{
case
1
:
// not tested
if
((
bytes
[
0
]
&
0x04
)
!=
0
)
button
=
1
;
break
;
case
2
:
// not tested
if
((
bytes
[
0
]
&
0x08
)
!=
0
)
button
=
1
;
if
((
bytes
[
0
]
&
0x04
)
!=
0
)
button
=
2
;
break
;
case
3
:
// not tested
if
((
bytes
[
0
]
&
0x10
)
!=
0
)
button
=
1
;
if
((
bytes
[
0
]
&
0x08
)
!=
0
)
button
=
2
;
if
((
bytes
[
0
]
&
0x04
)
!=
0
)
button
=
3
;
break
;
case
4
:
// only tested on UMAX Astra 3400
if
((
bytes
[
0
]
&
0x04
)
!=
0
)
button
=
1
;
if
((
bytes
[
0
]
&
0x08
)
!=
0
)
button
=
2
;
if
((
bytes
[
0
]
&
0x40
)
!=
0
)
button
=
3
;
if
((
bytes
[
0
]
&
0x20
)
!=
0
)
button
=
4
;
break
;
}
return
button
;
}
const
char
*
scanbtnd_get_sane_device_descriptor
(
scanner_t
*
scanner
)
{
return
scanner
->
sane_device
;
}
int
scanbtnd_exit
(
void
)
{
syslog
(
LOG_INFO
,
"plustek-umax-backend: exit"
);
plustek_detach_scanners
();
libusb_exit
(
libusb_handle
);
return
0
;
}
src/scanbuttond-0.2.3/backends/plustek_umax.h
deleted
100644 → 0
View file @
0fe94fc2
// plustek_umax.h: Plustek device backend for UMAX models
// This file is part of scanbuttond.
// Copyleft )c( 2005 by Hans Verkuil
// Copyleft )c( 2005 by Bernhard Stiftner
//
// This program is free software; you can redistribute it and/or
// modify it under the terms of the GNU General Public License as
// published by the Free Software Foundation; either version 2 of the
// License, or (at your option) any later version.
//
// This program is distributed in the hope that it will be useful, but
// WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
// General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program; if not, write to the Free Software
// Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
#ifndef __PLUSTEK_UMAX_H_INCLUDED
#define __PLUSTEK_UMAX_H_INCLUDED
#include "scanbuttond/backend.h"
#endif
src/scanbuttond-0.2.3/backends/snapscan.c
deleted
100644 → 0
View file @
0fe94fc2
// snapscan.c: Snapscan device backend
// This file is part of scanbuttond.
// Copyleft )c( 2005-2006 by Bernhard Stiftner
// Thanks to J. Javier Maestro for sniffing the button codes ;-)
//
// This program is free software; you can redistribute it and/or
// modify it under the terms of the GNU General Public License as
// published by the Free Software Foundation; either version 2 of the
// License, or (at your option) any later version.
//
// This program is distributed in the hope that it will be useful, but
// WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
// General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program; if not, write to the Free Software
// Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
#include <errno.h>
#include <syslog.h>
#include "scanbuttond/scanbuttond.h"
#include "scanbuttond/libusbi.h"
#include "snapscan.h"
static
char
*
backend_name
=
"Snapscan USB"
;
#define NUM_SUPPORTED_USB_DEVICES 3
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
};
// TODO: check if this backend really works on the Epson 2580 too...
static
char
*
usb_device_descriptions
[
NUM_SUPPORTED_USB_DEVICES
][
2
]
=
{
{
"Epson"
,
"Perfection 2480 / 2580"
},
{
"Epson"
,
"Perfection 1670"
},
{
"Epson"
,
"Perfection 3490"
}
};
libusb_handle_t
*
libusb_handle
;
scanner_t
*
snapscan_scanners
=
NULL
;
// returns -1 if the scanner is unsupported, or the index of the
// corresponding vendor-product pair in the supported_usb_devices array.
int
snapscan_match_libusb_scanner
(
libusb_device_t
*
device
)
{
int
index
;
for
(
index
=
0
;
index
<
NUM_SUPPORTED_USB_DEVICES
;
index
++
)
{
if
(
supported_usb_devices
[
index
][
0
]
==
device
->
vendorID
&&
supported_usb_devices
[
index
][
1
]
==
device
->
productID
)
{
break
;
}
}
if
(
index
>=
NUM_SUPPORTED_USB_DEVICES
)
return
-
1
;
return
index
;
}
void
snapscan_attach_libusb_scanner
(
libusb_device_t
*
device
)
{
const
char
*
descriptor_prefix
=
"snapscan:libusb:"
;
int
index
=
snapscan_match_libusb_scanner
(
device
);
if
(
index
<
0
)
return
;
// unsupported
scanner_t
*
scanner
=
(
scanner_t
*
)
malloc
(
sizeof
(
scanner_t
));
scanner
->
vendor
=
usb_device_descriptions
[
index
][
0
];
scanner
->
product
=
usb_device_descriptions
[
index
][
1
];
scanner
->
connection
=
CONNECTION_LIBUSB
;
scanner
->
internal_dev_ptr
=
(
void
*
)
device
;
scanner
->
lastbutton
=
0
;
scanner
->
sane_device
=
(
char
*
)
malloc
(
strlen
(
device
->
location
)
+
strlen
(
descriptor_prefix
)
+
1
);
strcpy
(
scanner
->
sane_device
,
descriptor_prefix
);
strcat
(
scanner
->
sane_device
,
device
->
location
);
scanner
->
num_buttons
=
supported_usb_devices
[
index
][
2
];
scanner
->
is_open
=
0
;
scanner
->
next
=
snapscan_scanners
;
snapscan_scanners
=
scanner
;
}
void
snapscan_detach_scanners
(
void
)
{
scanner_t
*
next
;
while
(
snapscan_scanners
!=
NULL
)
{
next
=
snapscan_scanners
->
next
;
free
(
snapscan_scanners
->
sane_device
);
free
(
snapscan_scanners
);
snapscan_scanners
=
next
;
}
}
void
snapscan_scan_devices
(
libusb_device_t
*
devices
)
{
int
index
;
libusb_device_t
*
device
=
devices
;
while
(
device
!=
NULL
)
{
index
=
snapscan_match_libusb_scanner
(
device
);
if
(
index
>=
0
)
snapscan_attach_libusb_scanner
(
device
);
device
=
device
->
next
;
}
}
int
snapscan_init_libusb
(
void
)
{
libusb_device_t
*
devices
;
libusb_handle
=
libusb_init
();
devices
=
libusb_get_devices
(
libusb_handle
);
snapscan_scan_devices
(
devices
);
return
0
;
}
const
char
*
scanbtnd_get_backend_name
(
void
)
{
return
backend_name
;
}
int
scanbtnd_init
(
void
)
{
snapscan_scanners
=
NULL
;
syslog
(
LOG_INFO
,
"snapscan-backend: init"
);
return
snapscan_init_libusb
();
}
int
scanbtnd_rescan
(
void
)
{
libusb_device_t
*
devices
;
snapscan_detach_scanners
();
snapscan_scanners
=
NULL
;
libusb_rescan
(
libusb_handle
);
devices
=
libusb_get_devices
(
libusb_handle
);
snapscan_scan_devices
(
devices
);
return
0
;
}
const
scanner_t
*
scanbtnd_get_supported_devices
(
void
)
{
return
snapscan_scanners
;
}
int
scanbtnd_open
(
scanner_t
*
scanner
)
{
int
result
=
-
ENOSYS
;
if
(
scanner
->
is_open
)
return
-
EINVAL
;
switch
(
scanner
->
connection
)
{
case
CONNECTION_LIBUSB
:
// if devices have been added/removed, return -ENODEV to
// make scanbuttond update its device list
if
(
libusb_get_changed_device_count
()
!=
0
)
return
-
ENODEV
;
result
=
libusb_open
((
libusb_device_t
*
)
scanner
->
internal_dev_ptr
);
break
;
}
if
(
result
==
0
)
scanner
->
is_open
=
1
;
return
result
;
}
int
scanbtnd_close
(
scanner_t
*
scanner
)
{
int
result
=
-
ENOSYS
;
if
(
!
scanner
->
is_open
)
return
-
EINVAL
;
switch
(
scanner
->
connection
)
{
case
CONNECTION_LIBUSB
:
result
=
libusb_close
((
libusb_device_t
*
)
scanner
->
internal_dev_ptr
);
break
;
}
if
(
result
==
0
)
scanner
->
is_open
=
0
;
return
result
;
}
int
snapscan_read
(
scanner_t
*
scanner
,
void
*
buffer
,
int
bytecount
)
{
switch
(
scanner
->
connection
)
{
case
CONNECTION_LIBUSB
:
return
libusb_read
((
libusb_device_t
*
)
scanner
->
internal_dev_ptr
,
buffer
,
bytecount
);
break
;
}
return
-
1
;
}
int
snapscan_write
(
scanner_t
*
scanner
,
void
*
buffer
,
int
bytecount
)
{
switch
(
scanner
->
connection
)
{
case
CONNECTION_LIBUSB
:
return
libusb_write
((
libusb_device_t
*
)
scanner
->
internal_dev_ptr
,
buffer
,
bytecount
);
break
;
}
return
-
1
;
}
void
snapscan_flush
(
scanner_t
*
scanner
)
{
switch
(
scanner
->
connection
)
{
case
CONNECTION_LIBUSB
:
libusb_flush
((
libusb_device_t
*
)
scanner
->
internal_dev_ptr
);
break
;
}
}
int
scanbtnd_get_button
(
scanner_t
*
scanner
)
{
unsigned
char
bytes
[
255
];
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
)
{
snapscan_flush
(
scanner
);
return
0
;
}
num_bytes
=
snapscan_read
(
scanner
,
(
void
*
)
bytes
,
8
);
if
(
num_bytes
!=
8
||
bytes
[
0
]
!=
0xF9
)
{
snapscan_flush
(
scanner
);
return
0
;
}
num_bytes
=
snapscan_read
(
scanner
,
(
void
*
)
bytes
,
20
);
if
(
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
;
}
}
num_bytes
=
snapscan_read
(
scanner
,
(
void
*
)
bytes
,
8
);
if
(
num_bytes
!=
8
||
bytes
[
0
]
!=
0xFB
)
{
snapscan_flush
(
scanner
);
return
0
;
}
return
button
;
}
const
char
*
scanbtnd_get_sane_device_descriptor
(
scanner_t
*
scanner
)
{
return
scanner
->
sane_device
;
}
int
scanbtnd_exit
(
void
)
{
syslog
(
LOG_INFO
,
"snapscan-backend: exit"
);
snapscan_detach_scanners
();
libusb_exit
(
libusb_handle
);
return
0
;
}
src/scanbuttond-0.2.3/backends/snapscan.h
deleted
100644 → 0
View file @
0fe94fc2
// snapscan.h: Snapscan device backend
// This file is part of scanbuttond.
// Copyleft )c( 2005 by Bernhard Stiftner
// Thanks to J. Javier Maestro for sniffing the button codes ;-)
//
// This program is free software; you can redistribute it and/or
// modify it under the terms of the GNU General Public License as
// published by the Free Software Foundation; either version 2 of the
// License, or (at your option) any later version.
//
// This program is distributed in the hope that it will be useful, but
// WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
// General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program; if not, write to the Free Software
// Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
#ifndef __SNAPSCAN_H_INCLUDED
#define __SNAPSCAN_H_INCLUDED
#include "scanbuttond/backend.h"
#endif
src/scanbuttond-0.2.3/config.guess
deleted
100644 → 0
View file @
0fe94fc2
This diff is collapsed.
Click to expand it.
src/scanbuttond-0.2.3/config.sub
deleted
100644 → 0
View file @
0fe94fc2
This diff is collapsed.
Click to expand it.
src/scanbuttond-0.2.3/configure
deleted
100644 → 0
View file @
0fe94fc2
This diff is collapsed.
Click to expand it.
src/scanbuttond-0.2.3/configure.in
deleted
100644 → 0
View file @
0fe94fc2
AC_INIT([scanbuttond], [0.2.3], [root84@users.soureforge.net])
AC_CONFIG_HEADERS([include/scanbuttond/config.h])
AM_INIT_AUTOMAKE
AC_DISABLE_STATIC
AC_LANG_C
AC_PROG_CC
AC_PROG_LIBTOOL
AC_CHECK_HEADERS(errno.h string.h syslog.h unistd.h dlfcn.h usb.h)
CFLAGS="${CFLAGS} -DCFG_DIR=\$(pkgsysconfdir) -DLIB_DIR=\$(libdir)"
AC_OUTPUT(Makefile contrib/Makefile interface/Makefile backends/Makefile scripts/Makefile)
src/scanbuttond-0.2.3/contrib/Makefile.am
deleted
100644 → 0
View file @
0fe94fc2
EXTRA_DIST
=
initscript.gentoo
src/scanbuttond-0.2.3/contrib/Makefile.in
deleted
100644 → 0
View file @
0fe94fc2
# Makefile.in generated by automake 1.9.6 from Makefile.am.
# @configure_input@
# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
# 2003, 2004, 2005 Free Software Foundation, Inc.
# This Makefile.in is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
# with or without modifications, as long as this notice is preserved.
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
# PARTICULAR PURPOSE.
@SET_MAKE@
srcdir
=
@srcdir@
top_srcdir
=
@top_srcdir@
VPATH
=
@srcdir@
pkgdatadir
=
$(datadir)
/@PACKAGE@
pkglibdir
=
$(libdir)
/@PACKAGE@
pkgincludedir
=
$(includedir)
/@PACKAGE@
top_builddir
=
..
am__cd
=
CDPATH
=
"
$
${
ZSH_VERSION
+.
}
$(PATH_SEPARATOR)
"
&&
cd
INSTALL
=
@INSTALL@
install_sh_DATA
=
$(install_sh)
-c
-m
644
install_sh_PROGRAM
=
$(install_sh)
-c
install_sh_SCRIPT
=
$(install_sh)
-c
INSTALL_HEADER
=
$(INSTALL_DATA)
transform
=
$(program_transform_name)
NORMAL_INSTALL
=
:
PRE_INSTALL
=
:
POST_INSTALL
=
:
NORMAL_UNINSTALL
=
:
PRE_UNINSTALL
=
:
POST_UNINSTALL
=
:
build_triplet
=
@build@
host_triplet
=
@host@
subdir
=
contrib
DIST_COMMON
=
$(srcdir)
/Makefile.am
$(srcdir)
/Makefile.in
ACLOCAL_M4
=
$(top_srcdir)
/aclocal.m4
am__aclocal_m4_deps
=
$(top_srcdir)
/configure.in
am__configure_deps
=
$(am__aclocal_m4_deps)
$(CONFIGURE_DEPENDENCIES)
\
$(ACLOCAL_M4)
mkinstalldirs
=
$(install_sh)
-d
CONFIG_HEADER
=
$(top_builddir)
/include/scanbuttond/config.h
CONFIG_CLEAN_FILES
=
SOURCES
=
DIST_SOURCES
=
DISTFILES
=
$(DIST_COMMON)
$(DIST_SOURCES)
$(TEXINFOS)
$(EXTRA_DIST)
ACLOCAL
=
@ACLOCAL@
AMDEP_FALSE
=
@AMDEP_FALSE@
AMDEP_TRUE
=
@AMDEP_TRUE@
AMTAR
=
@AMTAR@
AR
=
@AR@
AUTOCONF
=
@AUTOCONF@
AUTOHEADER
=
@AUTOHEADER@
AUTOMAKE
=
@AUTOMAKE@
AWK
=
@AWK@
CC
=
@CC@
CCDEPMODE
=
@CCDEPMODE@
CFLAGS
=
@CFLAGS@
CPP
=
@CPP@
CPPFLAGS
=
@CPPFLAGS@
CXX
=
@CXX@
CXXCPP
=
@CXXCPP@
CXXDEPMODE
=
@CXXDEPMODE@
CXXFLAGS
=
@CXXFLAGS@
CYGPATH_W
=
@CYGPATH_W@
DEFS
=
@DEFS@
DEPDIR
=
@DEPDIR@
ECHO
=
@ECHO@
ECHO_C
=
@ECHO_C@
ECHO_N
=
@ECHO_N@
ECHO_T
=
@ECHO_T@
EGREP
=
@EGREP@
EXEEXT
=
@EXEEXT@
F77
=
@F77@
FFLAGS
=
@FFLAGS@
INSTALL_DATA
=
@INSTALL_DATA@
INSTALL_PROGRAM
=
@INSTALL_PROGRAM@
INSTALL_SCRIPT
=
@INSTALL_SCRIPT@
INSTALL_STRIP_PROGRAM
=
@INSTALL_STRIP_PROGRAM@
LDFLAGS
=
@LDFLAGS@
LIBOBJS
=
@LIBOBJS@
LIBS
=
@LIBS@
LIBTOOL
=
@LIBTOOL@
LN_S
=
@LN_S@
LTLIBOBJS
=
@LTLIBOBJS@
MAKEINFO
=
@MAKEINFO@
OBJEXT
=
@OBJEXT@
PACKAGE
=
@PACKAGE@
PACKAGE_BUGREPORT
=
@PACKAGE_BUGREPORT@
PACKAGE_NAME
=
@PACKAGE_NAME@
PACKAGE_STRING
=
@PACKAGE_STRING@
PACKAGE_TARNAME
=
@PACKAGE_TARNAME@
PACKAGE_VERSION
=
@PACKAGE_VERSION@
PATH_SEPARATOR
=
@PATH_SEPARATOR@
RANLIB
=
@RANLIB@
SET_MAKE
=
@SET_MAKE@
SHELL
=
@SHELL@
STRIP
=
@STRIP@
VERSION
=
@VERSION@
ac_ct_AR
=
@ac_ct_AR@
ac_ct_CC
=
@ac_ct_CC@
ac_ct_CXX
=
@ac_ct_CXX@
ac_ct_F77
=
@ac_ct_F77@
ac_ct_RANLIB
=
@ac_ct_RANLIB@
ac_ct_STRIP
=
@ac_ct_STRIP@
am__fastdepCC_FALSE
=
@am__fastdepCC_FALSE@
am__fastdepCC_TRUE
=
@am__fastdepCC_TRUE@
am__fastdepCXX_FALSE
=
@am__fastdepCXX_FALSE@
am__fastdepCXX_TRUE
=
@am__fastdepCXX_TRUE@
am__include
=
@am__include@
am__leading_dot
=
@am__leading_dot@
am__quote
=
@am__quote@
am__tar
=
@am__tar@
am__untar
=
@am__untar@
bindir
=
@bindir@
build
=
@build@
build_alias
=
@build_alias@
build_cpu
=
@build_cpu@
build_os
=
@build_os@
build_vendor
=
@build_vendor@
datadir
=
@datadir@
exec_prefix
=
@exec_prefix@
host
=
@host@
host_alias
=
@host_alias@
host_cpu
=
@host_cpu@
host_os
=
@host_os@
host_vendor
=
@host_vendor@
includedir
=
@includedir@
infodir
=
@infodir@
install_sh
=
@install_sh@
libdir
=
@libdir@
libexecdir
=
@libexecdir@
localstatedir
=
@localstatedir@
mandir
=
@mandir@
mkdir_p
=
@mkdir_p@
oldincludedir
=
@oldincludedir@
prefix
=
@prefix@
program_transform_name
=
@program_transform_name@
sbindir
=
@sbindir@
sharedstatedir
=
@sharedstatedir@
sysconfdir
=
@sysconfdir@
target_alias
=
@target_alias@
EXTRA_DIST
=
initscript.gentoo
all
:
all-am
.SUFFIXES
:
$(srcdir)/Makefile.in
:
$(srcdir)/Makefile.am $(am__configure_deps)
@
for
dep
in
$?
;
do
\
case
'
$(am__configure_deps)
'
in
\
*
$$
dep
*
)
\
cd
$(top_builddir)
&&
$(MAKE)
$(AM_MAKEFLAGS)
am--refresh
\
&&
exit
0
;
\
exit
1
;;
\
esac
;
\
done
;
\
echo
' cd
$(top_srcdir)
&&
$(AUTOMAKE)
--gnu contrib/Makefile'
;
\
cd
$(top_srcdir)
&&
\
$(AUTOMAKE)
--gnu
contrib/Makefile
.PRECIOUS
:
Makefile
Makefile
:
$(srcdir)/Makefile.in $(top_builddir)/config.status
@
case
'$?'
in
\
*
config.status
*
)
\
cd
$(top_builddir)
&&
$(MAKE)
$(AM_MAKEFLAGS)
am--refresh
;;
\
*
)
\
echo
' cd
$(top_builddir)
&&
$(SHELL)
./config.status
$(subdir)
/$@
$(am__depfiles_maybe)
'
;
\
cd
$(top_builddir)
&&
$(SHELL)
./config.status
$(subdir)
/
$@
$(am__depfiles_maybe)
;;
\
esac
;
$(top_builddir)/config.status
:
$(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
cd
$(top_builddir)
&&
$(MAKE)
$(AM_MAKEFLAGS)
am--refresh
$(top_srcdir)/configure
:
$(am__configure_deps)
cd
$(top_builddir)
&&
$(MAKE)
$(AM_MAKEFLAGS)
am--refresh
$(ACLOCAL_M4)
:
$(am__aclocal_m4_deps)
cd
$(top_builddir)
&&
$(MAKE)
$(AM_MAKEFLAGS)
am--refresh
mostlyclean-libtool
:
-
rm
-f
*
.lo
clean-libtool
:
-
rm
-rf
.libs _libs
distclean-libtool
:
-
rm
-f
libtool
uninstall-info-am
:
tags
:
TAGS
TAGS
:
ctags
:
CTAGS
CTAGS
:
distdir
:
$(DISTFILES)
@
srcdirstrip
=
`
echo
"
$(srcdir)
"
|
sed
's|.|.|g'
`
;
\
topsrcdirstrip
=
`
echo
"
$(top_srcdir)
"
|
sed
's|.|.|g'
`
;
\
list
=
'
$(DISTFILES)
'
;
for
file
in
$$
list
;
do
\
case
$$
file
in
\
$(srcdir)
/
*
)
file
=
`
echo
"
$$
file"
|
sed
"s|^
$$
srcdirstrip/||"
`
;;
\
$(top_srcdir)
/
*
)
file
=
`
echo
"
$$
file"
|
sed
"s|^
$$
topsrcdirstrip/|
$(top_builddir)
/|"
`
;;
\
esac
;
\
if
test
-f
$$
file
||
test
-d
$$
file
;
then
d
=
.
;
else
d
=
$(srcdir)
;
fi
;
\
dir
=
`
echo
"
$$
file"
|
sed
-e
's,/[^/]*$$,,'
`
;
\
if
test
"
$$
dir"
!=
"
$$
file"
&&
test
"
$$
dir"
!=
"."
;
then
\
dir
=
"/
$$
dir"
;
\
$(mkdir_p)
"
$(distdir)$$
dir"
;
\
else
\
dir
=
''
;
\
fi
;
\
if
test
-d
$$
d/
$$
file
;
then
\
if
test
-d
$(srcdir)
/
$$
file
&&
test
$$
d
!=
$(srcdir)
;
then
\
cp
-pR
$(srcdir)
/
$$
file
$(distdir)$$
dir
||
exit
1
;
\
fi
;
\
cp
-pR
$$
d/
$$
file
$(distdir)$$
dir
||
exit
1
;
\
else
\
test
-f
$(distdir)
/
$$
file
\
||
cp
-p
$$
d/
$$
file
$(distdir)
/
$$
file
\
||
exit
1
;
\
fi
;
\
done
check-am
:
all-am
check
:
check-am
all-am
:
Makefile
installdirs
:
install
:
install-am
install-exec
:
install-exec-am
install-data
:
install-data-am
uninstall
:
uninstall-am
install-am
:
all-am
@
$(MAKE)
$(AM_MAKEFLAGS)
install-exec-am install-data-am
installcheck
:
installcheck-am
install-strip
:
$(MAKE)
$(AM_MAKEFLAGS)
INSTALL_PROGRAM
=
"
$(INSTALL_STRIP_PROGRAM)
"
\
install_sh_PROGRAM
=
"
$(INSTALL_STRIP_PROGRAM)
"
INSTALL_STRIP_FLAG
=
-s
\
`
test
-z
'
$(STRIP)
'
||
\
echo
"INSTALL_PROGRAM_ENV=STRIPPROG='
$(STRIP)
'"
`
install
mostlyclean-generic
:
clean-generic
:
distclean-generic
:
-
test
-z
"
$(CONFIG_CLEAN_FILES)
"
||
rm
-f
$(CONFIG_CLEAN_FILES)
maintainer-clean-generic
:
@
echo
"This command is intended for maintainers to use"
@
echo
"it deletes files that may require special tools to rebuild."
clean
:
clean-am
clean-am
:
clean-generic clean-libtool mostlyclean-am
distclean
:
distclean-am
-
rm
-f
Makefile
distclean-am
:
clean-am distclean-generic distclean-libtool
dvi
:
dvi-am
dvi-am
:
html
:
html-am
info
:
info-am
info-am
:
install-data-am
:
install-exec-am
:
install-info
:
install-info-am
install-man
:
installcheck-am
:
maintainer-clean
:
maintainer-clean-am
-
rm
-f
Makefile
maintainer-clean-am
:
distclean-am maintainer-clean-generic
mostlyclean
:
mostlyclean-am
mostlyclean-am
:
mostlyclean-generic mostlyclean-libtool
pdf
:
pdf-am
pdf-am
:
ps
:
ps-am
ps-am
:
uninstall-am
:
uninstall-info-am
.PHONY
:
all all-am check check-am clean clean-generic clean-libtool
\
distclean distclean-generic distclean-libtool distdir dvi
\
dvi-am html html-am info info-am install install-am
\
install-data install-data-am install-exec install-exec-am
\
install-info install-info-am install-man install-strip
\
installcheck installcheck-am installdirs maintainer-clean
\
maintainer-clean-generic mostlyclean mostlyclean-generic
\
mostlyclean-libtool pdf pdf-am ps ps-am uninstall uninstall-am
\
uninstall-info-am
# Tell versions [3.59,3.63) of GNU make to not export all variables.
# Otherwise a system limit (for SysV at least) may be exceeded.
.NOEXPORT
:
src/scanbuttond-0.2.3/contrib/initscript.gentoo
deleted
100644 → 0
View file @
0fe94fc2
#!/sbin/runscript
# scanbuttond init script for Gentoo
# copy it to /etc/init.d/scanbuttond
#
# Copyright 2005 by Bernhard Stiftner
# Distributed under the terms of the GNU General Public License v2
depend() {
need hotplug
}
start() {
ebegin "Starting scanner button daemon"
start-stop-daemon --chuid scanner:scanner --start --quiet --exec /usr/local/bin/scanbuttond
eend $?
}
stop() {
ebegin "Stopping scanner button daemon"
start-stop-daemon --stop --quiet --exec /usr/local/bin/scanbuttond
eend $?
}
src/scanbuttond-0.2.3/depcomp
deleted
100644 → 0
View file @
0fe94fc2
This diff is collapsed.
Click to expand it.
src/scanbuttond-0.2.3/include/scanbuttond/backend.h
deleted
100644 → 0
View file @
0fe94fc2
// backend.h: specification of the mandatory backend functions
// This file is part of scanbuttond.
// Copyleft )c( 2004-2005 by Bernhard Stiftner
//
// This program is free software; you can redistribute it and/or
// modify it under the terms of the GNU General Public License as
// published by the Free Software Foundation; either version 2 of the
// License, or (at your option) any later version.
//
// This program is distributed in the hope that it will be useful, but
// WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
// General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program; if not, write to the Free Software
// Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
#ifndef __BACKEND_H_INCLUDED
#define __BACKEND_H_INCLUDED
#include "scanbuttond/scanbuttond.h"
/**
* \file backend.h
* \brief Backend function specification.
*
* This file specifies which functions a scanbuttond backend has to
* provide and how it is supposed to interact with with the rest
* of the system.
*/
/**
* Gets the name of this backend.
* \return the backend name
*/
const
char
*
scanbtnd_get_backend_name
(
void
);
/**
* Initializes the backend.
* This function makes the backend ready to operate and searches for supported
* devices (see scanbtnd_get_supported_devices()).
* \return 0 if successful, <0 otherwise
*/
int
scanbtnd_init
(
void
);
/**
* Refreshes the list of supported devices.
* After this function has been called, scanbtnd_get_supported_devices()
* should only return devices which are currently present on this system.
* \return 0 if successful, <0 otherwise
*/
int
scanbtnd_rescan
(
void
);
/**
* Returns a list of devices which are currently driven by this backend.
* The devices are stored in a single-linked list.
* Note that the device list does not automagically refresh after pluggin in or
* unplugging a device. You have to explicitly call scanbtnd_rescan() to do
* that.
* \return a linked list of supported scanner devices
*/
const
scanner_t
*
scanbtnd_get_supported_devices
(
void
);
/**
* Opens the given scanner device.
* This function must be called before using scanbtnd_get_button().
* After calling this function, it is usually not possible for another process
* to access the scanner until scanbtnd_close() is called.
* \param scanner the scanner device to be opened
* \return 0 if successful, <0 otherwise
* \retval -ENODEV if the device is no longer present (or the device list has to
* be refreshed). In this case, call scanbtnd_rescan() and try again.
* \retval -EBUSY if the device is currently used by another process.
* \retval -EINVAL if the device is already open
* \retval -ENOSYS if there is no connection method to communicate with the device
*/
int
scanbtnd_open
(
scanner_t
*
scanner
);
/**
* Closes the given scanner device.
* This function must be called when you've finished querying the scanner button
* status using scanbtnd_get_button().
* After calling this function, other processes may access the device again.
* \param scanner the scanner device to be closed
* \return 0 if successful, <0 otherwise
* \retval -EINVAL if the device is already closed
* \retval -ENOSYS if there is no connection method to communicate with the device
*/
int
scanbtnd_close
(
scanner_t
*
scanner
);
/**
* Queries the scanner's button status.
* \param scanner the scanner device
* \return the number of the currently pressed button, 0 if no button is currently
* pressed, or <0 if there was an error.
* \retval -EINVAL if the scanner device has not been opened before
*/
int
scanbtnd_get_button
(
scanner_t
*
scanner
);
/**
* Gets the SANE device name of this scanner.
* The returned string should look like "epson:libusb:003:017".
* \param scanner the scanner device
* \return the SANE device name, or NULL if the SANE device name cannot be determined.
*/
const
char
*
scanbtnd_get_sane_device_descriptor
(
scanner_t
*
scanner
);
/**
* Shuts down this backend.
* Cleans up some internal data structures and frees some memory.
* \return 0 if successful, <0 otherwise
*/
int
scanbtnd_exit
(
void
);
#endif
src/scanbuttond-0.2.3/include/scanbuttond/common.h
deleted
100644 → 0
View file @
0fe94fc2
// common.h: useful stuff
// This file is part of scanbuttond.
// Copyleft )c( 2006 by Bernhard Stiftner
//
// This program is free software; you can redistribute it and/or
// modify it under the terms of the GNU General Public License as
// published by the Free Software Foundation; either version 2 of the
// License, or (at your option) any later version.
//
// This program is distributed in the hope that it will be useful, but
// WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
// General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program; if not, write to the Free Software
// Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
#ifndef __COMMON_H_INCLUDED
#define __COMMON_H_INCLUDED
#define STRINGIFY1(x) #x
#define STRINGIFY(x) STRINGIFY1(x)
#endif
src/scanbuttond-0.2.3/include/scanbuttond/config.h.in
deleted
100644 → 0
View file @
0fe94fc2
/* include/scanbuttond/config.h.in. Generated from configure.in by autoheader. */
/* Define to 1 if you have the <dlfcn.h> header file. */
#undef HAVE_DLFCN_H
/* Define to 1 if you have the <errno.h> header file. */
#undef HAVE_ERRNO_H
/* Define to 1 if you have the <inttypes.h> header file. */
#undef HAVE_INTTYPES_H
/* Define to 1 if you have the <memory.h> header file. */
#undef HAVE_MEMORY_H
/* Define to 1 if you have the <stdint.h> header file. */
#undef HAVE_STDINT_H
/* Define to 1 if you have the <stdlib.h> header file. */
#undef HAVE_STDLIB_H
/* Define to 1 if you have the <strings.h> header file. */
#undef HAVE_STRINGS_H
/* Define to 1 if you have the <string.h> header file. */
#undef HAVE_STRING_H
/* Define to 1 if you have the <syslog.h> header file. */
#undef HAVE_SYSLOG_H
/* Define to 1 if you have the <sys/stat.h> header file. */
#undef HAVE_SYS_STAT_H
/* Define to 1 if you have the <sys/types.h> header file. */
#undef HAVE_SYS_TYPES_H
/* Define to 1 if you have the <unistd.h> header file. */
#undef HAVE_UNISTD_H
/* Define to 1 if you have the <usb.h> header file. */
#undef HAVE_USB_H
/* Name of package */
#undef PACKAGE
/* Define to the address where bug reports for this package should be sent. */
#undef PACKAGE_BUGREPORT
/* Define to the full name of this package. */
#undef PACKAGE_NAME
/* Define to the full name and version of this package. */
#undef PACKAGE_STRING
/* Define to the one symbol short name of this package. */
#undef PACKAGE_TARNAME
/* Define to the version of this package. */
#undef PACKAGE_VERSION
/* Define to 1 if you have the ANSI C header files. */
#undef STDC_HEADERS
/* Version number of package */
#undef VERSION
src/scanbuttond-0.2.3/include/scanbuttond/libusbi.h
deleted
100644 → 0
View file @
0fe94fc2
// libusbi.h: libusb wrapper
// This file is part of scanbuttond.
// Copyleft )c( 2004-2006 by Bernhard Stiftner
//
// This program is free software; you can redistribute it and/or
// modify it under the terms of the GNU General Public License as
// published by the Free Software Foundation; either version 2 of the
// License, or (at your option) any later version.
//
// This program is distributed in the hope that it will be useful, but
// WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
// General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program; if not, write to the Free Software
// Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
#ifndef __LIBUSBI_H_INCLUDED
#define __LIBUSBI_H_INCLUDED
#include <usb.h>
#include "scanbuttond/scanbuttond.h"
struct
libusb_device
;
typedef
struct
libusb_device
libusb_device_t
;
struct
libusb_device
{
int
vendorID
;
int
productID
;
char
*
location
;
// bus number + ":" + device number
struct
usb_device
*
device
;
struct
usb_dev_handle
*
handle
;
// automatically set by libusb_open(...)
int
interface
;
int
out_endpoint
;
int
in_endpoint
;
libusb_device_t
*
next
;
};
struct
libusb_handle
;
typedef
struct
libusb_handle
libusb_handle_t
;
struct
libusb_handle
{
libusb_device_t
*
devices
;
// rescanning info, timestamps???
};
libusb_handle_t
*
libusb_init
(
void
);
// GLOBAL number of changed devices (does not require a handle!)
int
libusb_get_changed_device_count
(
void
);
void
libusb_rescan
(
libusb_handle_t
*
handle
);
libusb_device_t
*
libusb_get_devices
(
libusb_handle_t
*
handle
);
// returns 0 on success, -EBUSY if the scanner is currently in use,
// or -ENODEV if the scanner does no longer exist
int
libusb_open
(
libusb_device_t
*
device
);
int
libusb_close
(
libusb_device_t
*
device
);
int
libusb_read
(
libusb_device_t
*
device
,
void
*
buffer
,
int
bytecount
);
int
libusb_write
(
libusb_device_t
*
device
,
void
*
buffer
,
int
bytecount
);
// flush bulk read queue
void
libusb_flush
(
libusb_device_t
*
device
);
int
libusb_control_msg
(
libusb_device_t
*
device
,
int
requesttype
,
int
request
,
int
value
,
int
index
,
void
*
bytes
,
int
size
);
void
libusb_exit
(
libusb_handle_t
*
handle
);
#endif
src/scanbuttond-0.2.3/include/scanbuttond/loader.h
deleted
100644 → 0
View file @
0fe94fc2
This diff is collapsed.
Click to expand it.
Prev
1
2
3
Next
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment