Aby debugować scanbd używamy polecenia:
Output:
scanbd: config-file: /etc/scanbd/scanbd.conf
scanbd: reading config file /etc/scanbd/scanbd.conf
scanbd: debug on: level: 7
scanbd: dropping privs to uid saned
scanbd: dropping privs to gid scanner
scanbd: group scanner has member:
scanbd: saned
scanbd: drop privileges to gid: 109
scanbd: Running as effective gid 109
scanbd: drop privileges to uid: 108
scanbd: Running as effective uid 108
scanbd: dbus_init
scanbd: dbus match type='signal',interface='org.freedesktop.Hal.Manager'
scanbd: SANE_CONFIG_DIR not set
scanbd: sane version 1.0
scanbd: Scanning for local-only devices
^Xscanbd: start_sane_threads
scanbd: start dbus thread
scanbd: Not Primary Owner (2)
scanbd: timeout: 500 ms
scanbd: Iteration on dbus call
Przykładowa konfiguracja:
debug = true
debug-level = 2
user = saned
group = scanner
saned = "/usr/sbin/saned"
timeout = 500
pidfile = "/var/run/scanbd.pid"
environment {
device = "SCANBD_DEVICE"
action = "SCANBD_ACTION"
}
function function_knob {
filter = "^message.*"
desc = "The value of the function knob / wheel / selector"
env = "SCANBD_FUNCTION"
}
function function_mode {
filter = "^mode.*"
desc = "Color mode"
env = "SCANBD_FUNCTION_MODE"
}
action scan {
filter = "^scan.*"
numerical-trigger {
from-value = 1
to-value = 0
}
desc = "Scan to file"
script = "/etc/scanbd/copy.sh"
}
action email {
filter = "^email$"
string-trigger {
from-value = ""
to-value = "^email.*"
}
desc = "Scan to email"
script = "/etc/scanbd/mail.sh"
}
action copy {
filter = "^copy$"
string-trigger {
from-value = ""
to-value = "^copy.*"
}
desc = "Copy to printer"
script = "/etc/scanbd/copy.sh"
}
action preview {
filter = "^preview$"
numerical-trigger {
from-value = 1
to-value = 0
}
desc = "Preview"
script = "/etc/scanbd/scan.sh"
}
action globaltest {
filter = "^message.*"
desc = "Test (print all env vars)"
script = "/etc/scanbd/pdf.sh"
}
action globaltest {
filter = "^pdf.*"
desc = "Test (print all env vars)"
script = "/etc/scanbd/pdf.sh"
}
}
include(scanner.d/canon.conf)
Zwróć uwagę na ostatnie linijki, które powinne zaierać Twój skaner.
W plikach mamy nazwy script np:
/etc/scanbd/pdf.sh
przykładowy plik:
TMPFILE="/tmp/image.tiff"
LOCKFILE="/tmp/copy.lock"
echo "pdf tworzę" >> /var/log/syslog
/usr/bin/scanimage --mode lineart -B10M --resolution 600 | pnmtops -imageheight 11 -imagewidth 8.5 | ps2pdf - /home/szymon/skaner/output.pdf | /usr/bin/mail -s "PDF" -a /home/szymon/skaner/output.pdf szymon@artmetic.pl
pamiętajmy o nadaniu uprawnień plikom:
chmod +x /etc/scanbd/pdf.sh