diff --git a/ChangeLog b/ChangeLog index 95d6f52bf..9d10f438f 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2004-02-28 Julien Blache + * tools/hotplug: added the hotplug script used by the Debian + package, with a quick README. + * tools/README: updated to mention the hotplug/ directory. + 2004-02-27 Matthew Duggan * backend/canon_pp.c: Add more debug output to help resolve bug #300524 diff --git a/tools/README b/tools/README index 4a9082ec2..d99fcfb7c 100644 --- a/tools/README +++ b/tools/README @@ -1,7 +1,12 @@ -2003-06-18 +2004-02-28 This directory contains various tools that may be useful: + hotplug/: + hotplug script and config file used to change the persmissions + on the libusb "device nodes" when a scanner is plugged in. + Please read the README file in this directory for instructions. + sane-find-scanner: Attempts to find a SCSI scanner attached to your system. Invoke with "sane-find-scanner -h" to get command-line diff --git a/tools/hotplug/README b/tools/hotplug/README new file mode 100644 index 000000000..df8da40a2 --- /dev/null +++ b/tools/hotplug/README @@ -0,0 +1,25 @@ +README for the hotplug scripts for sane-backends : +-------------------------------------------------- + +If you intend to use a USB scanner with libusb, you should install the hotplug +package, and then take the following steps : + o copy the libsane.usermap and libusbscanner files from this directory to + /etc/hotplug/usb/ + o add scanner to /etc/hotplug/blacklist so that the scanner.o kernel driver + won't be loaded by hotplug. + o edit /etc/hotplug/usb/libsane.usermap, and add a line similar to the one + given at the top of the file, replacing 0xVVVV and 0xPPPP with the vendor ID + and the product ID of your scanner, respectively. + +The vendor ID and product ID of your scanner can be obtained by running +sane-find-scanner (you might need to run it as root). + +Please note that the scanner.o (or scanner.ko in Linux 2.6) kernel module is +now deprecated and marked as obsolete in Linux 2.6. It is recommended to switch +to libusb. + +If the hotplug support doesn't work for you once you have taken the steps +described above, check that your kernel has been built with hotplug support. +Otherwise, you'll need to rebuild your kernel. + + -- Julien BLACHE , Sat, 28 Feb 2004 10:01:02 +0000 diff --git a/tools/hotplug/libsane.usermap b/tools/hotplug/libsane.usermap new file mode 100644 index 000000000..d0b80e465 --- /dev/null +++ b/tools/hotplug/libsane.usermap @@ -0,0 +1,14 @@ +# This file is part of sane-backends. +# +# The entries below are used to detect a USB scanner when it's plugged in +# and then run the libusbscanner script to change the ownership and +# permissions on the "device node" used by libusb. +# +# The 0x0003 match flag means the device is matched by its vendor and +# product IDs. +# +# Sample entry (replace 0xVVVV and 0xPPPP with vendor ID and product ID respectively) : +# libusbscanner 0x0003 0xVVVV 0xPPPP 0x0000 0x0000 0x00 0x00 0x00 0x00 0x00 0x00 0x00000000 +# +# usb module match_flags idVendor idProduct bcdDevice_lo bcdDevice_hi bDeviceClass bDeviceSubClass bDeviceProtocol bInterfaceClass bInterfaceSubClass bInterfaceProtocol driver_info +# diff --git a/tools/hotplug/libusbscanner b/tools/hotplug/libusbscanner new file mode 100755 index 000000000..b73d7dd64 --- /dev/null +++ b/tools/hotplug/libusbscanner @@ -0,0 +1,19 @@ +#!/bin/sh + +# This file is part of sane-backends. +# +# This script changes the permissions and ownership of a USB device under +# /proc/bus/usb to grant access to this device to users in the scanner group. +# +# Ownership is set to root:scanner, permissions are set to 0660. +# +# Arguments : +# ----------- +# ACTION=[add|remove] +# DEVICE=/proc/bus/usb/BBB/DDD +# TYPE=usb + +if [ "$ACTION" = "add" -a "$TYPE" = "usb" ]; then + chown root:scanner "$DEVICE" + chmod 0660 "$DEVICE" +fi