← Back to team overview

sslug-teknik team mailing list archive

Re: sane (igen)

 

Tak Anders, jeg tror, at du er inde på sporet. Jeg har også en /etc/hotplug/usb/libusbscanner (se tekst under "underskrift"), hvor der står

# 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

Og ganske rigtigt: hvis jeg tager USB stikket ud og ind, virker den. Hvordan får jeg aktiveret dette uden "fysiske" handlinger ?? Jeg kører så vidt jeg kan se, ikke hotplug som deamon. Er det nødvendigt og i givet fald, hvordan gør jeg? Hotplug skal vist nok kaldes med nogen parametre.

MVH Torben

#!/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@xxxxxxxxxx>
   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


Anders Gnistrup wrote:

Hej Torben

Jeg har selv haft samme problem. Jeg kører med kerne 2.6.8.1, libusb, udev hotplug og sane.
Det fungere sådan set fint det hele.

Jeg har en fil i /etc/hotplug/usb/libusbscanner, hvor jeg sætter permissions for scanneren. Jeg har sat dem til 0660, dvs:

if [ "$ACTION" = "add" -a "$TYPE" = "usb" ]; then
 chown root:scanner "$DEVICE"
 chmod 0660 "$DEVICE"
fi

Så har jeg i /etc/groub tilføjer brugen (agn) til gruppen scanner.
scanner:x:407:agn

Derudover har jeg hotplug kørene som deamon. Håber at det hjælper

Hilsen Anders



--
"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."



Follow ups

References