~ctf/unity-settings-daemon/bug1389099_mic_volume_icons

« back to all changes in this revision

Viewing changes to plugins/common/input-device-example.sh

  • Committer: Package Import Robot
  • Author(s): Robert Ancell
  • Date: 2014-02-07 11:44:36 UTC
  • Revision ID: package-import@ubuntu.com-20140207114436-7t5u3yvwc4ul7w3e
Tags: upstream-14.04.0
ImportĀ upstreamĀ versionĀ 14.04.0

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
#!/bin/sh
 
2
#
 
3
# This script is an example hotplug script for use with the various
 
4
# input devices plugins.
 
5
#
 
6
# The script is called with the arguments:
 
7
# -t [added|present|removed] <device name>
 
8
#       added ... device was just plugged in
 
9
#       present.. device was present at gnome-settings-daemon startup
 
10
#       removed.. device was just removed
 
11
# -i <device ID>
 
12
#       device ID being the XInput device ID
 
13
# <device name> The name of the device
 
14
#
 
15
# The script should return 0 if the device is to be
 
16
# ignored from future configuration.
 
17
#
 
18
# Set the script to be used with:
 
19
# gsettings set org.gnome.settings-daemon.peripherals.input-devices hotplug-command /path/to/script/input-devices.sh
 
20
#
 
21
 
 
22
args=`getopt "t:i:" $*`
 
23
 
 
24
set -- $args
 
25
 
 
26
while [ $# -gt 0 ]
 
27
do
 
28
    case $1 in
 
29
    -t)
 
30
        shift;
 
31
        type="$1"
 
32
        ;;
 
33
     -i)
 
34
        shift;
 
35
        id="$1"
 
36
        ;;
 
37
     --)
 
38
        shift;
 
39
        device="$@"
 
40
        break;
 
41
        ;;
 
42
    *)
 
43
        echo "Unknown option $1";
 
44
        exit 1
 
45
        ;;
 
46
    esac
 
47
    shift
 
48
done
 
49
 
 
50
retval=0
 
51
 
 
52
case $type in
 
53
        added)
 
54
                echo "Device '$device' (ID=$id) was added"
 
55
                ;;
 
56
        present)
 
57
                echo "Device '$device' (ID=$id) was already present at startup"
 
58
                ;;
 
59
        removed)
 
60
                echo "Device '$device' (ID=$id) was removed"
 
61
                ;;
 
62
        *)
 
63
                echo "Unknown operation"
 
64
                retval=1
 
65
                ;;
 
66
esac
 
67
 
 
68
# All further processing will be disabled if $retval == 1
 
69
exit $retval