On Fri, 02 Jan 2004 07:01, Paul Stear wrote:
> On Thu 1 January 2004 17:26, Mike Williams wrote:

>
> Thanks for the info mike,
> Do you mean put the chmod line in local.start?  What do I do if I boot
> without the printer/scanner connected and the plug it in when I am running?

You will need to emerge hotplug if you haven't already.

Then

1. Add a line to /etc/hotplug/usb.usermap (this should be two seperate lines):

# usb module         match_flags idVendor idProduct bcdDevice_lo bcdDevice_hi 
bDeviceClass bDeviceSubClass bDeviceProtocol bInterfaceClass 
bInterfaceSubClass bInterfaceProtocol driver_info

scanner           0x0000      0x04a9   0x2207    0x0000       0x0000       
0x00         0x00            0x00            0x00            0x00               
0x00               0x00000000

where 0x04a9 is the vendor ID of your scanner and 0x2207 is the product ID of 
your scanner. I'm not sure what the value of match_flags should be but 0x0000 
works for me.

2. Create a script /etc/hotplug/usb/<usb module> where <usb module> is the 
same as the first field of the line you added to /etc/hotplug/usb.usermap 
above:

#!/bin/bash
#
# This is a copy of /etc/hotplug/usb/usbcam
#
# $Id: usbcam.console,v 1.4 2002/09/12 16:50:18 hun Exp $
#
# /etc/hotplug/usb/scanner
#
# 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. You can get the correct lines for all cameras 
#    supported by libgphoto2 by running "print-usb-usermap".
# 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 
# "scanner" 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 <[EMAIL PROTECTED]>
    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 0666 "${DEVICE}"
    fi
fi

I've set permissions to 666 since my box is only running when I am using it 
and my usb devices are always plugged in at boot.

3. Restart hotplug.

Jeff

--
[EMAIL PROTECTED] mailing list

Reply via email to