I was frustrated at the constant “new controller detected” everytime i start up the new RetroPie, so i modified the /usr/bin/emulationstation script to check if a controller is found before launching. This is specific to PS3 controllers, but i’m sure you could modify it to handle just about anything.
Modify the script, removing the $es_bin “$@” at the bottom and add this instead.Essentially it goes into an infinite for loop, checking dmesg. when dmesg shows at least one instance of “input: PLAYSTATION” then it starts the $es_bin “$@”.
for (( ; ; ))
do
if [[ $(dmesg |grep ‘input: PLAYSTATION’ |wc -l) -ne 0 ]]; then
$es_bin “$@”
break
exit 0
fi
sleep 1
done
So the whole script looks like
#——
#!/bin/bash
es_bin=”/opt/retropie/supplementary/emulationstation/emulationstation”
nb_lock_files=$(find /tmp -name “.X?-lock” | wc -l)
if [[ $nb_lock_files -ne 0 ]]; then
echo “X is running. Please shut down X in order to mitigate problems with loosing keyboard input. For example, logout from LXDE.”
exit 1
fi
for (( ; ; ))
do
if [[ $(dmesg |grep ‘input: PLAYSTATION’ |wc -l) -ne 0 ]]; then
$es_bin “$@”
break
exit 0
fi
sleep 1
done
#———–