From 14c404d28364f3ca5a825365b2fcbd396c401443 Mon Sep 17 00:00:00 2001 From: Stephan Raue Date: Mon, 17 Jan 2011 01:22:05 +0100 Subject: [PATCH] xbmc: start wiimote and PS3 remote per udev (sorry udev, you are sooo good\!) Signed-off-by: Stephan Raue --- packages/mediacenter/xbmc/init.d/93_xbmc | 10 +----- packages/mediacenter/xbmc/install | 4 +++ .../xbmc/rules.d/98-ps3remote.rules | 31 +++++++++++++++++++ .../xbmc/rules.d/98-wiiremote.rules | 31 +++++++++++++++++++ 4 files changed, 67 insertions(+), 9 deletions(-) create mode 100644 packages/mediacenter/xbmc/rules.d/98-ps3remote.rules create mode 100644 packages/mediacenter/xbmc/rules.d/98-wiiremote.rules diff --git a/packages/mediacenter/xbmc/init.d/93_xbmc b/packages/mediacenter/xbmc/init.d/93_xbmc index b8a34b54c1..aeb0a615c8 100644 --- a/packages/mediacenter/xbmc/init.d/93_xbmc +++ b/packages/mediacenter/xbmc/init.d/93_xbmc @@ -28,14 +28,6 @@ XBMC_ARGS="--standalone -fs --lircdev $LIRCDEV" progress "starting XBMC" -# starting xbmc-wiimote if avaible - [ "$(pidof bluetoothd)" -a -f /usr/bin/xbmc-wiiremote ] && \ - /usr/bin/xbmc-wiiremote >/dev/null 2>&1 & - -# starting xbmc-ps3remote if avaible - [ "$(pidof bluetoothd)" -a -f /usr/bin/xbmc-ps3remote ] && \ - /usr/bin/xbmc-ps3remote localhost 9777 >/dev/null 2>&1 & - # starting autoupdate [ -f /usr/bin/autoupdate ] && /usr/bin/autoupdate & @@ -45,7 +37,7 @@ progress "starting XBMC" # starting XBMC while true; do - DISPLAY=:0.0 xbmc $XBMC_ARGS > /dev/null 2>&1 + DISPLAY=:0.0 /usr/lib/xbmc/xbmc.bin $XBMC_ARGS > /dev/null 2>&1 RET=$? case "$RET" in diff --git a/packages/mediacenter/xbmc/install b/packages/mediacenter/xbmc/install index 10beb8c687..5c4950982d 100755 --- a/packages/mediacenter/xbmc/install +++ b/packages/mediacenter/xbmc/install @@ -66,6 +66,8 @@ mkdir -p $PYTHON_LIBDIR/site-packages/xbmc if [ "$WIIMOTE_SUPPORT" = yes ]; then mkdir -p $INSTALL/usr/bin cp $PKG_BUILD/tools/EventClients/Clients/WiiRemote/WiiUse_WiiRemote $INSTALL/usr/bin/xbmc-wiiremote + mkdir -p $INSTALL/lib/udev/rules.d + cp $PKG_DIR/rules.d/98-wiiremote.rules $INSTALL/lib/udev/rules.d fi if [ "$PS3REMOTE_SUPPORT" = yes ]; then @@ -75,4 +77,6 @@ if [ "$PS3REMOTE_SUPPORT" = yes ]; then cp $PKG_BUILD/tools/EventClients/icons/bluetooth.png $INSTALL/usr/share/pixmaps/xbmc mkdir -p $PYTHON_LIBDIR/site-packages/xbmc echo 'ICON_PATH="/usr/share/pixmaps/xbmc/"' > $PYTHON_LIBDIR/site-packages/xbmc/defs.py + mkdir -p $INSTALL/lib/udev/rules.d + cp $PKG_DIR/rules.d/98-ps3remote.rules $INSTALL/lib/udev/rules.d fi diff --git a/packages/mediacenter/xbmc/rules.d/98-ps3remote.rules b/packages/mediacenter/xbmc/rules.d/98-ps3remote.rules new file mode 100644 index 0000000000..2cd4369835 --- /dev/null +++ b/packages/mediacenter/xbmc/rules.d/98-ps3remote.rules @@ -0,0 +1,31 @@ +################################################################################ +# This file is part of OpenELEC - http://www.openelec.tv +# Copyright (C) 2009-2011 Stephan Raue (stephan@openelec.tv) +# +# This Program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2, or (at your option) +# any later version. +# +# This Program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with OpenELEC.tv; see the file COPYING. If not, write to +# the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. +# http://www.gnu.org/copyleft/gpl.html +################################################################################ + +# only does something with "bluetooth" subsystem devices. +SUBSYSTEM!="bluetooth", GOTO="end" + +# Start PS3 Remote support if bluetooth is starting +ACTION=="add", RUN+="/usr/bin/xbmc-ps3remote localhost 9777" +ACTION=="change", RUN+="/usr/bin/xbmc-ps3remote localhost 9777" + +# remove PS3 Remote support if bluetooth is stopping +ACTION=="remove", RUN+="killall xbmc-ps3remote" + +LABEL="end" diff --git a/packages/mediacenter/xbmc/rules.d/98-wiiremote.rules b/packages/mediacenter/xbmc/rules.d/98-wiiremote.rules new file mode 100644 index 0000000000..2f03365cfc --- /dev/null +++ b/packages/mediacenter/xbmc/rules.d/98-wiiremote.rules @@ -0,0 +1,31 @@ +################################################################################ +# This file is part of OpenELEC - http://www.openelec.tv +# Copyright (C) 2009-2011 Stephan Raue (stephan@openelec.tv) +# +# This Program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2, or (at your option) +# any later version. +# +# This Program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with OpenELEC.tv; see the file COPYING. If not, write to +# the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. +# http://www.gnu.org/copyleft/gpl.html +################################################################################ + +# only does something with "bluetooth" subsystem devices. +SUBSYSTEM!="bluetooth", GOTO="end" + +# Start Wii Remote support if bluetooth is starting +ACTION=="add", RUN+="/usr/bin/xbmc-wiiremote" +ACTION=="change", RUN+="/usr/bin/xbmc-wiiremote" + +# remove Wii Remote support if bluetooth is stopping +ACTION=="remove", RUN+="killall xbmc-wiiremote" + +LABEL="end"