Direct Bluetooth gamepad support

https://github.com/MiSTer-devel/Main_MiSTer/wiki

Moderators: Mug UK, Zorro 2, spiny, Greenious, Sorgelig, Moderator Team

Locked
Sorgelig
Ultimate Atarian
Ultimate Atarian
Posts: 6348
Joined: Mon Dec 14, 2015 10:51 am
Location: Russia/Taiwan

Direct Bluetooth gamepad support

Post by Sorgelig »

After thinking and judging different options i came to conclusion: it's better to add direct BT dongles support in Linux.
There is a question how to make pairing convenient. I will release first version with just enabled BT support and command line utilities to pair the devices. Probably some reliable way can be found later and implemented.

Sorgelig
Ultimate Atarian
Ultimate Atarian
Posts: 6348
Joined: Mon Dec 14, 2015 10:51 am
Location: Russia/Taiwan

Re: Direct Bluetooth gamepad support

Post by Sorgelig »

Update: BT works fine. Connected two SN30 Pro controllers to one BT receiver (robbed my RPi2). So it's definitely a good way.
The only quirk is manual pairing through console.
May be some script can be used for pairing.

Nuclear3D
Atariator
Atariator
Posts: 20
Joined: Thu Dec 13, 2018 8:20 pm

Re: Direct Bluetooth gamepad support

Post by Nuclear3D »

woah i cant wait for this feature to be fleshed out as i own a bunch of 8bitdo controllers and at 20 dollars a pop for the bt receivers its getting a bit much for both USB space and money.

Sorgelig
Ultimate Atarian
Ultimate Atarian
Posts: 6348
Joined: Mon Dec 14, 2015 10:51 am
Location: Russia/Taiwan

Re: Direct Bluetooth gamepad support

Post by Sorgelig »

PS3 over BT works bad. It seems accelerometer sends the same axes codes as left stick. This is weird. May be driver problem.
So, for PS3 (and probably PS4) still 8bitdo or Mayflash is required.

Sorgelig
Ultimate Atarian
Ultimate Atarian
Posts: 6348
Joined: Mon Dec 14, 2015 10:51 am
Location: Russia/Taiwan

Re: Direct Bluetooth gamepad support

Post by Sorgelig »

Today i've bought 3 more BT dongles in local store. All are different (at least from appearance).
All of them started to work right away. (I wish WiFi dongles would work the same way).

So, direct BT support is less problematic than WiFi.
I've made a pairing script. It works OK in general, so can be used till better pairing procedure will be provided.

brNX
Atari maniac
Atari maniac
Posts: 85
Joined: Wed Oct 24, 2018 10:22 pm
Location: Coimbra/Portugal

Re: Direct Bluetooth gamepad support

Post by brNX »

Sorgelig wrote:Today i've bought 3 more BT dongles in local store. All are different (at least from appearance).
All of them started to work right away. (I wish WiFi dongles would work the same way).

So, direct BT support is less problematic than WiFi.
I've made a pairing script. It works OK in general, so can be used till better pairing procedure will be provided.
Hi

I believe most bluetooth dongles use the CSR ( Cambridge Silicon Radio) or Broadcom chips , so in this case it's good that you don't have a lot of choice :D. I have yet to find one that needed special support on linux.

Nuclear3D
Atariator
Atariator
Posts: 20
Joined: Thu Dec 13, 2018 8:20 pm

Re: Direct Bluetooth gamepad support

Post by Nuclear3D »

This is great news for a lot of different reasons, one of my most wanted additions for mister is now coming and i couldn't be happier.

Sorgelig
Ultimate Atarian
Ultimate Atarian
Posts: 6348
Joined: Mon Dec 14, 2015 10:51 am
Location: Russia/Taiwan

Re: Direct Bluetooth gamepad support

Post by Sorgelig »

After checking on Windows, 3 dongles are CSR8510 and one dongle is BCM207x
So, yeah, not a big choice which is definitely good.

zomgugoff
Atari maniac
Atari maniac
Posts: 85
Joined: Tue Jan 29, 2019 10:12 am

Re: Direct Bluetooth gamepad support

Post by zomgugoff »

By not using the 8bitdo dongles, I'm assuming we're going lose PSC combos. Do you have plans to replicate this ability?

glaucon1984
Atari User
Atari User
Posts: 36
Joined: Fri Aug 04, 2017 12:23 pm

Re: Direct Bluetooth gamepad support

Post by glaucon1984 »

