• Recent
  • Tags
  • Popular
  • Home
  • Docs
  • Register
  • Login
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

Failure to boot with xboxdrv initialisation in rc.local

Scheduled Pinned Locked Moved Help and Support
xboxdrvboot failcustom controls
25 Posts 2 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.
  • A
    Applepie2
    last edited by 20 Dec 2022, 21:00

    Pi Model or other hardware: 4B
    Power Supply used: Official 3A RPi Power supply
    RetroPie Version Used: 4.8.2
    Built From: Raspberry Pi Imager - No background OS
    USB Devices connected: Custom controller running of TeensyLC
    Controller used: Custom controller running of TeensyLC
    Error messages received: None
    Guide used: Universal-Controller-Calibration-Mapping-Using-xboxdrv

    Hi,

    I've been working on a custom handheld console emulator using Retropie. For my controller I've made a custom design which is using a TeensyLC as the microcontroller. My custom controls are all recognised in emulationstation and I can both navigate the menus and play games succesfully. However, the analogue sticks are far from perfect with the biggest issues being lack of deadzone and mismatched maximum/minimum bounds. From what I had read around the documentation and forums, a good solution to this was to map my controls through xboxdrv.

    I followed the guide listed above and successfully managed to identify my controller input, button/axis IDs and create the command to perform the mapping. If I run the command from the terminal then it gives a success message and says the controller is now mapped to js3. However, when I move the same command to /etc/rc.local and reboot the system, my splash screen is displayed, but then it hangs indefinitely. In the terminal logs I can see that the mapping command in rc.local runs and gives the same success message, but after two more terminal logs about starting samba the system just hangs and never boots into emulationstation.

    If I unplug my custom controller, then the rc.local command fails and the system boots as normal.

    The command I am using is:

    sudo /opt/retropie/supplementary/xboxdrv/bin/xboxdrv \
      --evdev /dev/input/by-id/usb-Teensyduino_Keyboard_Mouse_Joystick_12700840-if03-event-joystick \
      --silent \
      --detach-kernel-driver \
      --force-feedback \
      --deadzone-trigger 15% \
      --deadzone 4000 \
      --calibration x1=-28343:0:21192,y1=-24257:0:22384,x2=-28343:0:23320,y2=-24768:0:25107
      --mimic-xpad \
      --dpad-as-button \
      --device-name "ApplePi Controller" \
      --evdev-absmap ABS_RZ=x1,ABS_Z=y1,ABS_Y=x2,ABS_X=y2
      --evdev-keymap BTN_BASE=dd,BTN_PINKIE=du,BTN_BASE2=dl,BTN_BASE3=dr,BTN_TRIGGER=a,BTN_TOP=b,BTN_THUMB2=y,BTN_THUMB=x,BTN_BASE4=start,BTN_TOP2=back \
      --ui-axismap lt=void,rt=void \
      --ui-buttonmap tr=void,tl=void,lb=void,rb=void,guide=void \
      &
    

    On a failure to boot the last 3 service messages (the only three messages after the success message from xboxdvr) I see start are:

    [  OK  ] Started Samba NMB Daemon.
             Starting Samba SMB Daemon...
    [  OK  ] Started Samba SMB Daemon.
    

    If I put on more verbose logging then the last three messages in the log before it hangs are:

    systemd[1]: Created slice system-system\x2dfsck.slice
    systemd[1]: Listening on udev Kernel Socket.
    systemd[1]: Reached target Swap
    

    Any advice on what might be the cause (and solution) of this issue would be very much appriciated.

    1 Reply Last reply Reply Quote 0
    • M
      mitu Global Moderator
      last edited by 21 Dec 2022, 05:27

      Try to run the command as

      nohup opt/retropie/supplementary/xboxdrv/bin/xboxdrv \
        --evdev /dev/input/by-id/usb-Teensyduino_Keyboard_Mouse_Joystick_12700840-if03-event-joystick \
        --silent \
        --detach-kernel-driver \
      ....
      

      without the ending &. Since it runs from /etc/rc.local, it doesn't need to use sudo, all commands there are run as root. Run the command first from the command line to check that it works, and then add it to /etc/rc.local.

      1 Reply Last reply Reply Quote 0
      • A
        Applepie2
        last edited by 21 Dec 2022, 10:15

        Thanks very much for the quick response!

        Sadly if I remove the & and change sudo to nohup, then I get the following response when running the command from the terminal:

        nohup: ignoring input and appending output to 'nohup.out'
        

        Just to check if this changed the boot behaviour I also edited rc.local to this format and tried to boot. The same message appears in the boot log and the system still hangs at the same point.

        1 Reply Last reply Reply Quote 0
        • M
          mitu Global Moderator
          last edited by 21 Dec 2022, 11:52

          The message shown is normal, it's not an error.
          Do you have anything else in /etc/rc.local ? Can you post its entire content here ?

          A 1 Reply Last reply 21 Dec 2022, 13:39 Reply Quote 0
          • A
            Applepie2 @mitu
            last edited by 21 Dec 2022, 13:39

            @mitu The rest of my rc.local file is still default:

            #!/bin/sh -e
            #/etc/rc.local
            #
            # rc.local
            #
            # This script is executed at the end of each multiuser runlevel.
            # Make sure that the script will "exit 0" on success or any other
            # value on error.
            #
            # In order to enable or disable this script just change the execution
            # bits.
            #
            # By default this script does nothing.
            # Print the IP address
            _IP=$(hostname -I) || true
            if [ "$_IP" ]; then
            printf "My IP address is %s\n" "$_IP"
            fi
            nohup /opt/retropie/supplementary/xboxdrv/bin/xboxdrv \
            --evdev /dev/input/by-id/usb-Teensyduino_Keyboard_Mouse_Joystick_12700840-if03-event-joystick \
            --silent \
            --detach-kernel-driver \
            --force-feedback \
            --deadzone-trigger 15% \
            --deadzone 4000 \
            --calibration x1=-28343:0:21192,y1=-24257:0:22384,x2=-28343:0:23320,y2=-24768:0:25107
            --mimic-xpad \
            --dpad-as-button \
            --device-name "ApplePi Controller" \
            --evdev-absmap ABS_RZ=x1,ABS_Z=y1,ABS_Y=x2,ABS_X=y2
            --evdev-keymap BTN_BASE=dd,BTN_PINKIE=du,BTN_BASE2=dl,BTN_BASE3=dr,BTN_TRIGGER=a,BTN_TOP=b,BTN_THUMB2=y,BTN_THUMB=x,BTN_BASE4=start,BTN_TOP2=back \
            --ui-axismap lt=void,rt=void \
            --ui-buttonmap tr=void,tl=void,lb=void,rb=void,guide=void \
            exit 0
            1 Reply Last reply Reply Quote 0
            • M
              mitu Global Moderator
              last edited by 21 Dec 2022, 15:18

              Remove the \ from the last line of the xboxdrv command, since there's no additional & on the next line there's no need for a line continuation.

              1 Reply Last reply Reply Quote 0
              • A
                Applepie2
                last edited by Applepie2 21 Dec 2022, 16:07

                Tried removing the extra line continuation \, but still the same problem I'm afraid.

                I'm going to try reducing the command to barebones as possible and see if there is any particular parameter which is the cause.

                If you have any further suggestions I would be keen to hear them though. Thanks again for your advice so far.

                EDIT:
                I removed the --deadzone-trigger, --deadzone, --force-feedback, --calibration, --ui-axismap and --ui-buttonmap parameters, but the problem still persists.

                1 Reply Last reply Reply Quote 0
                • A
                  Applepie2
                  last edited by 21 Dec 2022, 16:20

                  Just a thought, although I may be way off here:

                  When I run the command through the terminal it gives the message:

                  Your Xbox/Xbox360 controller should now be available as:
                   /dev/input/js3
                   /dev/input/event7
                  
                  Press Ctrl-C to quit
                  

                  It then doesn't return to the terminal unless an interrupt (ctrl+c) is given. Could it be that the start up process is locked waiting for this interrupt?

                  M 1 Reply Last reply 21 Dec 2022, 16:48 Reply Quote 0
                  • M
                    mitu Global Moderator @Applepie2
                    last edited by mitu 21 Dec 2022, 16:48

                    @Applepie2 said in Failure to boot with xboxdrv initialisation in rc.local:

                    Could it be that the start up process is locked waiting for this interrupt?

                    Maybe, though I'd expect using either & or nohup to fix this, since they send the process to run in the background.

                    Now that I have a PI available, I've tried to run the command and I think you've missed a line continuation after the --evdev-absmap parameter

                    ...
                     --device-name "ApplePi Controller" \
                      --evdev-absmap ABS_RZ=x1,ABS_Z=y1,ABS_Y=x2,ABS_X=y2
                    ...
                    

                    should be

                     --device-name "ApplePi Controller" \
                      --evdev-absmap ABS_RZ=x1,ABS_Z=y1,ABS_Y=x2,ABS_X=y2 \
                    

                    Try adding the missing \ and run the command again from /etc/rc.local.

                    1 Reply Last reply Reply Quote 0
                    • A
                      Applepie2
                      last edited by 21 Dec 2022, 17:38

                      Added the missing the line continuation and checked all other lines to ensure there were no other \ missing.

                      Sadly still hangs at the same place.

                      M 1 Reply Last reply 21 Dec 2022, 17:44 Reply Quote 0
                      • M
                        mitu Global Moderator @Applepie2
                        last edited by mitu 21 Dec 2022, 17:44

                        @Applepie2 you had one more line continuation missing (for the --calibration param), but I assume you found it and fixed it.
                        What happens if you run the command directly, instead of using /etc/rc.local ? E.g. nohup sudo xboxdrv ... - do you get the control back or it's still blocking the input ?

                        1 Reply Last reply Reply Quote 0
                        • A
                          Applepie2
                          last edited by 21 Dec 2022, 18:01

                          If I run it directly, then it does return control.

                          M 1 Reply Last reply 21 Dec 2022, 18:08 Reply Quote 0
                          • M
                            mitu Global Moderator @Applepie2
                            last edited by 21 Dec 2022, 18:08

                            I don't see why it wouldn't work also in /etc/rc.local. As an alternative, try adding it to the autostart script in /opt/retropie/configs/all/autostart.sh, before emulationstation is run. Try with:

                            sudo xboxdrv
                              --..
                             --ui-buttonmap tr=void,tl=void,lb=void,rb=void,guide=void \
                              &
                            
                             emulationstation #auto
                            
                            1 Reply Last reply Reply Quote 0
                            • A
                              Applepie2
                              last edited by 21 Dec 2022, 19:57

                              I've tried moving the command to the autostart script autostart.sh, and although I now boot successfully, I don't think the command is running successfully as the controller seems to still be behaving as it was before mapping, and when loading games it still references the "Teensyduino_Keyboard_Mouse_Joystick" rather than "ApplePi Controller".

                              I've double checked all the spelling, line continuations and everything seems fine.

                              My command hasn't changed, except I replaced the
                              nohup opt/retropie/supplementary/xboxdrv/bin/xboxdrv \
                              with just
                              sudo xboxdrv \

                              And I added the extra line continuation \ and final & back in.

                              Is sudo xboxdrv enough of a path from the autostart script?

                              M 1 Reply Last reply 21 Dec 2022, 20:07 Reply Quote 0
                              • M
                                mitu Global Moderator @Applepie2
                                last edited by 21 Dec 2022, 20:07

                                @Applepie2 said in Failure to boot with xboxdrv initialisation in rc.local:

                                Is sudo xboxdrv enough of a path from the autostart script?

                                No, you need to add the full path to xboxdrv.

                                1 Reply Last reply Reply Quote 0
                                • A
                                  Applepie2
                                  last edited by 21 Dec 2022, 22:51

                                  Added the full path and checked the command was correct again and see no noticeable errors.

                                  It still doesn't appear to be running the command successfully though as the controller is still being recognised as Teensyduino_Keyboard_Mouse_Joystick. Is there anyway to get a verbose output from the autostart.sh script, so I can see what is actually happening?

                                  M 1 Reply Last reply 22 Dec 2022, 04:47 Reply Quote 0
                                  • M
                                    mitu Global Moderator @Applepie2
                                    last edited by 22 Dec 2022, 04:47

                                    @Applepie2 You can comment out the emulationstation #auto line and see the output of the command on the terminal, just after the boot. You can also redirect the output of the command to a log file and inspect the log file.

                                    sudo /opt/retropie/supplementary/xboxdrv/bin/xboxdrv 1>&2 2>/home/pi/xboxdrv.log \
                                    .... # the rest of the xboxdrv command parameters
                                    #emulationstation #auto
                                    A 1 Reply Last reply 22 Dec 2022, 11:37 Reply Quote 0
                                    • A
                                      Applepie2 @mitu
                                      last edited by Applepie2 22 Dec 2022, 11:37

                                      @mitu I've tried both options you mentioned above and I see the success message print in the terminal saying that the controller is mapped to js3, and the log remains empty. This leads me to believe that the command is running successfully.

                                      However, the controller still seems to be seen by emulationstation/retroarch as "Teensyduino_Keyboard_Mouse_Joystick".

                                      If I go into the terminal and check with ls /dev/input/js* then only js0, js1 and js2 are shown. Equally if I try to run jstest on js3 then it says (as expect based on the previous command) No such file or directory.

                                      Is there any reason that the command would appear to run successfully but NOT actually map the controls?

                                      Thank you again so much for your advice, sorry for taking up your time!

                                      EDIT:
                                      I've found a typo in the command (I'm gonna blame tiredness for missing it last night). I had used a - instead of a _ on one of the button mappings. The command is now certainly running and I am able to boot into emulationstation. However now my controller doesn't work at all in emulationstation. If I run jstest on js3 though it is working perfectly and everything is mapped as expected. Do I need to somehow assign a different primary controller, or register the controller with emulationstation somehow?

                                      M 1 Reply Last reply 22 Dec 2022, 11:54 Reply Quote 0
                                      • M
                                        mitu Global Moderator @Applepie2
                                        last edited by mitu 22 Dec 2022, 11:54

                                        @Applepie2 said in Failure to boot with xboxdrv initialisation in rc.local:

                                        Do I need to somehow assign a different primary controller, or register the controller with emulationstation somehow?

                                        EmulationStation doesn't have the notion of a 'Primary Controller', it will receive inputs from all (supported/known) controllers.
                                        Run emulationstation with the --debug parameter and post the log, it should show the controller(s) it detects. Try to configure the gamepad and then exit (press F4).

                                        In addition to the log from EmulationStation, please post the output of cat /proc/bus/input/devices after xboxdrv has been started.

                                        A 1 Reply Last reply 22 Dec 2022, 13:06 Reply Quote 0
                                        • A
                                          Applepie2 @mitu
                                          last edited by 22 Dec 2022, 13:06

                                          @mitu For the emulationstation log I get:

                                          Dec 22 12:56:27 lvl3: SystemView:getViewElements()
                                          Dec 22 12:56:27 lvl3: fireEvent: system-select c64 gotostart
                                          Dec 22 12:56:27 lvl2: Added known joystick 'Teensyduino Keyboard/Mouse/Joystick' (instance ID: 0, device index: 0).
                                          Dec 22 12:56:27 lvl2: Added known joystick 'Teensyduino Keyboard/Mouse/Joystick (instance ID: 1, device index: 1).
                                          Dec 22 12:56:29 lvl2:Added unconfigured joystick 'ApplePi Controller' (GUID:030000005e0400008e02000010010000, instance ID: 2, device index: 2). 
                                          

                                          For the output of cat /proc/bus/input/devices I get a list of all my devices, which includes the registered 'ApplePi Controller':

                                          I: Bus=0003 Vendor=045e Product=028e Version=0110
                                          N: Name="ApplePi Controller"
                                          P: Phys=
                                          S: Sysfs=/devices/virtual/input/input25
                                          U: Uniq=
                                          H: Handlers=event3 js3
                                          B: PROP=0
                                          B: EV=20000b
                                          B: KEY=7cdb03c0 0 0 0 0 0 0 0 0 0
                                          B: ABS=3f
                                          B: FF=1 3f870000 0 0
                                          

                                          As a side note, at the moment I am manually typing these outputs out for you, is there a simple way for me to be able to copy and paste the whole logs?

                                          M 1 Reply Last reply 22 Dec 2022, 14:06 Reply Quote 0
                                          20 out of 25
                                          • First post
                                            20/25
                                            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.

                                            This community forum collects and processes your personal information.
                                            consent.not_received