[sane-devel] FC 2, hotplug and sane

Torben Andersen the.beauty@adslhome.dk
Tue, 26 Oct 2004 15:30:00 +0200


Hi,

I've installed a FC2 and updated. I can use sane, but only as root. I've 
been googling and reading and narrowed the problem to the USB interface 
to my Epson scanner. According to 
http://www.sane-project.org/README.linux, hotplug (which is compiled in 
the kernel) and /etc/hotplug/usb/libusbscanner (pasted in below 
signature) should  enable useracces to the scanner, if

"Usually you must just add the users that are allowed to access the scanner to group "scanner""

I don't know how to do that.

If I unplug and plug the scanner, user acces is allowed, but not on boot up !

Any help will bee appriciated :-)

Regards Torben

Contents af libusbscanner:

#!/bin/bash
# $Id: libusbscanner,v 1.1 2004/05/04 13:05:27 twaugh Exp $
#
# /etc/hotplug/usb/libusbscanner
#
# Sets up newly plugged in USB scanner so that the user who owns
# the console according to pam_console can access it from user space
#
# Note that for this script to work, you'll need all of the following:
# a) a line in the file /etc/hotplug/usermap that corresponds to the 
#    camera you are using.
# b) a setup using pam_console creates the respective lock files
#    containing the name of the respective user. You can check for that
#    by executing "echo `cat /var/{run,lock}/console.lock`" and 
#    verifying the appropriate user is mentioned somewhere there.
# c) a Linux kernel supporting hotplug and usbdevfs
# d) the hotplug package (http://linux-hotplug.sourceforge.net/)
#
# In the usermap file, the first field "usb module" should be named 
# "libusbscanner" like this script.
# 

if [ "${ACTION}" = "add" ] && [ -f "${DEVICE}" ]
then
    # New code, using lock files instead of copying /dev/console permissions
    # This also works with non-gdm logins (e.g. on a virtual terminal)
    # Idea and code from Nalin Dahyabhai <nalin@redhat.com>
    if [ -f /var/run/console.lock ]
    then
        CONSOLEOWNER=`cat /var/run/console.lock`
    elif [ -f /var/lock/console.lock ]
    then
        CONSOLEOWNER=`cat /var/lock/console.lock`
    else
        CONSOLEOWNER=
    fi
    if [ -n "$CONSOLEOWNER" ]
    then
        chmod 0000 "${DEVICE}"
        chown "$CONSOLEOWNER" "${DEVICE}"
        chmod 0600 "${DEVICE}"
    fi
fi





-- 
"It's trivial to make fun of Microsoft products,
but it takes a real man to make them work,
and a god to make them do anything useful."