Can this be also used to pair a BT mouse or keyboard (or combo)?
Is it possible to map one of the 3 buttons on the I/O board to initiate the pairing of controllers? It would be great if we can use one of the LED indicators to signal the pairing/searching/connected mode by its blinking speed.

THaase
Captain Atari
Captain Atari
Posts: 187
Joined: Mon Oct 16, 2017 8:39 am
Location: Germany

Re: Direct Bluetooth gamepad support

Post by THaase »

zomgugoff wrote:By not using the 8bitdo dongles, I'm assuming we're going lose PSC combos. Do you have plans to replicate this ability?
We do not loose anything - it's an (great) addition - so feel free still to use the 8bitdo receiver

Sorgelig
Ultimate Atarian
Ultimate Atarian
Posts: 6348
Joined: Mon Dec 14, 2015 10:51 am
Location: Russia/Taiwan

Re: Direct Bluetooth gamepad support

Post by Sorgelig »

A big dilemma: BlueZ 4 or BlueZ 5?
BlueZ 5 from what really useful i've noticed only has SixAxis plugin. But from my testing PS3 controller is completely unreliable - somehow it reports accelerometer as left analog stick which means messages flood.
Big drawback of BlueZ 5 completely bastardized pairing procedure. You have to use bluetoothctl utility which has no way to control it from script. All scripts i've found are based on interprocess communicating by catching bluetoothctl's output and feed the commands simulating keyboard input. It's slow and not so reliable. Couldn't find a simple commands through dbus-send for pairing.

BlueZ 4 doesn't have SixAxis plugin but as far as i know there is 3rd party app helping with pairing of PS3 gamepad. But as i've told above need to find the way to shut down the accelerometer first.
BlueZ4 has a good and simple way to pair through script which at this stage looks as a big advantage over v5.

I don't have other BT gamepads besides those from 8bitdo. I found that if i connect all my 3 8bitdo gamepads then after recconnect at least one of them (every time different) doesn't want to connect and i have to pair it again. No idea if this is 8bitdo specific or BlueZ problem. It's the same for BlueZ 4 and 5.

Nuclear3D
Atariator
Atariator
Posts: 20
Joined: Thu Dec 13, 2018 8:20 pm

Re: Direct Bluetooth gamepad support

Post by Nuclear3D »

I know it sounds kinda selfish on my part but i'd rather have the 8bitdo controllers work over the ps3 or ps4 controllers seeing as you can get 8bitdo controllers with analogs anyway

glaucon1984
Atari User
Atari User
Posts: 36
Joined: Fri Aug 04, 2017 12:23 pm

Re: Direct Bluetooth gamepad support

Post by glaucon1984 »

In my opinion I think it's preferable to give priority to devices that try to follow standards first, and leave proprietary/custom/exotic protocols as a secondary objective.

I would much prefer to ensure a painless support of standard BT devices like 8bitdo gamepads, which in general are cheaper, and in many cases better suited for the kind of systems supported by MiSTer.

zomgugoff
Atari maniac
Atari maniac
Posts: 85
Joined: Tue Jan 29, 2019 10:12 am

Re: Direct Bluetooth gamepad support

Post by zomgugoff »

Sorgelig wrote:I don't have other BT gamepads besides those from 8bitdo. I found that if i connect all my 3 8bitdo gamepads then after recconnect at least one of them (every time different) doesn't want to connect and i have to pair it again. No idea if this is 8bitdo specific or BlueZ problem. It's the same for BlueZ 4 and 5.
That's weird. It sounds like BlueZ isn't storing remote device addresses like it's supposed to. Maybe it's an option that's disabled? Or it's trying to store them somewhere that isn't permanent?

Sorgelig
Ultimate Atarian
Ultimate Atarian
Posts: 6348
Joined: Mon Dec 14, 2015 10:51 am
Location: Russia/Taiwan

Re: Direct Bluetooth gamepad support

Post by Sorgelig »

Nuclear3D wrote:seeing as you can get 8bitdo controllers with analogs anyway
i don't understand what you mean.
Analog sticks on 8bitdo gamepads are supported.

Nuclear3D
Atariator
Atariator
Posts: 20
Joined: Thu Dec 13, 2018 8:20 pm

Re: Direct Bluetooth gamepad support

Post by Nuclear3D »

What i meant was for people who want analogue controllers you can purchase a 8bitdo controller over a ps3 or ps4 controller because you were saying for now that the playstation controllers were acting up with the current bluetooth implementation

Sorgelig
Ultimate Atarian
Ultimate Atarian
Posts: 6348
Joined: Mon Dec 14, 2015 10:51 am
Location: Russia/Taiwan

