5
# Required-Start: $syslog $local_fs
6
# Required-Stop: $syslog $local_fs
7
# Should-Start: $remote_fs
8
# Should-Stop: $remote_fs
9
# X-Start-Before: xdm kdm gdm ldm sdm
10
# Default-Start: 2 3 4 5
12
# Short-Description: load deamon for Logitech G15 keyboard lcd display
13
# Description: load deamon for Logitech G15 keyboard lcd display
17
PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin
18
DAEMON=/usr/sbin/g15daemon
22
[ -x "$DAEMON" ] || exit 0
24
# Include g15daemon defaults if available
25
if [ -f /etc/default/g15daemon ] ; then
26
. /etc/default/g15daemon
29
if [ "$SWITCH_KEY" = "MR" ]; then
30
DAEMON_OPTS="-s $DAEMON_OPTS"
35
if [ "$G15DEBUG" = "on" ]; then
38
logger -p daemon.debug -t g15 -- "$*"
54
[ "$timeout" ] || timeout=120
56
local count=$(($timeout * 10))
57
while [ $count != 0 ]; do
58
[ -e "$file" ] && return 0
66
if [ ! -e /dev/input/uinput ] ; then
67
modprobe -q uinput || true
68
wait_for_file /dev/input/uinput 3 || return 1
73
if [ ! -e "$DAEMON" ] ; then
74
wait_for_file "$DAEMON" 7 || return 1
79
start-stop-daemon --stop --test --quiet --pidfile \
80
/var/run/$NAME.pid --exec $DAEMON
84
start-stop-daemon --start --quiet --pidfile /var/run/$NAME.pid \
85
--exec $DAEMON -- $DAEMON_OPTS
90
start-stop-daemon --stop --quiet --pidfile /var/run/$NAME.pid \
91
--oknodo --retry 5 --exec $DAEMON
97
echo -n "Starting $DESC: "
98
load_uinput || echo -n ".../dev/input/uinput not found ..."
103
echo -n "Stopping $DESC: "
109
# If the daemon can reload its config files on the fly
110
# for example by sending it SIGHUP, do it here.
112
# If the daemon responds to changes in its config file
113
# directly anyway, make this a do-nothing entry.
115
# echo "Reloading $DESC configuration files."
116
# start-stop-daemon --stop --signal 1 --quiet --pidfile \
117
# /var/run/$NAME.pid --exec $DAEMON
121
# If the "reload" option is implemented, move the "force-reload"
122
# option to the "reload" entry above. If not, "force-reload" is
123
# just the same as "restart" except that it does nothing if the
124
# daemon isn't already running.
125
# check wether $DAEMON is running. If so, restart
126
is_running && $0 restart || exit 0
129
echo -n "Restarting $DESC: "
131
# the device is slow to shut-down
137
log "calling g15 udev; action: $ACTION, product $PRODUCT"
138
if [ "x$ACTION" = "xadd" ] ; then
140
wait_usr_mount || true
141
# it seems udev will not release a device if userspace is still
143
is_running && ( do_stop; sleep 1 )
145
elif [ "x$ACTION" = "xremove" ] ; then
148
echo "unknow udev action '$ACTION'"
154
# some devices share usb also for audio, which causes some spourios
156
log "calling g15 shared-dev; action: $ACTION, product $PRODUCT"
157
if [ "x$ACTION" = "xadd" ] ; then
159
wait_usr_mount || true
161
elif [ "x$ACTION" = "xremove" ] ; then
164
echo "unknow udev action '$ACTION'"
172
echo "Usage: $N {start|stop|restart|force-reload|udev}" >&2