Bluetooth game controller on Ubuntu 20.04

Last Updated on 9 February 2024 by Suffocation

Einbinden eines beliebigen Bluetooth Gamecontrollers (Joystick, Gamepad, ….) unter Ubuntu 22.04. Wer keinen Controller zur Hand hat, kann unter folgenden Link nachsehen wie man einen ESP32 zum Controller macht. Ich beschreibe hier den manuellen Weg, der eher dafür vorgesehen ist wenn es mal in Gnome nicht klappt. Mit etwas Glück und unterstützter Hardware braucht man diesen aber nicht und kann einfach im Gnome nach dem Gerät suchen.

ESP32 Bluetooth Gamepad

Facts

Benötigte Hardware

Bluetooth Game Controller

Benötigte Software

  • Ubuntu (22.04)
  • BlueZ
  • jstest-gtk

Areas of application

  • Remote control
  • RC control
  • Joystick für Spiele

Configuration

General Bluetooth Installation

Überprüfen ob BlueTooth installiert ist:

sudo apt install bluez

Search for Bluetooth adapter

Check with dmesg to see if the Bluetooth dongle is active:

sudo dmesg | grep -i bluetooth

The output should look like this

Bluetooth Gerät einbinden

Start Bluetooth Tool

bluetoothctl
bluetoothctl – BLE adapter found

Now activate the pairing, first make the Bluetooth adapter visible.

discoverable on
bluetoothctl – Ausgabe nach discoverable on

Nun den Scannen (Suche nach neuen Geräten) einschalten

Scan on
bluetoothctl – Output after scan start

Finally, connect the game controller (please adjust the address to your controller)

B4:E6:2D:96:A7:17
bluetoothctl – Pairing Successful

Exit to leave the program.

Gerät Testen

Jetzt wird die Funktion getestet. Hierfür gibt es ein einfaches tool jstest-gtk, Installation wie folgt:

sudo apt install jstest-gtk

Starting the tool

jstest-gtk
jstest-gtk – Gamepad auswählen und Eigenschaften anzeigen lassen

Tasten, Joysticks … auf dem Controller betätigen dann sollte sich die Balken und Kästchen im Tool füllen.

Problems

Mapping

Evtl. Stimmen die Knöpfe und Achsen nicht überein, dann können dies mit dem Knopf Mapping angepasst werden.

Conclusion

If configuration doesn't work with Gnome, there are a few nice tools and aids. As easy as under Windows, ist es dann nicht mehr ab auch unter Windows gibt es immer mal wieder Probleme mit Bluetooth Geräten und dort ist die Analyse dann erheblich schwieriger. Es gibt unter Ubuntu bestimmt noch einfachere Möglichkeiten BlueTooth Geräte einzubinden die gezeigte, ermöglicht es jedoch nach Fehlern zu suchen, wenn es mal nicht gleich beim ersten mal klappt.

Verwandte Beiträge

Sources

NimBLE-Arduino

NimBLE-Arduino New User Guide

NimBLE-Arduino API

https://github.com/lemmingDev/ESP32-BLE-Gamepad

https://en.wikipedia.org/wiki/List_of_Bluetooth_profiles

https://en.wikipedia.org/wiki/USB_human_interface_device_class

https://www.usb.org/sites/default/files/documents/hid1_11.pdf

https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=4a1a4d8b87389e35c3af04c0d0a95f6a0391b964

DateChangeAuthor
02.01.2024Post createdSuffocation

Leave a Reply

Your email address will not be published. Required fields are marked *