Bluetooth pairing issues with NES/SNES Online controllers

Discussion of keyboards, gamepads, joysticks and other input related peripherals.
User avatar
ioev
Posts: 31
Joined: Mon May 25, 2020 1:56 pm
Has thanked: 3 times
Been thanked: 1 time

Bluetooth pairing issues with NES/SNES Online controllers

Unread post by ioev »

These controllers work great once paired, but I find they unpair very often and somewhat randomly. When I turn on MiSTer and press a button to see if they're still paired, it's almost as if I have a 50/50 chance of it working. When I re-pair them, it's as if they're pairing for the first time all over again. My original thought was that I was using an unsupported dongle, but now I'm using one from Mister Addons via the powered USB Hub expansion and still having the same issues.
User avatar
Sigismond0
Posts: 339
Joined: Mon May 25, 2020 2:21 am
Has thanked: 1 time
Been thanked: 66 times

Re: Bluetooth pairing issues with NES/SNES Online controllers

Unread post by Sigismond0 »

Same experience here, and have heard of others seeing similar. My notes:
  • Initial BT pairing works seamlessly. Controllers work great for the duration of that connection.
  • After powering down, device wakes up on any button press and enters a re-syncing state. This can sometimes cause the controller to re-connect with MiSTer the way you would expect. But typically, it just times out. I'd say it works less than 1/10 of the time.
  • Re-pairing through the BT pairing menu always works immediately.
  • When connecting to a Windows PC using the same BT dongle as the MiSTer, the controller always wakes up and re-connects nearly immediately on any button press. No need to re-pair.
Based on that last bullet point, there must just be some weird interaction between these devices and the MiSTer BT stack. The controllers have the capability of working as desired, but just not here.

All that said, it's at least easy to re-pair the devices by holding down the OSD button. Only takes a few seconds and works every time. Passable as a workaround as long as you have an IO board. Back when you had to use the BT script, it was awful.
User avatar
ioev
Posts: 31
Joined: Mon May 25, 2020 1:56 pm
Has thanked: 3 times
Been thanked: 1 time

Re: Bluetooth pairing issues with NES/SNES Online controllers

Unread post by ioev »

I recently discovered that without the IO board, I can hold down the button assigned to the menu on the DE-10 for 3 seconds to activate the bluetooth menu, which is awesome. Prior to that my solution was to use the BT script with my 2.4ghz controller, but I found that often it would get stuck in the script after pairing and I'd need to pull out the keyboard to exit it.

It would also be great if it MiSTer could do whatever it is that assigns the controller a player, so that the player indicator lights wouldn't just scroll back and forth as if it were trying to connect, but obviously not a big deal.
User avatar
Sigismond0
Posts: 339
Joined: Mon May 25, 2020 2:21 am
Has thanked: 1 time
Been thanked: 66 times

Re: Bluetooth pairing issues with NES/SNES Online controllers

Unread post by Sigismond0 »

Yeah, even the 8bitdo adapters don't handle the player indicator lights correctly yet. Windows also leaves them blinking. Presumably there's some non-standard signal that MiSTer would have to send to do that. Supporting a non-standard BT command for a single controller probably isn't a worthwhile use of developer time.
User avatar
keith.f.kelly
Posts: 88
Joined: Sun May 24, 2020 11:10 pm
Location: Sammamish, WA, USA
Has thanked: 3 times
Been thanked: 8 times
Contact:

Re: Bluetooth pairing issues with NES/SNES Online controllers

Unread post by keith.f.kelly »

Please see the latest announced MiSTer update. It includes a mostly-rewritten set of Bluetooth pairing scripts, and one Bluetooth configuration change, that I submitted to Sorgelig to make Bluetooth pairing and reconnection work much better. Give it a try and report back with your results.
User avatar
Sigismond0
Posts: 339
Joined: Mon May 25, 2020 2:21 am
Has thanked: 1 time
Been thanked: 66 times

Re: Bluetooth pairing issues with NES/SNES Online controllers

Unread post by Sigismond0 »

I actually did that immediately after seeing the change log this morning. Alas, no change in behavior with my initial testing.
User avatar
ioev
Posts: 31
Joined: Mon May 25, 2020 1:56 pm
Has thanked: 3 times
Been thanked: 1 time

Re: Bluetooth pairing issues with NES/SNES Online controllers

Unread post by ioev »

Just for fun, I've started digging in to what actually happens when pairing and what the files actually look like in /var/lib/bluetooth. Seems you get a folder with IDs, one for each of your bluetooth devices (dongles), and in that folder is some stored configuration about the devices that are paired. I looked at this folder before a failed pairing, and then after a manual pair, and found a few values had changed:

This is the before of linkkeys, the device I'm syncing is EC:C4

Code: Select all

cat linkkeys
EC:C4:0D:9A:36:1D 65E58BD697D64DBF0C29A0BED6339FE8 4 0
D4:F0:57:D8:EA:E0 E54326C0A2A19AF3C82CE163A62D8AB0 4 0
And this is after:

