Controllers - Fredrum/chiaki GitHub Wiki

I have been using DS4 controllers and an XBox controller so they should both work just fine. Although you might have some mapping issues if running Chiaki in a Retropie environment. See below for more details. On the XBox controller the [XBox Logo] button maps to the (PS) button, which is handy.

The Bluetooth functionality works well on the DS4. Just use the standard Raspberry default bluetooth manager that is docked in the top right on the Task Bar. This adds a little extra latency over using the controller over USB but not a huge amount.

Be aware that sometimes you'll get a error message from 'bluez' saying that bluetooth connection failed. Often that is not the case at all and it's actually fine. If you get that message just check the BT dock for your controllers status.

I tried a separate bluetooth driver for the ds4, the 'ds4drv', but that was much slower than the default built in functionality so I would not recommend using that.

I have not tested Bluetooth for the xbox controller, but I have tested it wirelessly using the dongle I had. It's one of those that look like a slim cigarette lighter. I had to install this driver to get it to work though, https://github.com/medusalix/xow Maybe it's possible to use Bluetooth, I just didn't have the patience.

One person messaged on youtube to say,
"For Xbox controller Bluetooth install this
https://github.com/atar-axis/xpadneo
Works like a charm"

Steps to connect DS4 over Bluetooth

  • Turn On Bluetooth through the symbol in the Task Bar at top right of your screen.
  • 'Add Device'
  • Long Press the PS+Share buttons and a rapid double flash blinking of the main LED should start. 'Wireless Controller' should soon(ish) show up in the list.
  • Select it and press the 'Pair' button.
  • It should say pairing successful.
  • In the BT menu (top right) go for the 'Wireless Controller -> Connect' menu item.
  • Ignore any error message and go back and check the menu. It should say 'Connected' with a green dot. If not just try the Wireless Controller -> Connect, again!

If you keep Bluetooth On on your Pi I believe that the controller should auto connect next time. You might just have to start up the controller with the (PS) button.

Controller problems with Retropie

I found out that Retropie introduce a custom 'xpad' kernel driver that does things differently from the standard 'xpad' driver. I and another user had weird mapping behaviours with XBox One and Xbox 360 controllers that don't happen with official Raspberry OS images.
The fix is to un-install the custom Retropie driver and let the system fall back on its standard version of xpad. To do this go to
Retropie Setup -> Manage Packages -> Manage Driver Packages
and remove. Reboot. Hopefully then your gamepad should behave as usual again.

NOTE: If you do this you might break your current Retropie mappings so if you notice new mapping issues with other emulators then you'll need to re-do the standard Retropie controller setup step!

If this does not fix you mappings see other possible workaround below.

Creating your own Gamepad Remapping File

This functionality was added as problems with XBox controllers started cropping up when using Retropie images. If the controller you are using should generally work but you're finding that some inputs don't work or behave strangely it might be that the mappings are broken.

First, I have precompiled the needed program on my RPi4B 32Bit Buster so if you are close enough can probably run that. To get it just do,

git clone https://github.com/Fredrum/controlermap_builds.git

then find and run ./controllermap
If that works go ahead and jump to (3.) below.

If that doesn't run for you you'll need to build the app yourself. Follow these instructions.

1. Download and build 'libsdl' from scratch.

git clone https://github.com/libsdl-org/SDL.git
cd SDL
./configure
make
(Don't execute 'install' unless you're sure that's what you want. It's not needed here.)

2. Build SDL's mapping generator program

cd ../
cd test
./configure
make

3. Generate the mappings

./controllermap
Follow the instructions. Press your keyboard spacebar for non-applicable suggestions.
At the end you should get a long string which is the remap info. Paste this into a plain text file and name this whatever you want.

4. Make Chiaki Load the remappings

Just open the Chiaki prefs window and in the upper left area is a new text field for remap files.
Enter the Full Path to your new file and close down. When you restart a session if everything is correct your gamepad should behave as expected.

NOTES:

  • You can have multiple entries / lines for different controllers in the same file.