Elegent method of detecting wireless controller before starting ES

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

RetroPie has a new website and forum. Please visit https://retropie.org.uk/ for the new site. The new forum is located at https://retropie.org.uk/forum/. This forum is left here as a read-only archive.

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

Viewing 1 post (of 1 total)
  • Author
    Posts
  • #85360
    Profile photo of crudster
    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/

Skip to toolbar