tools/udev/convert-usermap.sh: Added a script to convert hotplug/libsane.usermap to a udev rules file. udev 070 + linux 2.6.14 will deprecate hotplug.

tools/README: updated.
merge-requests/1/head
Julien BLACHE 2005-09-28 20:37:43 +00:00
rodzic 0ba5bee76d
commit 7ed2585674
3 zmienionych plików z 52 dodań i 0 usunięć

Wyświetl plik

@ -1,3 +1,9 @@
2005-09-28 Julien Blache <jb@jblache.org>
* tools/udev/convert-usermap.sh: Added script to convert
hotplug/libsane.usermap to a udev rules file. udev 070 + linux
2.6.14 will deprecate hotplug.
* tools/README: updated.
2005-09-28 Henning Meier-Geinitz <henning@meier-geinitz.de>
* doc/descriptions-external/brother.desc: Removed duplicate entry.

Wyświetl plik

@ -7,6 +7,11 @@ This directory contains various tools that may be useful:
on the libusb "device nodes" when a scanner is plugged in.
Please read the README file in this directory for instructions.
udev:
Contains the convert-usermap.sh script to produce a udev rules file
based on tools/hotplug/libsane.usermap. udev now replaces hotplug and
provides all the functionalities of hotplug.
sane-find-scanner:
Attempts to find a SCSI scanner attached to your system.
Invoke with "sane-find-scanner -h" to get command-line

Wyświetl plik

@ -0,0 +1,41 @@
#!/bin/bash
#
# Converts libsane.usermap to an udev rules file
#
if [ ! -e libsane.rules ]; then
cat > libsane.rules <<EOF
# This file is part of the SANE distribution
#
# udev rules file for supported scanners
#
#
# For now, only USB scanners are listed/supported by this set of rules;
# feel free to add support for other busses.
#
# To add an USB scanner, add a rule to the list below between the SUBSYSTEM...
# and LABEL... lines.
#
# To run a script when your scanner is plugged in, add RUN="/path/to/script"
# to the appropriate rule.
#
SUBSYSTEM!="usb_device", ACTION!="add", GOTO="libsane_rules_end"
EOF
fi
cat "$1" | { while read map; do
if $(echo "$map" | grep -q ^# > /dev/null); then
echo $map >> libsane.rules
else
set $map
echo -e "SYSFS{idVendor}==\"$3\", SYSFS{idProduct}==\"$4\", MODE=\"660\", GROUP=\"scanner\"" >> libsane.rules
fi
done }
echo >> libsane.rules
echo "LABEL=\"libsane_rules_end\"" >> libsane.rules
exit 0