Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

PS3 controller reworked #139

Merged
merged 25 commits into from
Nov 1, 2014
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
25 commits
Select commit Hold shift + click to select a range
d844950
fix for ps3 device index bug
beaumanvienna Oct 28, 2014
70007e2
retrorig-setup build script: fix for ps3 device index bug
beaumanvienna Oct 28, 2014
82de0f0
auto start function
beaumanvienna Oct 28, 2014
34b4ccd
typo
beaumanvienna Oct 28, 2014
37bfb91
restore gp_autodetect_xbmc.sh
beaumanvienna Oct 28, 2014
d0c2f87
restore gp_autodetect_xbmc.sh
beaumanvienna Oct 28, 2014
fdf1ff1
auto start function
beaumanvienna Oct 28, 2014
4ae3f74
fixed broken shutdown option when autostarting xbmc
beaumanvienna Oct 29, 2014
d6d4900
merged missing syscall abstractions after odd merge
beaumanvienna Oct 29, 2014
a627d71
fixed merge problem
beaumanvienna Oct 29, 2014
65ee670
changed to
beaumanvienna Oct 29, 2014
4a7ba29
PS3 / USB hotplug support
beaumanvienna Oct 29, 2014
b318d58
typo
beaumanvienna Oct 29, 2014
88a01c7
enable or disable auto start function / hotplug support PS3 BT
beaumanvienna Oct 30, 2014
49c85b7
typo
beaumanvienna Oct 30, 2014
0e725a8
typo
beaumanvienna Oct 30, 2014
f351242
typo
beaumanvienna Oct 30, 2014
3f5d741
rebased
beaumanvienna Oct 30, 2014
f9626b8
prerequisites for pcsx2 (what the duck??)
beaumanvienna Oct 31, 2014
ea75170
rebased one more time
beaumanvienna Oct 31, 2014
99ea2dd
amendement for system service / retrorig-setup build script
beaumanvienna Oct 31, 2014
83b468b
amendment for sys abstraction code and auto start function
beaumanvienna Nov 1, 2014
78905d8
typo in GensGS installation
beaumanvienna Nov 1, 2014
faa20ed
PS3/USB doesn't need a reboot anymore
beaumanvienna Nov 1, 2014
66d20c9
build script for retrorig-setup with all final amendments
beaumanvienna Nov 1, 2014
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
158 changes: 150 additions & 8 deletions XBMC-cfgs/extra/gp_autodetect_xbmc.sh
Original file line number Diff line number Diff line change
@@ -1,20 +1,162 @@
#!/bin/bash

# Project RetroRig: https://github.com/ProfessorKaos64/RetroRig
# This script detects a change on available PS controller. If detected, it notifies XBMC.
# Author: Jens-Christiansen, aka beaumanvienna/JC
# Revision: 2014/06/21, initial version
#
# This script detects a change of the amount of available PS3 controller.
# If such a change was detected, it notifies XBMC.
#
# If enabled, it will start RetroRig automatically
# for the first game controller being switched on.
#
# Author: Jens-Christian, aka beaumanvienna/JC
#
# Revision: 2014/10/30, support for PS3 / USB and auto start XBMC function

autostartXBMC_PS3_USB=enabled
autostartXBMC_PS3_BT=enabled

controllerAvailable=`cat /proc/bus/input/devices | grep PLAYSTATION`
echo $controllerAvailable
PS3_BT_controllerAvailable=`cat /proc/bus/input/devices | grep "PLAYSTATION(R)3 Controller ("`
PS3_USB_controllerAvailable=`lsusb | grep "PlayStation 3 Controller"`

while [ 0 ]
do
oldControllerAvailable=$controllerAvailable
controllerAvailable=`cat /proc/bus/input/devices | grep PLAYSTATION`
if [ "$controllerAvailable" != "$oldControllerAvailable" ]; then
oldPS3_BT_controllerAvailable=$PS3_BT_controllerAvailable
oldPS3_USB_controllerAvailable=$PS3_USB_controllerAvailable

#check for PS3 / USB controller

PS3_USB_controllerAvailable=`lsusb | grep "PlayStation 3 Controller"`
if [ "$PS3_USB_controllerAvailable" != "$oldPS3_USB_controllerAvailable" ]; then
echo "[begin:] PS3 / USB controller changed"

#first attempt
service xboxdrv restart
echo "sending gamepad reconfiguration request"
killall xbmc.bin -SIGUSR1

#second attempt
service xboxdrv restart
echo "sending gamepad reconfiguration request"
killall xbmc.bin -SIGUSR1

#auto start xbmc for first controller being switched on
if [ "$autostartXBMC_PS3_USB" == "enabled" ]; then
echo "auto start function"
autostarted=false
setup_running=`ps ax|grep retrorig-setup| grep -v grep`

