Elegent method of detecting wireless controller before starting ES

Welcome Page Forums RetroPie Project Everything else related to the RetroPie Project Elegent method of detecting wireless controller before starting ES

This topic contains 0 replies, has 1 voice, and was last updated by  crudster 2 years, 12 months ago.

Viewing 1 post (of 1 total)
  • Author
    Posts
  • #85360

    crudster
    Participant

    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

    #———–

Viewing 1 post (of 1 total)

Forums are currently read only - please visit the new RetroPie forums at https://retropie.org.uk/forums/

PLEASE NOTE: All orders that are placed between January 14th and January 28th will be shipped on January 29th. Dismiss