* Reintroduce package. (Closes: bug#928158)
* Convert source to 3.0 (quilt) format.
* Migrate from cdbs to debhelper.
* Merge from Ubuntu:
- libg15daemon_client/g15daemon_net.c: Fix a potential buffer overflow.
* debian/patches/07-reinit-on-any-error.diff: reinitialize on any error
returned by libusb to correctly recover after suspend/resume. (LP: #1357556)
* /etc/init.d/g15daemon: overhaul.
- Replace /dev/input/uinput with /dev/uinput. (Closes: bug#687663).
- Use "udevadm settle" instead of polling /dev/uinput.
- Use log_*_msg functions instead of echo.
- Add dependency on $remote_fs.
- Remove bashism. (Closes: bug#772244)
- Return 0 exit code if the daemon fails to start.
(LP: #617101, LP: #1103275)
- Don't stop or restart on udev events, because g15daemon now properly
handles replugging.
* Remove build dependency on libusb.
* Remove dependency on libg15daemon-client1 for g15daemon.
* Add dependency on udev for g15daemon.
* Change priority of packages to optional.
* Add native systemd service. (LP: #1441365)
* /etc/default/g15daemon: remove SWITCH_KEY option to keep systemd service
file simple.
* Add subsystem check to udev matching rules.
* Multiarchify the library packages. (Closes: bug#812952)
* Do not install *.la files.
* Change package description. (Closes: bug#802652)
This commit is contained in:
1 parent
59793e4434
commit
b4412b7c70
29 files changed
+542
-228
No files matched your search
Vendored
+64
-116
@@ -2,8 +2,8 @@
|
||||
|
||||
### BEGIN INIT INFO
|
||||
# Provides: g15daemon
|
||||
# Required-Start: $syslog $local_fs
|
||||
# Required-Stop: $syslog $local_fs
|
||||
# Required-Start: $syslog $local_fs $remote_fs
|
||||
# Required-Stop: $syslog $local_fs $remote_fs
|
||||
# Should-Start: $remote_fs
|
||||
# Should-Stop: $remote_fs
|
||||
# X-Start-Before: xdm kdm gdm ldm sdm
|
||||
@@ -17,21 +17,17 @@
|
||||
PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin
|
||||
DAEMON=/usr/sbin/g15daemon
|
||||
NAME=g15daemon
|
||||
DESC=g15daemon
|
||||
DESC="Logitech G15 keyboard LCD multiplexer"
|
||||
|
||||
[ -x "$DAEMON" ] || exit 0
|
||||
|
||||
. /lib/lsb/init-functions
|
||||
|
||||
# Include g15daemon defaults if available
|
||||
if [ -f /etc/default/g15daemon ] ; then
|
||||
. /etc/default/g15daemon
|
||||
. /etc/default/g15daemon
|
||||
fi
|
||||
|
||||
if [ "$SWITCH_KEY" = "MR" ]; then
|
||||
DAEMON_OPTS="-s $DAEMON_OPTS"
|
||||
fi
|
||||
|
||||
set -e
|
||||
|
||||
if [ "$G15DEBUG" = "on" ]; then
|
||||
|
||||
log() {
|
||||
@@ -45,133 +41,85 @@ log() {
|
||||
|
||||
fi
|
||||
|
||||
|
||||
|
||||
|
||||
wait_for_file() {
|
||||
local file=$1
|
||||
local timeout=$2
|
||||
[ "$timeout" ] || timeout=120
|
||||
|
||||
local count=$(($timeout * 10))
|
||||
while [ $count != 0 ]; do
|
||||
[ -e "$file" ] && return 0
|
||||
sleep 0.1
|
||||
count=$(($count - 1))
|
||||
done
|
||||
return 1
|
||||
}
|
||||
|
||||
load_uinput() {
|
||||
if [ ! -e /dev/input/uinput ] ; then
|
||||
modprobe -q uinput || true
|
||||
wait_for_file /dev/input/uinput 3 || return 1
|
||||
check_new_init() {
|
||||
if [ -d /run/systemd/system ] ; then
|
||||
exit $1
|
||||
fi
|
||||
}
|
||||
|
||||
wait_usr_mount() {
|
||||
if [ ! -e "$DAEMON" ] ; then
|
||||
wait_for_file "$DAEMON" 7 || return 1
|
||||
load_uinput() {
|
||||
if [ ! -e /dev/uinput ] ; then
|
||||
modprobe -q uinput
|
||||
udevadm settle -t 5 -E /dev/uinput
|
||||
[ -e /dev/uinput 3 ] || return 1
|
||||
fi
|
||||
}
|
||||
|
||||
is_running() {
|
||||
start-stop-daemon --stop --test --quiet --pidfile \
|
||||
/var/run/$NAME.pid --exec $DAEMON
|
||||
start-stop-daemon --stop --test --quiet --pidfile \
|
||||
/var/run/$NAME.pid --exec $DAEMON
|
||||
}
|
||||
|
||||
do_start() {
|
||||
start-stop-daemon --start --quiet --pidfile /var/run/$NAME.pid \
|
||||
--exec $DAEMON -- $DAEMON_OPTS
|
||||
start-stop-daemon --start --quiet --pidfile /var/run/$NAME.pid \
|
||||
--exec $DAEMON -- $DAEMON_OPTS
|
||||
}
|
||||
|
||||
do_stop() {
|
||||
$DAEMON -k
|
||||
start-stop-daemon --stop --quiet --pidfile /var/run/$NAME.pid \
|
||||
--oknodo --retry 5 --exec $DAEMON
|
||||
start-stop-daemon --stop --quiet --pidfile /var/run/$NAME.pid \
|
||||
--oknodo --retry 5 --exec $DAEMON
|
||||
}
|
||||
|
||||
|
||||
case "$1" in
|
||||
start)
|
||||
echo -n "Starting $DESC: "
|
||||
load_uinput || echo -n ".../dev/input/uinput not found ..."
|
||||
do_start
|
||||
echo "$NAME."
|
||||
;;
|
||||
stop)
|
||||
echo -n "Stopping $DESC: "
|
||||
do_stop
|
||||
echo "$NAME."
|
||||
;;
|
||||
#reload)
|
||||
#
|
||||
# If the daemon can reload its config files on the fly
|
||||
# for example by sending it SIGHUP, do it here.
|
||||
#
|
||||
# If the daemon responds to changes in its config file
|
||||
# directly anyway, make this a do-nothing entry.
|
||||
#
|
||||
# echo "Reloading $DESC configuration files."
|
||||
# start-stop-daemon --stop --signal 1 --quiet --pidfile \
|
||||
# /var/run/$NAME.pid --exec $DAEMON
|
||||
#;;
|
||||
force-reload)
|
||||
#
|
||||
# If the "reload" option is implemented, move the "force-reload"
|
||||
# option to the "reload" entry above. If not, "force-reload" is
|
||||
# just the same as "restart" except that it does nothing if the
|
||||
# daemon isn't already running.
|
||||
# check wether $DAEMON is running. If so, restart
|
||||
is_running && $0 restart || exit 0
|
||||
start)
|
||||
log_daemon_msg "Starting $DESC" $NAME
|
||||
load_uinput || log_warning_msg "/dev/uinput not found"
|
||||
do_start
|
||||
log_end_msg $?
|
||||
;;
|
||||
restart)
|
||||
echo -n "Restarting $DESC: "
|
||||
do_stop
|
||||
# the device is slow to shut-down
|
||||
sleep 1
|
||||
do_start
|
||||
echo "$NAME."
|
||||
;;
|
||||
udev)
|
||||
log "calling g15 udev; action: $ACTION, product $PRODUCT"
|
||||
if [ "x$ACTION" = "xadd" ] ; then
|
||||
load_uinput || true
|
||||
wait_usr_mount || true
|
||||
# it seems udev will not release a device if userspace is still
|
||||
# connected
|
||||
is_running && ( do_stop; sleep 1 )
|
||||
do_start
|
||||
elif [ "x$ACTION" = "xremove" ] ; then
|
||||
do_stop
|
||||
else
|
||||
echo "unknow udev action '$ACTION'"
|
||||
exit 1
|
||||
|
||||
fi
|
||||
;;
|
||||
shared-udev)
|
||||
# some devices share usb also for audio, which causes some spourios
|
||||
# udev messages.
|
||||
log "calling g15 shared-dev; action: $ACTION, product $PRODUCT"
|
||||
if [ "x$ACTION" = "xadd" ] ; then
|
||||
load_uinput || true
|
||||
wait_usr_mount || true
|
||||
do_start
|
||||
elif [ "x$ACTION" = "xremove" ] ; then
|
||||
do_stop
|
||||
stop)
|
||||
log_daemon_msg "Stopping $DESC" $NAME
|
||||
if do_stop ; then
|
||||
log_end_msg 0
|
||||
else
|
||||
echo "unknow udev action '$ACTION'"
|
||||
log_end_msg 1
|
||||
exit 1
|
||||
|
||||
fi
|
||||
;;
|
||||
|
||||
*)
|
||||
N=/etc/init.d/$NAME
|
||||
echo "Usage: $N {start|stop|restart|force-reload|udev}" >&2
|
||||
exit 1
|
||||
;;
|
||||
force-reload)
|
||||
is_running && $0 restart || exit 0
|
||||
;;
|
||||
restart)
|
||||
log_daemon_msg "Restarting $DESC" $NAME
|
||||
if ! do_stop ; then
|
||||
log_end_msg 1
|
||||
exit 1
|
||||
fi
|
||||
# the device is slow to shut-down
|
||||
sleep 1
|
||||
load_uinput || log_warning_msg "/dev/uinput not found"
|
||||
do_start
|
||||
log_end_msg $?
|
||||
;;
|
||||
status)
|
||||
is_running
|
||||
exit $?
|
||||
;;
|
||||
udev)
|
||||
check_new_init 0
|
||||
log "calling g15 udev; action: $ACTION, product $PRODUCT"
|
||||
if [ "x$ACTION" = "xadd" ] ; then
|
||||
# If g15daemon is running, it will handle replugging.
|
||||
is_running && exit 0
|
||||
load_uinput
|
||||
do_start
|
||||
fi
|
||||
;;
|
||||
*)
|
||||
N=/etc/init.d/$NAME
|
||||
log_action_msg "Usage: $N {start|stop|restart|force-reload|status}"
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
|
||||
exit 0
|
||||
Reference in new issue
Block a user