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

    runcommand-onend.sh: error on "kill xboxdrv"

    Scheduled Pinned Locked Moved Help and Support
    runcommand-onenxboxdrv
    10 Posts 3 Posters 1.4k 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.
    • Y
      yramrag
      last edited by

      Hi all,
      I get an error when I try to use runcommand-onend.sh to kill the xboxdrv instance.

      My runcommand-onend.sh is as simple as as:

      pi@retropie:~ $ cat /opt/retropie/configs/all/runcommand-onend.sh
      #!/bin/sh
      
      sudo killall xboxdrv
      #sudo killall > /dev/null 2>&1 xboxdrv
      

      Emulationstation exits to shell, the following error is printed and the system becomes unresponsive to the attached keyoard, but I can still login via ssh (and issue a reboot).

      emulationstation: /home/pi/RetroPie-Setup/tmp/build/emulationstation/es-core/src/InputManager.cpp:71: void InputManager::addJoystickByDeviceIndex(int): Assertion `joy' failed.
      Aborted
      

      This happens only when the kill command is run from runcommand-onend.sh; if I exit to shell and type it, there are no errors.

      I'm using:

      • Pi 3
      • Power Supply: 5V/2.5A Power Adapter (see this kit)
      • RetroPie Version: v4.3 (September 2017)
      • Built from pre made SD Image on RetroPie website
      • USB Devices connected: 1 wireless logitech keyboard, 1 wired mouse
      • Controller used: 2x wiimotes + SNES mini controller,
        connected using MoltenGamepad
        Both the controllers run fine without xboxdrv; I'm using the xboxdrv only for Amiga emulation (this is why I need to kill the driver on exit).
      • Guide used to configure xboxdrv: Universal Controller Calibration & Mapping Using xboxdrv

      The controller (only one, I still haven't figured out how to use 2 different controllers on Amiga) runs fine on Amiga games; but at the moment I still have to exit to shell wiht F4 and run sudo killall xboxdrv manually.

      Any idea?

      jonnykeshJ 1 Reply Last reply Reply Quote 0
      • jonnykeshJ
        jonnykesh @yramrag
        last edited by

        @yramrag Just a random thought... try it without the shebang. It seems counter-intuitive but my runcommand-onend.shfor continuing the background music does not contain a shebang

        1 Reply Last reply Reply Quote 0
        • cyperghostC
          cyperghost
          last edited by cyperghost

          @yramrag
          Please try this after you tried @jonnykesh suggestions ;)

          Call a script from the runcommand-onend.sh
          with /pathtomyscript/yourscript.sh &
          name it as you like and make it executable with chmod +x yourscript.sh

          #!/bin/bash
          sleep 5
          sudo killall xboxdrv
          

          I would like to send the kill-script into the background with & and let runcommand end it's session. After 5 seconds the xboxdrv is terminated.

          jonnykeshJ 1 Reply Last reply Reply Quote 0
          • jonnykeshJ
            jonnykesh @cyperghost
            last edited by jonnykesh

            @cyperghost Or he could try adding
            bash "/path/to/my/script/location/scriptname.sh" to the runcommand-onend.sh

            Or try changing the shebang to bash, ie #!/bin/bash instead of #!/bin/sh

            cyperghostC 1 Reply Last reply Reply Quote 0
            • cyperghostC
              cyperghost @jonnykesh
              last edited by cyperghost

              @jonnykesh Well....
              ES itself reports an error. I think we should wait of yramrag feedback :)

              @yramrag
              What will happen if you enter killall xboxdrv in a SSH session?

              jonnykeshJ 1 Reply Last reply Reply Quote 0
              • jonnykeshJ
                jonnykesh @cyperghost
                last edited by jonnykesh

                @cyperghost Would pkillrather than killallmake a difference?

                cyperghostC 1 Reply Last reply Reply Quote 0
                • cyperghostC
                  cyperghost @jonnykesh
                  last edited by cyperghost

                  @jonnykesh pkill and killall are very equal if you use it with command programmname

                  But pkill test uses regex so all instanced that contains a pattern with test in it
                  it will kill test1, 1test, abctestabc... and so on. Therefore it would be better to use pkill -x

                  killall testterminates all proceses that are named test

                  Therefore I often use pgrep to determinate PID number and then kill the PID-number just by kill PID ... if I obtain more than one PID number with pgrep something went wrong ;) More to read here

                  1 Reply Last reply Reply Quote 1
                  • Y
                    yramrag
                    last edited by

                    @jonnykesh
                    No difference; with or without the shebang I still get the same error.
                    Also, there's no difference with #!/bin/bash instead of #!/bin/sh.

                    @cyperghost
                    This actually works!
                    Now my runcommand-onend.sh is just

                    /home/pi/bin/killxboxdrv.sh &
                    

                    and killxboxdrv.sh is

                    #!/bin/bash
                    sleep 3
                    sudo killall xboxdrv
                    

                    (I reduced sleep time from 5 to 3)

                    Many thanks to both of you!

                    cyperghostC jonnykeshJ 2 Replies Last reply Reply Quote 0
                    • cyperghostC
                      cyperghost @yramrag
                      last edited by

                      @yramrag You're welcome

                      1 Reply Last reply Reply Quote 0
                      • jonnykeshJ
                        jonnykesh @yramrag
                        last edited by

                        @yramrag No worries. I was just throwing out random ideas as opposed to actually understanding and fixing the issue! But it's always worth checking the easy stuff first. Glad to hear you are all sorted now.

                        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.