if [ -z "$setup_running" ]; then
#retrorig-setup is not running
echo "retrorig-setup is not running"

if [ -z "$oldPS3_USB_controllerAvailable" ]; then
#first controller was switched on
echo "first controller was switched on"

xbmc_running=`ps ax|grep xbmc.bin|grep -v grep`
if [ -z "$xbmc_running" ]; then
# xbmc not running yet
echo "xbmc not running yet"

# get user name
user=`ps aux |grep "/bin/dbus-daemon --config-file"|grep -v grep|cut -f 1 -d " "`

export export DISPLAY=:0.0
echo "auto starting RetroRig for user $user"
sudo -u $user -g $user -s /usr/share/applications/startXBMC.sh &
autostarted=true

else
echo "RetroRig *not* started automatically: XBMC already running, xbmc_running="$xbmc_running
fi
else
echo "RetroRig *not* started automatically: first controller not switched on, oldPS3_USB_controllerAvailable="$oldPS3_USB_controllerAvailable
fi
else
echo "RetroRig *not* started automatically: setup_running="$setup_running
fi

#diagnostic message
sleep 2
if [ "$autostarted" == "true" ]; then
if [ -n "$(ps ax|grep xbmc.bin|grep -v grep)" ]; then
echo "RetroRig sucessfully started"
else
echo "attempt to start RetroRig failed"
fi
fi

else
echo "auto start function disabled"
fi

#Avoid starting XBMC after USB is unplugged.
#For some reasons the game controller connects via
#BT after being unplugged from USB
autostartXBMC_PS3_BT=enabled
echo "[end:] PS3 / USB controller changed"
fi

#check for PS3 / Bluetooth controller

PS3_BT_controllerAvailable=`cat /proc/bus/input/devices | grep "PLAYSTATION(R)3 Controller ("`
if [ "$PS3_BT_controllerAvailable" != "$oldPS3_BT_controllerAvailable" ]; then
echo "[begin:] PS3 / Bluetooth controller changed"

echo "sending gamepad reconfiguration request"
killall xbmc.bin -SIGUSR1

#auto start xbmc for first controller being switched on
if [ "$autostartXBMC_PS3_BT" == "enabled" ]; then
echo "auto start function"
autostarted=false
setup_running=`ps ax|grep retrorig-setup| grep -v grep`

if [ -z "$setup_running" ]; then
#retrorig-setup is not running
echo "retrorig-setup is not running"

if [ -z "$oldPS3_BT_controllerAvailable" ]; then
#first controller was switched on
echo "first controller was switched on"

xbmc_running=`ps ax|grep xbmc.bin|grep -v grep`
if [ -z "$xbmc_running" ]; then
# xbmc not running yet
echo "xbmc not running yet"

# get user name
user=`ps aux |grep "/bin/dbus-daemon --config-file"|grep -v grep|cut -f 1 -d " "`

export export DISPLAY=:0.0
echo "auto starting RetroRig for user $user"
sudo -u $user -g $user -s /usr/share/applications/startXBMC.sh &
autostarted=true
else
echo "RetroRig *not* started automatically: XBMC already running, xbmc_running="$xbmc_running
fi
else
echo "RetroRig *not* started automatically: first controller not switched on, oldPS3_BT_controllerAvailable="$oldPS3_BT_controllerAvailable
fi
else
echo "RetroRig *not* started automatically: setup_running="$setup_running
fi

#diagnostic message
sleep 2
if [ "$autostarted" == "true" ]; then
if [ -n "$(ps ax|grep xbmc.bin|grep -v grep)" ]; then
echo "RetroRig sucessfully started"
else
echo "attempt to start RetroRig failed"
fi
fi

else
echo "auto start function disabled"
fi

echo "[end:] PS3 / Bluetooth controller changed"
fi
sleep 1
done
Expand Down
6 changes: 5 additions & 1 deletion scriptmodules/emulators.shinc
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,10 @@ function em_install_yabause()

function em_install_pcsx2()
{

#prerequisites
$cmd_install_pkg libportaudio2:i386 libjack-jackd2-0:i386

echo "Installing Playstation 2 emulator PCSX2"
$cmd_install_pkg pcsx2
# Unstable version still needs testing:
Expand Down Expand Up @@ -177,7 +181,7 @@ function em_install_gens()
$cmd_remove_pkg gens

echo "Installing Gens Sega CD/32X emulator"
$cmd_pkg_install install gens
$cmd_install_pkg gens

# deprecated: installation from libregeek.org:
#wget --tries=50 -P /tmp "http://www.libregeek.org/RetroRig/Ubuntu-Trusty/emulators/gens//Gens_2.16.7_i386.deb"
Expand Down
197 changes: 0 additions & 197 deletions scriptmodules/emulators.shinc.orig

This file was deleted.

Loading