Code: Select all

cat linkkeys
D4:F0:57:D8:EA:E0 E54326C0A2A19AF3C82CE163A62D8AB0 4 0
EC:C4:0D:9A:36:1D 293953E9D510DB9F162F179140C74728 4 0
So the link key had changed, which makes sense because I had to resync. But why doesn't the original linkkey work? How is a link key generated? I'm starting to think that maybe it's time based, and perhaps can expire. Here is my lastused file after syncing:

Code: Select all

cat lastused
D4:F0:57:D8:EA:E0 1970-01-01 00:00:16 GMT
EC:C4:0D:9A:36:1D 2020-06-21 16:30:11 GMT
The D4:F0 device is a SNES Online controller that I had also synced somewhat recently, but the last used date is based on NTP having not synced (this one wouldn't sync this time either) I'm going to experiment a bit to make sure to wait until the time is set properly over NTP before trying to sync a controller and see if that helps at all.

Update: Nevermind, I was able to sync a controller, turn it off by pressing the sync button (though maybe this does something else?) and then tried to sync again without restarting and it wouldn't.
User avatar
Sigismond0
Posts: 339
Joined: Mon May 25, 2020 2:21 am
Has thanked: 1 time
Been thanked: 66 times

Re: Bluetooth pairing issues with NES/SNES Online controllers

Unread post by Sigismond0 »

ioev wrote: Sun Jun 21, 2020 4:41 pmUpdate: Nevermind, I was able to sync a controller, turn it off by pressing the sync button (though maybe this does something else?) and then tried to sync again without restarting and it wouldn't.
Yeah, it's really weird. I've been able to reproduce each of these scenarios:
  • Power on MiSTer. Pair controller. Power off controller with "sync" button. Re-connect controller by just tapping D-pad.
  • Power on MiSTer. Pair controller. Power off controller with "sync" button. Unable to re-connect controller by just tapping D-pad.
  • Power on MiSTer. Pair controller. Power off controller with "sync" button. Power cycle MiSTer. Re-connect controller by just tapping D-pad.
  • Power on MiSTer. Pair controller. Power off controller with "sync" button. Power cycle MiSTer. Unable to re-connect controller by just tapping D-pad.
Sometimes it re-connects without issue. Usually it doesn't. I honestly can't find any rhyme or reason.
User avatar
ioev
Posts: 31
Joined: Mon May 25, 2020 1:56 pm
Has thanked: 3 times
Been thanked: 1 time

Re: Bluetooth pairing issues with NES/SNES Online controllers

Unread post by ioev »

Actually, I've now found that I can have it fail at syncing a few times, I'll turn off the mister, come back to it later, try again to sync and it syncs on the first try no problem, without ever having to repair. Very strange.
User avatar
Sigismond0
Posts: 339
Joined: Mon May 25, 2020 2:21 am
Has thanked: 1 time
Been thanked: 66 times

Re: Bluetooth pairing issues with NES/SNES Online controllers

Unread post by Sigismond0 »

Yes, I also get similar symptoms. Sometimes it'll fail to reconnect multiple times in a row, and then all of a sudden work. It really does just feel like a random 1/20 chance of re-connecting. It's common enough that my gut reaction is to just retry if it doesn't re-connect, but uncommon enough that I know intellectually that it's just faster on average to fully re-pair.
Maniac
Posts: 1
Joined: Wed May 27, 2020 6:32 pm

Re: Bluetooth pairing issues with NES/SNES Online controllers

Unread post by Maniac »

Regarding the player led on the switch controllers there is a driver and a patch to support also the snes controller for the kernel to support them.
I migrated those patches to the MiSTer kernel some weeks ago in the hope they will help with the reconnect issues, but they didn't.
I will create a pull request in the next days for the MiSTer kernel.
User avatar
ioev
Posts: 31
Joined: Mon May 25, 2020 1:56 pm
Has thanked: 3 times
Been thanked: 1 time

Re: Bluetooth pairing issues with NES/SNES Online controllers

Unread post by ioev »

I actually got a controller to sync by pressing a button (down), waiting a second or so to see if it connects, pressing the sync button to stop it if it doesn't connect, and just repeating this around 3 times. Didn't have to re-pair.
User avatar
Sigismond0
Posts: 339
Joined: Mon May 25, 2020 2:21 am
Has thanked: 1 time
Been thanked: 66 times

Re: Bluetooth pairing issues with NES/SNES Online controllers

Unread post by Sigismond0 »

ioev wrote: Wed Jun 24, 2020 3:19 pm I actually got a controller to sync by pressing a button (down), waiting a second or so to see if it connects, pressing the sync button to stop it if it doesn't connect, and just repeating this around 3 times. Didn't have to re-pair.
Yup. Sometimes that works. Sometimes you can do it 10+ times in a row, and it still fails.
Post Reply