summaryrefslogtreecommitdiff
blob: 49430616e69e11e6c72e20e17811fb5ba9f2b2b4 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
#!/bin/sh
# Copyright 1999-2006 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2

# This file is part of media-gfx/iscan
#
# 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]
# DEVNAME=/dev/bus/usb/BBB/DDD
# SUBSYSTEM=usb_device

OWNER="root"
GROUP="scanner"
PERMS="0660"

DEVICE="${DEVNAME/dev/proc}"

if [ "${ACTION}" = "add" -a "${SUBSYSTEM}" = "usb_device" -a -f "${DEVICE}" ]; then
    chmod ${PERMS} "${DEVICE}" && chown ${OWNER}:${GROUP} "${DEVICE}"
fi