Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for multiple adapters/more than 8 controllers. #13

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

adangert
Copy link

@adangert adangert commented Feb 1, 2017

One main problem with not being able to use more than 8 controllers
at once was the fact that each adapter can only handle about 6-7
controllers.

The move.pair() function seemed to always just pair controllers
to the default adapter, thus filling up a single hci device in /var/lib/bluetooth

This change loops through all of the connected adapters as seen by
hciconfig, and pairs the move controller with the adapter with the
smallest connected controller count using the move.pair_custom() function.
Thus allowing for an even spread among the different bluetooth adapters.

also removed the dev in scan_enable, since hciconfig dev, doesn't seem
to list out all of the connected adapters, while hciconfig by itself
does

When testing this on my Pi2 there also seems to be some issues with the bluetooth service restarting
sometimes with multi-adapter use, I'm not sure what the problem is
as I've been able to connect 16 controllers to the pi successfully before.
Using a single adapter seems to still be stable as it was before, It might be good to try
loading oust manually rather than from the image to see if that helps, as well as loading it up on a pi3

One main problem with not being able to use more than 8 controllers
at once was the fact that each adapter can only handle about 6-7
controllers.

The move.pair() function seemed to always just pair controllers
to the default adapter, thus filling up a single hci device in /var/lib/bluetooth

This change loops through all of the connected adapters as seen by
hciconfig, and pairs the move controller with the adapter with the
smallest connected controller count using the move.pair_custom() function.
Thus allowing for an even spread among the different bluetooth adapters.

also removed the dev in scan_enable, since hciconfig dev, doesn't seem
to list out all of the connected adapters, while hciconfig by itself
does
@Jonty
Copy link
Owner

Jonty commented Feb 1, 2017

I actually implemented this at 33C3, which was super-tricky as it is both the most 2.4ghz-congested place in Europe and I discovered that I had three bluetooth adapters all with the same MAC address 🙃

Bluetooth only allows for 7 connections per host, and I've found that many adapters don't even allow for that. The proper CSR adapters seem to be best but even they need scan_enable.sh to allow devices to pair when a connection is active - a truly disgusting hack.

I too ran into the bluetooth restart problem and narrowed it down to an issue with the interaction between psmoveapi and systemd, as it is still using the legacy init script and seems to cause some problems. I've not had chance to debug this further yet, but it was present on both the pi2 and pi3 - it was even worse when trying to use the internal pi3 adapter! I suspect an upstream patch is probably needed, I've already had to push one upstream to fix system linking previously.

I'm going to leave this PR open as I can't really merge something that is known to be unstable. Hopefully we can both work through the problems and come to a solution!

@adangert
Copy link
Author

adangert commented Feb 2, 2017

yeah it very well might be the psmoveapi, I'll try installing the newest version on a pi3 to see if that helps at all. Also when I've gotten the internal bluetooth to work, it's very slow and laggy as well.

use these commands to disable the internal bluetooth on the pi3

sudo echo "dtoverlay=pi3-disable-bt" | sudo tee -a /boot/config.txt
sudo systemctl disable hciuart
sudo reboot

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants