Lines 13-38
Link Here
|
13 |
|
13 |
|
14 |
start() { |
14 |
start() { |
15 |
ebegin "Starting g15daemon" |
15 |
ebegin "Starting g15daemon" |
16 |
|
16 |
|
17 |
# Does the input device already exist? |
17 |
# Does the input device already exist? |
18 |
if [[ -e /proc/modules && ! -e /dev/input/uinput ]] ; then |
18 |
if [ -e /proc/modules -a ! -e /dev/input/uinput ]; then |
19 |
# We can load modules, but uinput device does not exist |
19 |
# We can load modules, but uinput device does not exist |
20 |
einfo "Loading uinput module" |
20 |
einfo "Loading uinput module" |
21 |
/sbin/modprobe uinput &> /dev/null |
21 |
/sbin/modprobe uinput > /dev/null 2> /dev/null |
22 |
fi |
22 |
fi |
23 |
|
23 |
|
24 |
local SWITCHKEY="" |
24 |
local SWITCHKEY="" |
25 |
[[ ${CLIENT_SWITCH_L1} = "yes" ]] && SWITCHKEY="--switch" |
25 |
[ "${CLIENT_SWITCH_L1}" = "yes" ] && SWITCHKEY="--switch" |
26 |
start-stop-daemon --start --background --pidfile /var/run/g15daemon.pid \ |
26 |
start-stop-daemon --start --background --pidfile /var/run/g15daemon.pid \ |
27 |
--exec /usr/sbin/g15daemon -- ${SWITCHKEY} |
27 |
--exec /usr/sbin/g15daemon -- ${SWITCHKEY} |
28 |
eend $? "Failed to start g15daemon." |
28 |
eend $? "Failed to start g15daemon." |
29 |
} |
29 |
} |
30 |
|
30 |
|
31 |
stop() { |
31 |
stop() { |
32 |
ebegin "Stopping g15daemon" |
32 |
ebegin "Stopping g15daemon" |
33 |
local KILLOPT="-k" |
33 |
local KILLOPT="-k" |
34 |
[[ ${BACKLIGHT_OFF} = "yes" ]] && KILLOPT="-K" |
34 |
if [ $BACKLIGHT_OFF = "yes" ]; then |
35 |
/usr/sbin/g15daemon ${KILLOPT} 2&> /dev/null \ |
35 |
KILLOPT="-K" |
36 |
|| start-stop-daemon --stop --quiet --pidfile /var/run/g15daemon.pid |
36 |
fi |
|
|
37 |
/usr/sbin/g15daemon ${KILLOPT} >/dev/null 2> /dev/null&&wait `cat /var/run/g15daemon.pid` \ |
38 |
|| start-stop-daemon --signal SIGKILL --stop --quiet --pidfile /var/run/g15daemon.pid |
37 |
eend $? |
39 |
eend $? |
38 |
} |
40 |
} |