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

    Running xboxdrv from runcommand-onstart not working

    Scheduled Pinned Locked Moved Help and Support
    retropiexboxdrvlr-bluemsxretropie 4.3.8
    7 Posts 2 Posters 1.3k 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.
    • mitaholoM
      mitaholo
      last edited by

      I've been trying to map my DualShock 4 to be read as a keyboard with xboxdrv. Otherwise it works great but if I run xboxdrv before opening an emulator or from runcommand-onstart.sh, the emulator will ignore the keypresses unless I kill xboxdrv and run it again. After that the mapping works normally.

      Example case:

      1. Emulationstation is on and I run my xboxdrv command from a SSH terminal (A): Your Xbox/Xbox360 controller should now be available as: /dev/input/js2 /dev/input/event4
      2. I open evtest in a second SSH session (B) and it reads event4 inputs as keyboard presses. Emulationstation's configure input screen does the same.
      3. I run Metal Gear on Emulationstation and it opens on lr-bluemsx.
      4. Evtest (B) still reports the event4 virtual keypresses correctly but the emulator ignores them completely. Pressing space in the "Press Space" screen does nothing. (An actual keyboard does work correctly)
      5. I interrupt and close xboxdrv in terminal A and run it again with the same command. Like before, it creates a virtual device in js2 and event4. Evtest (B) closed automatically with the earlier virtual device so I run it again.
      6. Now the game answers my input correctly even though according to evtest nothing has changed.

      The same happens if the xboxdrv command is run from runcommand-onstart.sh. Any idea what causes this?

      My xboxdrv command is: https://pastebin.com/nkpcKFC7

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

        @mitaholo

        It sounds like you've got everything working well on the xboxdrv side of things, which is usually the hardest part. Looking towards RetroArch, have you tried adding

        input_libretro_device_p2 = "3"
        

        to /opt/retropie/configs/msx/retroarch.cfg? This is usually required for lr-bluemsx to get keyboard support of any kind. Something else that comes to mind is that RetroArch will ignore the virtual keyboard xboxdrv creates unless a udev rule is created. You can find more info on that at the tail-end of section 3a of the guide found here.

        Edit: Best version of 'Metal Gear' BTW. If you haven't played it before, you're in for an outright masterpiece.

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

        mitaholoM 1 Reply Last reply Reply Quote 0
        • mitaholoM
          mitaholo @mediamogul
          last edited by

          @mediamogul said in Running xboxdrv from runcommand-onstart not working:

          Something else that comes to mind is that RetroArch will ignore the virtual keyboard xboxdrv creates unless a udev rule is created. You can find more info on that at the tail-end of section 3a of the guide found here.

          SUBSYSTEM=="input", ATTRS{name}=="Microsoft X-Box 360 pad - Keyboard Emulation", GROUP="users", MODE="0666", ENV{ID_INPUT_KEYBOARD}="1"
          

          Thank you so much, this worked!

          There still seems to be a problem with the name of the virtual device. According to the guide it should be Microsoft X-Box 360 pad - Keyboard Emulation but at least in in /proc/bus/input/devices it's just plain Microsoft X-Box 360 pad.

          I: Bus=0003 Vendor=045e Product=028e Version=0110
          N: Name="Microsoft X-Box 360 pad"
          P: Phys=
          S: Sysfs=/devices/virtual/input/input6
          U: Uniq=
          H: Handlers=sysrq kbd event4 
          B: PROP=0
          B: EV=200003
          B: KEY=1690 7b800 7b000400 10000002
          B: FF=1 3f870000 0 0
          

          I bypassed the problem for now by using the same name in the udev rule but that doesn't seem like the smart solution. Is there something I can add to the xboxdrv command to get the name to change aside from forcing it with --device-name? I already have the usual suspects like --mimic-xpad and plenty of --ui-buttonmap.

          Edit: Best version of 'Metal Gear' BTW. If you haven't played it before, you're in for an outright masterpiece.

          I have played it before and was using it for testing because it's one of the very few MSX games I know. It's a good game for it's time but I think MG2 has stood the test of time much better (aside from some pacing issues and "Guide Dang It!" -moments).

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

            @mitaholo said in Running xboxdrv from runcommand-onstart not working:

            I already have the usual suspects like --mimic-xpad

            It might be --mimic-xpadthat's forcing the name. I would try it without and see.

            I think MG2 has stood the test of time much better

            I agree. Hideo Kojima's work was downright cinematic. Even before his later CD-ROM games.

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

            mitaholoM 1 Reply Last reply Reply Quote 0
            • mitaholoM
              mitaholo @mediamogul
              last edited by

              @mediamogul said in Running xboxdrv from runcommand-onstart not working:

              It might be --mimic-xpadthat's forcing the name. I would try it without and see.

              Without that option the controller is finally given the - Keyboard Emulation suffix, but now the full name is Xbox Gamepad (userspace driver) - Keyboard Emulation... I think I'll just use --device-name "DS4ToKeyboardThingy" option and be done with it.

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

                @mitaholo

                I always make a unique name for mine anyway. Glad to see everything's working now.

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

                mitaholoM 1 Reply Last reply Reply Quote 0
                • mitaholoM
                  mitaholo @mediamogul
                  last edited by

                  @mediamogul
                  Everything works perfectly, for now at least. Thank you very much!

                  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.