usbcam revision 585
18156N/A#!/bin/bash
18156N/A# $Id$
18156N/A#
18156N/A# /etc/hotplug/usb/usbcam
18156N/A#
18156N/A# Sets up newly plugged in USB camera so that the user who owns
18156N/A# the console according to pam_console can access it from user space
18156N/A#
18156N/A# Note that for this script to work, you'll need all of the following:
18156N/A# a) a line in the file /etc/hotplug/usermap that corresponds to the
18156N/A# camera you are using. You can get the correct lines for all cameras
18156N/A# supported by gphoto2 by running "gphoto2 --print-usb-usermap".
18156N/A# b) a setup using pam_console creates the respective lock files
18156N/A# containing the name of the respective user. You can check for that
18156N/A# by executing "echo `cat /var/{run,lock}/console.lock`" and
18156N/A# verifying the appropriate user is mentioned somewhere there.
18156N/A# c) a Linux kernel supporting hotplug and usbdevfs
18156N/A# d) the hotplug package (http://linux-hotplug.sourceforge.net/)
18156N/A#
18156N/A# In the usermap file, the first field "usb module" should be named
18156N/A# "usbcam" like this script.
18156N/A#
18156N/A
18156N/Aif [ "${ACTION}" = "add" ] && [ -f "${DEVICE}" ]
18156N/Athen
18156N/A # We reference /dev/audio, since we want to have the same permissions
18156N/A chmod 0000 "${DEVICE}"
18156N/A chown --reference=/dev/audio "${DEVICE}"
18156N/A chmod 0600 "${DEVICE}"
18156N/Afi