Skip to content

Controllers

Blueroom VR edited this page Aug 20, 2021 · 38 revisions

EDIT: Actually there seem to be problems with XBox controllers that I'm trying to figure out. Following this should/might make it work

I have been using DS4 controllers and an XBox controller so they should both work just fine. On the XBox controller the [XBox Logo] button maps to the (PS) button, which is handy.

Please make sure that you're not so close to your PS4 console that your controller's bluetooth signals reaches it. As you'll then be sending the PS4 conflicting signals and you'll get some bad input behaviour.

The touchpad on the DS4 seems to be working somewhat, at least in ps4 virtual keyboard but maybe not fully.
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.
  • Hold down (PS)+Share and there might be some blinking and a message saying pairing successful.
  • In the BT menu (top right) go for the 'Wireless Controller -> Connect' menu item.
  • Press and hold the (PS) button for a bit.
  • Ignore the 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.

Creating your own Gamepad Remapping File

This functionality was added as problems with XBox controllers started cropping up. 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.

I want to find a better solution to this but for now you'll need to generate your own gamepad remapping file. :(

First, I have precompile 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 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
mkdir build; cd build
./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.
  • I was hoping to use the community sourced controller database https://github.com/gabomdq/SDL_GameControllerDB but something seems to have changed and it wasn't working.