RetroPie forum home
    • Recent
    • Tags
    • Popular
    • Home
    • Docs
    • Register
    • Login
    Please do not post a support request without first reading and following the advice in https://retropie.org.uk/forum/topic/3/read-this-first

    LEDSpicer and Emulationstation Issue

    Scheduled Pinned Locked Moved Help and Support
    ledspiceremulationstatioprofiles
    12 Posts 5 Posters 1.0k Views
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • J
      joesnow81
      last edited by

      Hi

      I have installed LEDSpicer and I'm 95% complete. I can run all the commands from the shell and light LED's, run profiles etc but I can't get it to run a specific profile when a game is selected within ES. I'm just trying to start with a simple one for NES. All I want it to do is light the first 2 buttons when a game is selected. I can run 'emitter LoadProfileByEmulator mario nes' and the first 2 buttons are lit. I can then run -emitter FinishLastProfile' and the LED's go back to the default profile.

      I have followed this wiki (https://sourceforge.net/p/ledspicer/wiki/Emulation Station Integration/), created the runEmulator.sh file, amended the command line in es_systems file for NES to be <command>/opt/retropie/supplementary/runcommand/runEmulator.sh nes %ROM% %BASENAME% nes</command>. The game loads but the leds don't change. It's like it follows the runEmulator.sh script but misses the first line telling it the profile to load. This is my runEmulator.sh

      #!/bin/bash
      
      #    $1 - the system (eg: atari2600, nes, snes, megadrive, fba, etc).
      #    $2 - Rom path
      #    $3 - Rom name
      #    $4 - Platform (arcade, generic, etc)
      
      EMU=$1
      ROM=$2
      RAW=$3
      SYS=$4
      
      emitter LoadProfile $SYS > /dev/null 2>&1
      
      /opt/retropie/supplementary/runcommand/runcommand.sh 0 _SYS_ $EMU "$ROM"
      
      emitter FinishLastProfile > /dev/null 2>&1
      
      exit 0
      

      I know it's going to be something simple that I'm missing but for the life of me I can't work it out.

      Pi Model or other hardware: pi4b 4gb
      Power Supply used: 5.1v 3a
      RetroPie Version Used (eg 3.6, 3.8.1, 4.1 - do not write latest):4.5.18
      Built From: (Pre made SD Image on RetroPie website, Berryboot, or on top of existing OS etc.. - please provide the filename of any image used) running on raspbian 10 buster
      USB Devices connected: Dragonwise Generic USB Joystick, XIN-MO Dual Arcade, keyboard
      ES version: 2.9.0rp

      1 Reply Last reply Reply Quote 0
      • mituM
        mitu Global Moderator
        last edited by

        Most likely the emitter command should be specificed as absolute path, it might not be in $PATH.

        Aside from that, overriding the runcommand might not be the best approach, RetroPie provides the ability to run things before and after the emulator is launched - using the same parameters as runcommand : https://retropie.org.uk/docs/Runcommand/#runcommand-onstart-and-runcommand-onend-scripts. You might want to use the onstart/onend scripts to call LEDSpicer instead of replacing runcommand in EmulationStation's configuration.

        J 1 Reply Last reply Reply Quote 0
        • J
          joesnow81 @mitu
          last edited by

          @mitu said in LEDSpicer and Emulationstation Issue:

          Most likely the emitter command should be specificed as absolute path, it might not be in $PATH.

          Aside from that, overriding the runcommand might not be the best approach, RetroPie provides the ability to run things before and after the emulator is launched - using the same parameters as runcommand : https://retropie.org.uk/docs/Runcommand/#runcommand-onstart-and-runcommand-onend-scripts. You might want to use the onstart/onend scripts to call LEDSpicer instead of replacing runcommand in EmulationStation's configuration.

          Ah yes, that totally makes sense. I was just following the wiki for LEDSpicer but I will check out the onstart and onend scripts as an alternative.

          My other struggle is trying to get the service to start on boot up. If I run sudo service ledspicerd start then it runs as expected but I can't seem to get it to run on boot up. I'm a linux noob so am still continuing my google searches on this one.

          1 Reply Last reply Reply Quote 0
          • J
            joesnow81
            last edited by

            So I created the following runcommand-onstart.sh file in opt/retropie/configs/all and all is working great.

            #!/usr/bin/env bash
            
            # Get system name
            system=$1
            emulator=$2
            rom=$3
            command=$4
            
            # rom_bn receives $rom excluding everything from the first char to the last slash '/'
            rom_bn="${rom##*/}"
            
            # rom_bn receives $rom_bn excluding everything from the last char to the first dot '.'
            rom_bn="${rom_bn%.*}"
            
            # Write to Runcommand Log to test
            echo "I succesfully ran ON START" >> $HOME/start.log
            echo "$system" >> $HOME/start.log
            echo "$emulator" >> $HOME/start.log
            echo "$rom" >> $HOME/start.log
            echo "$command" >> $HOME/start.log
            echo "$rom_bn" >>$HOME/start.log
            
            # Call emitter and pass variable
            emitter LoadProfileByEmulator "$rom_bn" $system  > /dev/null 2>&1
            

            Just to tidy up my profiles that are game specific I stripped off the path and file extension from the rom path to create the $rom_bn. In order to pass through the games that have spaces and characters in, the $rom_bn has to be wrapped in " " when called by the emitter command.

            As a test I also added the lines to write to a log file each variable just to make sure I was getting the correct information to pass through.

            This is my runcommand-onend.sh

            #!/usr/bin/env bash
            
            # Write to Runcommand Log
            echo "I succesfully ran ON exit" >> $HOME/test.log
            echo "$system" >> $HOME/exit.log
            echo "$emulator" >> $HOME/exit.log
            echo "$rom" >> $HOME/exit.log
            
            # Call Emitter to end profile
            emitter FinishAllProfiles  > /dev/null 2>&1
            

            Again just to test I had some bits write to a log file.

            Everything is working perfectly and I've learnt loads about the file structure and writing simple scripts by just trying to get this working so thanks to all the contributors.

            F 1 Reply Last reply Reply Quote 0
            • T
              TwistedPixels
              last edited by TwistedPixels

              Thanks man this helped me a lot. Trying to get LEDSpicer up and running.
              The one problem I've run into is that the ledspicerd service seems to stop running when I launch a game.

              It boots up, service is running and default profile loads fine, then when I launch a game nothing.
              The logs are working so the run command-onstart and onend are working, but the emitter command seems to do nothing.

              I try loading a profile through ssh and nothing happens. I have to send the command to start the service and then it kicks back into life.

              Not sure what I'm doing wrong here, do you have any idea?
              How do you start the service? I just used the optional run as root at boot from the installation instructions.

              1 Reply Last reply Reply Quote 0
              • T
                TwistedPixels
                last edited by

                Update: I've figured out that the service is running properly. It's just the LoadProfileByEmulator command that's failing. It just stops everything. I've tried putting in rom profiles, player profiles. Nothing loads even the default profile.

                It all works beautifully if I use LoadProfile $system instead, which leads me to believe there's a problem with the LoadProfileByEmulator.

                If anyone has any insight please let me know!

                F 1 Reply Last reply Reply Quote 0
                • F
                  fadangalini @TwistedPixels
                  last edited by

                  @twistedpixels

                  I've been trying to get this working this week but don't know why it won't.
                  Grateful for any ideas to try!

                  I'm trying the below:
                  emitter LoadProfile $system > /dev/null 2>&1
                  But the profile doesn't change...

                  If I change it to:
                  emitter LoadProfile n64
                  it works fine...

                  and in the test log, under system it clearly reads n64
                  so does anyone have an idea??

                  By the way, what does ' > /dev/null 2>&1' mean? this is all new to me.

                  Thanks.

                  F 1 Reply Last reply Reply Quote 0
                  • F
                    fadangalini @fadangalini
                    last edited by

                    @fadangalini

                    Ok, so I've got it working!! had to change the command to:
                    emitter LoadProfile "$1" > /dev/null 2>&1

                    Still don't know what > /dev/null 2>&1 does...

                    mituM 1 Reply Last reply Reply Quote 0
                    • mituM
                      mitu Global Moderator @fadangalini
                      last edited by

                      @fadangalini said in LEDSpicer and Emulationstation Issue:

                      Still don't know what > /dev/null 2>&1 does...

                      This instructs the shell to redirect any program output (text that might be printed on the screen) to /dev/null, which basically discards any output text (errors or regular info)./dev/null is a special file which discards anything that's written to it.

                      F 1 Reply Last reply Reply Quote 0
                      • F
                        fadangalini @mitu
                        last edited by

                        @mitu

                        Thanks mitu. I'm learning slowly!

                        1 Reply Last reply Reply Quote 0
                        • F
                          fadangalini @joesnow81
                          last edited by

                          @joesnow81
                          Hi, I'm trying to get the rom specific part to work.

                          With the line below nothing happens.
                          emitter LoadProfileByEmulator "$rom_bn" $system > /dev/null 2>&1

                          I was having a play and changing $system to $1 would load the system specific profile. The new line is below:
                          emitter LoadProfileByEmulator "$rom_bn" $1 > /dev/null 2>&1

                          But it isn't loading the rom specific profile I created, just the system.

                          Does the system specific profile have to be in a particular location?
                          I've put it in a couple of places to try but it doesn't load. It is named exactly the same as the rom. I've put it in the following:

                          /usr/local/share/ledspicer/profiles
                          and
                          /usr/local/share/ledspicer/profiles/megadrive

                          Any ideas greatly appreciated, Thanks

                          W 1 Reply Last reply Reply Quote 0
                          • W
                            wtstreetglow1 @fadangalini
                            last edited by

                            @fadangalini Did you end up getting this working? If so, could you provide me with some enlightenment. Thank you, I will begin this process this coming weekend.

                            1 Reply Last reply Reply Quote 0
                            • First post
                              Last post

                            Contributions to the project are always appreciated, so if you would like to support us with a donation you can do so here.

                            Hosting provided by Mythic-Beasts. See the Hosting Information page for more information.