/
README
139 lines (101 loc) · 6.08 KB
/
README
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
# brotherscankeyd: Scan Key Daemon for Brother Inc. Network Scanners
**2020-12-07:** Development stopped. You can find the current
version at https://github.com/FrankAbelbeck/brotherscankeyd2
--------------------------------------------------------------------------------
brotherscankeyd: Scan Key Daemon for Brother Inc. Network Scanners
--------------------------------------------------------------------------------
Copyright (C) 2016 Frank Abelbeck <frank.abelbeck@googlemail.com>
This file is part of the brotherscankeyd program "brotherscankeyd.py".
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 3 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, see <http://www.gnu.org/licenses/>.
--------------------------------------------------------------------------------
General information
--------------------------------------------------------------------------------
Author: Frank Abelbeck
Version: 2017-07-02-ALPHA
Licence: GNU General Public License version 3
--------------------------------------------------------------------------------
Disclaimer
--------------------------------------------------------------------------------
Recently I bought a Brother multifunction printer and was impressed by the Linux
support Brother apparently is providing. The device just worked. In addition,
Brother offers a small tool brscan-skey which makes it possible to initiate
scans via the printer's scan key.
I created this program because...
...brscan-skey is just a binary and I didn't want to install it on my server;
...the tool intrigued me -- how does it work?
brotherscankeyd is distributed in the hope that it will be of help. It comes
with absolutely no warranty (see license info above).
--------------------------------------------------------------------------------
Description
--------------------------------------------------------------------------------
This program offers a network service to execute scripts/programs if a scan key
event occurs. It registers scan-to entries on one or more network printers and
listens to UDP packets coming from these devices. If a known scan key action is
registered, the corresponding script is called.
--------------------------------------------------------------------------------
Requirements
--------------------------------------------------------------------------------
Which programs and libraries are needed?
(in parantheses: Gentoo Linux versions this program was created/tested with and
an URL for more information)
Python3 (3.4.5, https://www.python.org/)
net-snmp (5.7.3-r5, http://net-snmp.sourceforge.net/)
linuxfd (1.4.4, https://www.github.com/abelbeck/linuxfd)
--------------------------------------------------------------------------------
Installation
--------------------------------------------------------------------------------
Place the files in the following directories:
/usr/local/bin/brotherscankeyd.py
/usr/local/etc/brotherscankeyd.ini
/usr/local/share/brotherscankeyd/scan2image.sh
/usr/local/share/brotherscankeyd/scan2pdf.sh
Then you should edit brotherscankeyd.ini to reflect your system's configuration.
--------------------------------------------------------------------------------
Usage
--------------------------------------------------------------------------------
The service is started by calling brotherscankeyd.py with the start or daemonise
command. The latter will detach the program from the controlling terminal, thus
daemonising it.
Calling brotherscankeyd.py stop will stop the daemon. To control this behaviour,
the PID file /var/run/brotherscankeyd.pid is created. If this is not possible,
perhaps due to denied permission, the PID is placed in /tmp/brotherscankeyd.pid.
For further information, please consult the program's internal help system.
--------------------------------------------------------------------------------
Files
--------------------------------------------------------------------------------
brotherscankeyd.py main program
brotherscankeyd.ini default empty configuration file
brotherscankeyd OpenRC init script for brotherscankeyd.py
COPYING GPL v3 license text
README (this file)
scan2image.sh an example of a scan-to-image script
scan2pdf.sh an example of a scan-to-PDF script
--------------------------------------------------------------------------------
Changelog
--------------------------------------------------------------------------------
2016-07-05: initial release as "works for me" version (except for the scan
scripts scan2image.sh and scan2pdf.sh; they are still untested)
2016-07-10: switched to a unified output system (Python module logging and
custom ConsoleHandler for coloured output);
moved CONFIGFILE and PIDFILE to standard locations /etc and
/var/run respectively (program tries both paths);
scan2* scripts revisited, now seem to work; various bug fixes
2016-07-17: debugged program after first server trials; removed SEVERE scan
script quoting errors, altered script calling procedure,
introduced OpenRC init script
2016-07-25: moved SNMP requests into subprocess to avoid blocking the main loop
2016-08-06: fixed a script calling race condition (scanner not immediately ready
for connects of scanimage/scanadt after issuing a notification) by
introducing a two second delay
2017-06-24: removed pysnmp dependencies; SNMP requests are now sent with
/usr/bin/snmpset (http://net-snmp.sourceforge.net/).
2017-07-02: fixed process management: replaced proc.kill() with proc.terminate()