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

    xboxdrv - 2 zero delay encoders. Best way to determine p1 vs p2

    Scheduled Pinned Locked Moved Help and Support
    xboxdrv2 controllers
    13 Posts 4 Posters 1.8k 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.
    • mediamogulM
      mediamogul Global Moderator @dsstrainer
      last edited by

      @dsstrainer said in xboxdrv - 2 zero delay encoders. Best way to determine p1 vs p2:

      To use xboxdrv as the driver for both ZD players but for player 2, 2 of the buttons will map to keyboard commands, thus allowing me to use keyboard hotkeys from the player 2 encoder.

      I have a few use cases where I do this.

      I could use
      sudo xboxdrv --evdev /dev/input/by-path/platform-3f980000.usb-usb-0:1.2:2.0-event-joystick
      But I'm surprised this isn't a larger issue for others.

      It affects me directly, as I use two Logitech Rumblepad 2s and the same issue arises. I've been using by-path for nearly a year now and it's worked out well for my needs.

      Alternatively I could write some bash code to go through each device in
      cat /proc/bus/input/devices
      and find which one gets assigned "js1" and which is assigned "js2" on the fly during startup and assign that way.

      Like I said above, I'm pretty happy with my setup, but I really like this idea. If you follow through with it, definitely post the details of how it worked out.

      RetroPie v4.5 • RPi3 Model B • 5.1V 2.5A PSU • 16GB SanDisk microSD • 512GB External Drive

      1 Reply Last reply Reply Quote 0
      • mediamogulM
        mediamogul Global Moderator @psyke83
        last edited by mediamogul

        @psyke83 said in xboxdrv - 2 zero delay encoders. Best way to determine p1 vs p2:

        You could write a udev rule to do what you want

        I really like that too. I experimented with using a udev rule for this at one time and although I didn't see it through, it looked like it would work well.

        RetroPie v4.5 • RPi3 Model B • 5.1V 2.5A PSU • 16GB SanDisk microSD • 512GB External Drive

        P 1 Reply Last reply Reply Quote 0
        • P
          psyke83 Global Moderator @mediamogul
          last edited by

          @mediamogul said in xboxdrv - 2 zero delay encoders. Best way to determine p1 vs p2:

          @psyke83 said in xboxdrv - 2 zero delay encoders. Best way to determine p1 vs p2:

          You could write a udev rule to do what you want

          I really like that too. I experimented with using a udev rule for this at one time and although I didn't see it through, it looked like it was going to work.

          It will work if the rule is correctly implemented. I'm using precisely the same method for my sixaxis service: https://github.com/RetroPie/RetroPie-Setup/pull/2263

          One annoyance, as I said, is that hyphens get mangled during udev <-> systemd communication. I workaround that problem via a simple function in the script, however.

          mediamogulM 1 Reply Last reply Reply Quote 0
          • mediamogulM
            mediamogul Global Moderator @psyke83
            last edited by

            @psyke83

            Very nice.

            RetroPie v4.5 • RPi3 Model B • 5.1V 2.5A PSU • 16GB SanDisk microSD • 512GB External Drive

            1 Reply Last reply Reply Quote 0
            • S
              spud11 @dsstrainer
              last edited by

              @dsstrainer I have 4 DragonRise usb zero delay joysticks and use the by-path method to mimic keys on a keyboard, accompanied by an appropriate udev rule. Like mediamogul, I've been using this set up for more than a year and haven't had any issues. I also use meleu's retropie-joystick-selection tool which is very handy too.

              RetroPie v4.4.1 • RPi3 Model B • 5.1V 2.5A PSU • 32GB SanDisk Extreme microSD • 2TB Toshiba Canvio Basics Portable USB 3.0 hard drive • 4 x DragonRise USB Arcade joysticks • 2 x TurboTwist spinners • 1 x USB trackball • 1 x PS4 wireless • 1 x 8BitDo Zero

              1 Reply Last reply Reply Quote 0
              • D
                dsstrainer
                last edited by dsstrainer

                Thanks for all the advice. Oddly though, my initial first test did not work.
                I decided to start small. Since I was only trying to get the player 2 encoder to have 2 buttons send out the 2 keys I have mapped to Save "]" and Load "6", I only used xboxdrv for those 2 buttons on that input.

                I mapped the 2 buttons on the encoder and started it with --detach. Then I was able to visually see that when I hit those buttons on the command line, it indeed typed out ] and 6
                I also have a keyboard plugged in and it also types out ] and 6
                But when I goto the game and hit those buttons, nothing happens. But if I use the keyboard, it works fine.

                I don't have the exact command line at the moment as I am not home but I'll paste that later. Still was surprised it didn't work.

                RetroPie v4.2 • RPi3 Model B • 5.1V 2.5A PSU • 8GB SanDisk class 10 microSD • 16GB External USB Thumb Drive
                Roms, images and configs stored in USB and symlinked from normal microsd location
                Xarcade Keyboard encoder + Zero Delay Joystick encoder

                1 Reply Last reply Reply Quote 0
                • D
                  dsstrainer
                  last edited by

                  ok here is the command line I used to test quickly:

                  sudo /opt/retropie/supplementary/xboxdrv/bin/xboxdrv --detach --daemon --evdev /dev/input/by-path/platform-3f980000.usb-usb-0:1.3:1.0-event-joystick --evdev-keymap BTN_BASE=l2,BTN_BASE2=r2 --ui-buttonmap l2=KEY_RIGHTBRACE --silent
                  

                  So this is Joy number 2 (in the 1.3 usb port)
                  I set the button which turns out to be BTN_BASE to L2
                  Then I map the buttonmap of L2 to the "]" key which is KEY_RIGHTBRACE in xboxdrv

                  On the command line, when I hit that button, I see it outputting the "]" key
                  When I hit that key on my keyboard I also see the "]" key
                  When I start a game and hit that mapped button, it doesn't nothing
                  But if I use the keyboard, it works fine.

                  So where is the disconnect with it in the game?

                  RetroPie v4.2 • RPi3 Model B • 5.1V 2.5A PSU • 8GB SanDisk class 10 microSD • 16GB External USB Thumb Drive
                  Roms, images and configs stored in USB and symlinked from normal microsd location
                  Xarcade Keyboard encoder + Zero Delay Joystick encoder

                  1 Reply Last reply Reply Quote 0
                  • P
                    psyke83 Global Moderator
                    last edited by psyke83

                    My guess is that xboxdrv is creating a unique virtual uinput device node to emit the emulated keystrokes, but the emulator is only observing the actual keyboard's input event node? I have never used this daemon so I can't be sure.

                    D 1 Reply Last reply Reply Quote 0
                    • D
                      dsstrainer
                      last edited by

                      Well you are right.. I do see virtual devices. I will try without the daemon and see if that works

                      RetroPie v4.2 • RPi3 Model B • 5.1V 2.5A PSU • 8GB SanDisk class 10 microSD • 16GB External USB Thumb Drive
                      Roms, images and configs stored in USB and symlinked from normal microsd location
                      Xarcade Keyboard encoder + Zero Delay Joystick encoder

                      1 Reply Last reply Reply Quote 0
                      • D
                        dsstrainer @psyke83
                        last edited by

                        @psyke83 So how do you handle multiple joypads without running as a daemon? Just run multiple instances of xboxdrv process?

                        RetroPie v4.2 • RPi3 Model B • 5.1V 2.5A PSU • 8GB SanDisk class 10 microSD • 16GB External USB Thumb Drive
                        Roms, images and configs stored in USB and symlinked from normal microsd location
                        Xarcade Keyboard encoder + Zero Delay Joystick encoder

                        S 1 Reply Last reply Reply Quote 0
                        • S
                          spud11 @dsstrainer
                          last edited by

                          @dsstrainer That is correct.

                          RetroPie v4.4.1 • RPi3 Model B • 5.1V 2.5A PSU • 32GB SanDisk Extreme microSD • 2TB Toshiba Canvio Basics Portable USB 3.0 hard drive • 4 x DragonRise USB Arcade joysticks • 2 x TurboTwist spinners • 1 x USB trackball • 1 x PS4 wireless • 1 x 8BitDo Zero

                          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.