Re: Direct Bluetooth gamepad support

Post by Sorgelig »

I've already fixed the PS3 gamepad by blocking the accelerometer.
It has no relation to analog sticks.

brNX
Atari maniac
Atari maniac
Posts: 85
Joined: Wed Oct 24, 2018 10:22 pm
Location: Coimbra/Portugal

Re: Direct Bluetooth gamepad support

Post by brNX »

Sorgelig wrote:A big dilemma: BlueZ 4 or BlueZ 5?
BlueZ 5 from what really useful i've noticed only has SixAxis plugin. But from my testing PS3 controller is completely unreliable - somehow it reports accelerometer as left analog stick which means messages flood.
Big drawback of BlueZ 5 completely bastardized pairing procedure. You have to use bluetoothctl utility which has no way to control it from script. All scripts i've found are based on interprocess communicating by catching bluetoothctl's output and feed the commands simulating keyboard input. It's slow and not so reliable. Couldn't find a simple commands through dbus-send for pairing.

BlueZ 4 doesn't have SixAxis plugin but as far as i know there is 3rd party app helping with pairing of PS3 gamepad. But as i've told above need to find the way to shut down the accelerometer first.
BlueZ4 has a good and simple way to pair through script which at this stage looks as a big advantage over v5.

I don't have other BT gamepads besides those from 8bitdo. I found that if i connect all my 3 8bitdo gamepads then after recconnect at least one of them (every time different) doesn't want to connect and i have to pair it again. No idea if this is 8bitdo specific or BlueZ problem. It's the same for BlueZ 4 and 5.
Have you tried this script with Bluez5 ? https://gist.github.com/RamonGilabert/0 ... b4d9fb0055
was curious why it wouldn't work and found this thread over on linuxquestions https://www.linuxquestions.org/question ... 175615328/.

maybe it's what you are refering to.

Sorgelig
Ultimate Atarian
Ultimate Atarian
Posts: 6348
Joined: Mon Dec 14, 2015 10:51 am
Location: Russia/Taiwan

Re: Direct Bluetooth gamepad support

Post by Sorgelig »

brNX wrote:Have you tried this script with Bluez5 ? https://gist.github.com/RamonGilabert/0 ... b4d9fb0055
was curious why it wouldn't work and found this thread over on linuxquestions https://www.linuxquestions.org/question ... 175615328/.
yeah, i've tried it and played long time. I did many modifications to that script and even achieved some usable point. But it's nothing comparing how easy it's in BlueZ 4.
Anyway i've decided to go with BlueZ 4. I've made some modification to make possible to pair and use PS3 gamepad, so there are no real advantages in BlueZ 5 now.

brNX
Atari maniac
Atari maniac
Posts: 85
Joined: Wed Oct 24, 2018 10:22 pm
Location: Coimbra/Portugal

Re: Direct Bluetooth gamepad support

Post by brNX »

yes I agree , there's probably no point in going BlueZ 5 for now.

guvner
Atariator
Atariator
Posts: 25
Joined: Sun Dec 09, 2018 12:32 am

Re: Direct Bluetooth gamepad support

Post by guvner »

how can I remove devices from the trusted devices list?

Sorgelig
Ultimate Atarian
Ultimate Atarian
Posts: 6348
Joined: Mon Dec 14, 2015 10:51 am
Location: Russia/Taiwan

Re: Direct Bluetooth gamepad support

Post by Sorgelig »

guvner wrote:how can I remove devices from the trusted devices list?
never thought about this. Why you need it?
You can reset bluetooth settings by removing /linux/bluetooth file and reboot the MiSTer

guvner
Atariator
Atariator
Posts: 25
Joined: Sun Dec 09, 2018 12:32 am

Re: Direct Bluetooth gamepad support

Post by guvner »

I was testing, if your instructions for the ps3 controller would also work on a ps4 pad. It didn't work, but my MiSTer connected to something else instead. I don't usually keep bluetooth active in my devices when not in use, but I do see ones from my neighbours fairly regularly, so it might have been one of those...

Sorgelig
Ultimate Atarian
Ultimate Atarian
Posts: 6348
Joined: Mon Dec 14, 2015 10:51 am
Location: Russia/Taiwan

Re: Direct Bluetooth gamepad support

Post by Sorgelig »

PS4 is generic BT gamepad. So pairing must be like a standard gamepad.
Pairing procedure connects only to devices in pairing mode. So it's not related to those BT hosts in advertise mode.

Locked

Return to “MiSTer”