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

    joy2key_sdl.py errors - not working in RetroPie Setup, working in ES

    Scheduled Pinned Locked Moved Help and Support
    joy2keyjoy2keysdl.pyjoystickcontrollersdl
    15 Posts 2 Posters 883 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
      jernserval
      last edited by jernserval

      Getting the kinks out of my joystick configuration here.

      Using an 8BitDo Pro 2.

      • First attempt was through emulationstation, but the ES autoconfiguration didn't work out so well with the triggers, etc. and caused problems.

      • Then went through and did the jstest / controller FAQ with RetroPie and added it to retroarch.cfg, but still had some wonky results.

      • Then attempted xboxdrv- didn't give me results I wanted.

      • Then realized I could use SDL with RetroArch, and attempted that with some better results.

      • Then disabled xboxdrv.

      So, I have the retroarch-joypads config, also attempted mapping in retroarch.cfg and I also have the gamecontrollerdb.txt. Not sure if I am using SDL correctly though. Wondering exactly how I can use all of these properly, in unison, to accomplish my needs.

      Hoping to get a working joystick setup with retroarch cores, other emulators, ports, emulation station, and retro pie, which has proven pretty difficult.

      Recently updated all packages.

      Trying to solve my own issue, came upon some similar posts suggesting the following command, and I'm getting an error message thrown. Wondering if this has something to do with it.

      Getting the following output:

      /opt/retropie/admin/joy2key/joy2key_sdl.py kcub1 kcuf1 kcuu1 kcud1 0x0a 0x20 0x1b 0x00 kpp knp -d
      pi@RPI4B:~/RetroPie-Setup/scriptmodules/supplementary/runcommand $ Traceback (most recent call last):
      File "/opt/retropie/admin/joy2key/joy2key_sdl.py", line 557, in <module>
      sys.exit(main())
      File "/opt/retropie/admin/joy2key/joy2key_sdl.py", line 515, in main
      menu_swap = ra_btn_swap_config()
      File "/opt/retropie/admin/joy2key/joy2key_sdl.py", line 438, in ra_btn_swap_config
      config.read_string('[device]\n' + cfg_file.read())
      File "/usr/lib/python3.7/configparser.py", line 722, in read_string
      self.read_file(sfile, source)
      File "/usr/lib/python3.7/configparser.py", line 717, in read_file
      self._read(f, source)
      File "/usr/lib/python3.7/configparser.py", line 1110, in _read
      raise e
      configparser.ParsingError: Source contains parsing errors: '<string>'
      [line 549]: 's\n'

      my python version is (3.7.3-1)

      Also, in ~/RetroPie-Setup/scriptmodules/supplementary/runcommand/runcommand.sh I noticed there was a line joy2key_version = "1" or something to that effect. Not sure if relevant.

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

        The joy2jey_sdl error triggered by the contents of .cfg joypad configuration file - it either has Windows/DOS line endings or it's an incorrect .ini file.
        How did you edit the .cfg file - which editor you used ?

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

          @mitu

          Which cfg file?

          There are so many….

          Can you provide paths to the files you’re describing (cfg and ini)? If so I can provide output or further details.

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

            @jernserval The joypad configuration file, which is a .cfg file in the retroarch-joypads folder. It should be named similarly to your controller.

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

              @mitu

              My config seems pretty reasonable? Edited in nano... Where is the ini?

              input_device = "8BitDo Pro 2"
              input_driver = "udev"

              #Hotkeys and Special
              input_enable_hotkey_btn = "12"
              input_select_btn = "10"
              input_start_btn = "11"
              input_exit_emulator_btn = "11"
              input_menu_toggle_btn = "3"
              input_x_btn_label = "X"
              input_reset_btn = "1"

              #L+R Trigger + Stick Buttons
              input_l_btn = "6"
              input_load_state_btn = "6"
              input_l2_btn = "8"
              input_r_btn = "7"
              input_save_state_btn = "7"
              input_r2_btn = “9”

              #R Stick
              input_r3_btn = “14”
              input_r_y_plus_axis = "+3"
              input_r_y_minus_axis = "-3"
              input_r_x_plus_axis = "+2"
              input_r_x_minus_axis = "-2"

              #L Stick
              input_l3_btn = “13”
              input_l_x_minus_axis_label = "LS Left"
              input_l_x_minus_axis = "-0"
              input_l_y_minus_axis_label = "LS Up”
              input_l_y_minus_axis = "-1"
              input_l_y_plus_axis_label = "LS Down"
              input_l_y_plus_axis = "+1"
              input_l_x_plus_axis_label = "LS Right"
              input_l_x_plus_axis = "+0"

              #DPad
              input_up_btn = "h0up"
              input_up_btn_label = "Dpad Up"
              input_down_btn = "h0down"
              input_down_btn_label = "Dpad Down"
              input_left_btn = "h0left"
              input_left_btn_label = "Dpad Left"
              input_state_slot_decrease_btn = "h0left"
              input_right_btn = "h0right"
              input_right_btn_label = "Dpad Right"
              input_state_slot_increase_btn = "h0right"

              #ABXY
              input_y_btn = "4"
              input_x_btn = "3"
              input_b_btn = "1"
              input_a_btn = "0"

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

                Also, would i get any benefit from using sdl vs udev as input driver?

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

                  The .cfg file for the controller seems ok, so that's not the cause for the joy2key errors. The other possibility is the retroarch.cfg file, from /opt/retropie/configs/all - can you upload the contents on pastebin.com ?

                  Also, would i get any benefit from using sdl vs udev as input driver?

                  No.

                  J 2 Replies Last reply Reply Quote 0
                  • J
                    jernserval @mitu
                    last edited by jernserval

                    @mitu

                    Can you please advise on the name of and the location of the ini file you speak of that is bad, and a suggestion for remedy?

                    Retroarch cfg:
                    /opt/retropie/configs/all/retroarch.cfg

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

                      @mitu

                      Also my joy2key in retropie setup says:

                      alt text

                      alt text

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

                        @jernserval said in joy2key_sdl.py errors - not working in RetroPie Setup, working in ES:

                        Can you please advise on the name of and the location of the ini file you speak of that is bad, and a suggestion for remedy?

                        It's the cfg file you posted (retroarch.cfg). The format is similar to an .ini file, that's why I mentioned an ini file.

                        Looking at the retroarch.cfg you posted, there are 2 errors

                        1. You've used 'smart quotes' instead of ASCII quotes for the log_verbosity line:

                          
                          #Verbose Logging
                          log_verbosity = “true”
                          

                          You should remove this line, using the runcommand launch menu and choosing to run with debugging info should be enough to produce the logging information for RetroArch.

                        2. You have a stray s around line 551, which is not valid in an .ini formatted file and this is what's triggering the error

                          # Swap buttons for OK/Cancel
                          menu_swap_ok_cancel_buttons = "false"
                          s
                          # Axis for RetroArch D-Pad.
                          

                        Remove the line and joy2key will no longer show an error.

                        Also my joy2key in retropie setup says: [...]

                        That's normal, it's not a problem.

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

                          @mitu

                          Much thanks!

                          Is there a way to send this file through a parser of some kind to see the errors in the future rather than ask you?

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

                            @jernserval said in joy2key_sdl.py errors - not working in RetroPie Setup, working in ES:

                            Is there a way to send this file through a parser of some kind to see the errors in the future rather than ask you?

                            The parser is already called by joy2key , if you get an error just undo your recent modifications. But there's little reason to edit retroarch.cfg directly, if you're just trying to re-map your inputs you can do it (safely) from within RetroArch's menu with Core input remapping.

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

                              @mitu

                              Much thanks for your time and patience.

                              Making progress, yet still having some weirdness.

                              The major issue I have is that RetroArch input mapping works great, but it doesn't work well with Dolphin or OpenBor or Ports or ScummVm which is the bulk of my gaming. So, that's why I have a hodgepodge of RetroArch, gamecontrollerdb.txt and other stuff going on here.

                              So, I'm trying to figure out a solution that includes accommodations for these other emulators / ports.

                              I've managed to get joy2key_sdl going. I have 2 8Bit Do Pro2 controllers. Interestingly, when they are by Bluetooth they are called "8BitDo Pro 2" and when plugged in by USB they're called "8BitDo 8BitDo Pro 2".

                              When plugged in I get "configured device" despite having a separate "8BitDo 8BitDo Pro 2" config file in /retroarchjoypayds

                              8BitDo Pro 2.cfg /// 8BitDo 8BitDo Pro 2.cfg are identical to the one I posted in thread above, except input_device = "8BitDo Pro 2" and input_device = "8BitDo 8BitDo Pro 2", respectively.

                              and I have this config I sourced from 8BitDo which might be a better bet?

                              How can I get the USB and Bluetooth connected controller to behave similarly?

                              Also, the mapping is rather strange, despite my mapping in the 8Bit Do Pro2 config, it is coming out wonky and despite it working ok in Retroarch and some other configs. Why the pageup and pagedown stuff?

                              (This shows the plugging in of a Bluetooth controller into USB)

                              2023-07-19 04:00:51,588 DEBUG  Using SDL Version 2.0.10, PySDL2 version 0.9.3.
                              2023-07-19 04:00:51,589 DEBUG  Joystick #0 8BitDo Pro 2 added
                              2023-07-19 04:00:51,589 DEBUG  Added configuration for known device 8BitDo Pro 2, hats: {0: [(1, 'up'), (4, 'down'), (8, 'left'), (2, 'right')]}, buttons: {6: 'pageup', 7: 'pagedown', 4: 'y', 3: 'x', 1: 'b', 0: 'a'}, axis: {3: [(1, 'down'), (-1, 'up')], 2: [(1, 'right'), (-1, 'left')], 0: [(-1, 'left'), (1, 'right')], 1: [(-1, 'up'), (1, 'down')]}
                              2023-07-19 04:01:14,207 DEBUG  Joystick #1 8BitDo Pro 2 added
                              2023-07-19 04:01:14,207 DEBUG  Added configuration for known device 8BitDo Pro 2, hats: {0: [(1, 'up'), (4, 'down'), (8, 'left'), (2, 'right')]}, buttons: {6: 'pageup', 7: 'pagedown', 4: 'y', 3: 'x', 1: 'b', 0: 'a'}, axis: {3: [(1, 'down'), (-1, 'up')], 2: [(1, 'right'), (-1, 'left')], 0: [(-1, 'left'), (1, 'right')], 1: [(-1, 'up'), (1, 'down')]}
                              2023-07-19 04:01:35,197 DEBUG  Removed joystick #0
                              2023-07-19 04:01:35,937 DEBUG  Joystick #2 8BitDo 8BitDo Pro 2 added
                              2023-07-19 04:01:35,938 DEBUG  Un-configured device "8BitDo 8BitDo Pro 2", mapped using generic mapping
                              Traceback (most recent call last):
                                File "/opt/retropie/admin/joy2key/joy2key_sdl.py", line 557, in <module>
                                  sys.exit(main())
                                File "/opt/retropie/admin/joy2key/joy2key_sdl.py", line 549, in main
                                  event_loop(configs, joy_map, tty_fd)
                                File "/opt/retropie/admin/joy2key/joy2key_sdl.py", line 402, in event_loop
                                  emitted_events = filter_active_events(event_queue)
                                File "/opt/retropie/admin/joy2key/joy2key_sdl.py", line 270, in filter_active_events
                                  return list(set(filtered_events))
                              TypeError: unhashable type: 'list'
                              
                              mituM 1 Reply Last reply Reply Quote 0
                              • J
                                jernserval
                                last edited by

                                @mitu

                                dmesg -w output

                                ut6
                                [ 3995.630449] hid-generic 0005:2DC8:6006.0005: input,hidraw0: BLUETOOTH HID v1.00 Gamepad [8BitDo Pro 2] on d8:3a:dd:0d:97:dd
                                [ 4167.033289] hid-generic 0005:2DC8:6006.0006: unknown main item tag 0x0
                                [ 4167.033541] input: 8BitDo Pro 2 as /devices/platform/soc/fe201000.serial/tty/ttyAMA0/hci0/hci0:12/0005:2DC8:6006.0006/input/input7
                                [ 4167.033765] hid-generic 0005:2DC8:6006.0006: input,hidraw4: BLUETOOTH HID v1.00 Gamepad [8BitDo Pro 2] on d8:3a:dd:0d:97:dd
                                [ 4188.171851] usb 1-1.4: new full-speed USB device number 7 using xhci_hcd
                                [ 4188.310773] usb 1-1.4: New USB device found, idVendor=2dc8, idProduct=6006, bcdDevice= 2.00
                                [ 4188.310795] usb 1-1.4: New USB device strings: Mfr=1, Product=2, SerialNumber=3
                                [ 4188.310814] usb 1-1.4: Product: 8BitDo Pro 2
                                [ 4188.310831] usb 1-1.4: Manufacturer: 8BitDo
                                [ 4188.310849] usb 1-1.4: SerialNumber: 000000000003
                                [ 4188.327219] input: 8BitDo 8BitDo Pro 2 as /devices/platform/scb/fd500000.pcie/pci0000:00/0000:00:00.0/0000:01:00.0/usb1/1-1/1-1.4/1-1.4:1.0/0003:2DC8:6006.0007/input/input8
                                [ 4188.327635] hid-generic 0003:2DC8:6006.0007: input,hidraw5: USB HID v1.11 Gamepad [8BitDo 8BitDo Pro 2] on usb-0000:01:00.0-1.4/input0
                                
                                1 Reply Last reply Reply Quote 0
                                • mituM
                                  mitu Global Moderator @jernserval
                                  last edited by mitu

                                  The major issue I have is that RetroArch input mapping works great, but it doesn't work well with Dolphin or OpenBor or Ports or ScummVm which is the bulk of my gaming. So, that's why I have a hodgepodge of RetroArch, gamecontrollerdb.txt and other stuff going on here.

                                  Not sure why you think RetroArch's configuration is relevant for the standalone emulators - they're entirely separate. Or maybe I'm mistaken ?

                                  I've managed to get joy2key_sdl going. I have 2 8Bit Do Pro2 controllers. Interestingly, when they are by Bluetooth they are called "8BitDo Pro 2" and when plugged in by USB they're called "8BitDo 8BitDo Pro 2".

                                  Yes, that's not un-common for gamepads, having different names and/or input mappings depending on the connection type. 8BitDo are even more eggregious in their behavior since they have also different connection modes (Xbox/PC vs. Switch vs. Android vs. etc.)

                                  When plugged in I get "configured device" despite having a separate "8BitDo 8BitDo Pro 2" config file in /retroarchjoypayds
                                  [...]

                                  and I have this config I sourced from 8BitDo which might be a better bet?

                                  How can I get the USB and Bluetooth connected controller to behave similarly?

                                  Just configure the controller separately for USB and Bluetooth. The input codes may not be identical between the connection types and you can't rely on a firmware update to now change them.

                                  Also, the mapping is rather strange, despite my mapping in the 8Bit Do Pro2 config, it is coming out wonky and despite it working ok in Retroarch and some other configs. Why the pageup and pagedown stuff?

                                  Not sure what you mean here.

                                  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.