summaryrefslogtreecommitdiff
path: root/tools/hotplug-ng/README
blob: 1a17a19a3aeacb0bce13578b447a482aecb07185 (plain)
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
hotplug/hotplug-ng hook for sane-backends
-----------------------------------------

The libsane.hotplug script is intended to replace the existing hotplug scripts,
as those won't be usable with the new hotplug-ng. The libsane.hotplug script
works with both hotplug and hotplug-ng.  For current Linux kernels, "udev" is
state of the art, see the "udev" directory instead.

This script is provided in the hope that it will be useful, simpler, faster and
more extensible than the current usermap approach.


INSTALLATION
------------

Install libsane.hotplug in /etc/hotplug/usb, and make it executable.

Create the directory /etc/sane.d/hotplug and copy libsane.db there.


FILE FORMAT
-----------

The libsane.db contains 5 tab-separated fields:

0xVVVV<tab>0xPPPP<tab>root:scanner<tab>0660<tab>optional_script

Fields:
 - vendor ID
 - product ID
 - ownership (user:group)
 - permissions
 - path of an optional script to run (it can be omitted)


USAGE
-----

When run by hotplug/hotplug-ng, the libsane.hotplug script will grep for
^0xVVVV[[:space:]]0xPPPP in /etc/sane.d/hotplug/*.db. If a match is found,
the settings are applied to the device.

The optional script is then run; this script can access the environment
variables set by hotplug/hotplug-ng (see the documentation). The libsane.hotplug
script will also set and export the DEVVID and DEVPID variables, containing the
vendor and device ID of the scanner (of the form VVVV and PPPP).