0

Feather Bluefruit 32u4 as gamepad in Ubuntu
Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.

Feather Bluefruit 32u4 as gamepad in Ubuntu

by chrislgrigg on Wed Jan 30, 2019 5:22 pm

I'm trying to create a simple three-button gamepad to use the HTML5 Gamepad API on an Ubuntu 17.10 machine. Using the documentation at https://learn.adafruit.com/adafruit-fea ... e?view=all to enable the gamepad and send commands, I've managed to get it working completely on my Mac but it refuses to behave in Linux. On Linux, keyboard messages sent via `AT+BLEKEYBOARDCODE` are interpreted correctly but gamepad messages sent via `AT+BLEHIDGAMEPAD` are not. I know the following:

The device pairs correctly with my Linux machine.
The output of `dmesg` shows no errors. In all cases, it shows the following whenever I connect:

Code: Select all | TOGGLE FULL SIZE
input: Adafruit Bluefruit LE as /devices/virtual/misc/uhid/0005:0000:0000.0005/input/input15
hid-generic 0005:0000:0000.0005: input,hidraw1: BLUETOOTH HID v0.00 Keyboard [Adafruit Bluefruit LE] on 34:41:5D:46:F4:DC


The hidraw1 device is always created.
If I send `AT+BLEHIDGAMEPAD` messages, pressing my "up" key will make the mouse cursor jump to the top of the page while I'm holding the key. No other buttons seem to do anything.
As far as Ubuntu is concerned, this is a keyboard in all cases.
I've tested under Ubuntu 18.04 and see the same results.

I'm not sure what else to troubleshoot or what information is or isn't helpful. I'd appreciate any advice to make this work.

Alternatively, if there's some stupid simple way to just send arbitrary data from the Bluefruit to a Linux device via Bluetooth, I can probably just write a small C++ or Go application to read the output and get it to the client through a websocket, so I'd love advice there if that's the path of least resistance. I'm only going the HID route because HTML5's Gamepad API will do all the hard work but I'm open to alternatives if it's not going to work.

chrislgrigg
 
Posts: 3
Joined: Wed Jan 30, 2019 3:44 pm

Re: Feather Bluefruit 32u4 as gamepad in Ubuntu

by chrislgrigg on Fri Feb 01, 2019 6:22 pm

I ended up giving up on the gamepad route and instead went UART with Python using the Adafruit_Python_BluefruitLE and helped particularly the low_level example, https://github.com/adafruit/Adafruit_Py ... w_level.py.

chrislgrigg
 
Posts: 3
Joined: Wed Jan 30, 2019 3:44 pm

Please be positive and constructive with your questions and comments.