Failure to install Bluetooth in new Jessie OS

My DiddyBorg has been running successfully for some months in Rasbian Wheezy using a PS3 sixaxis controller . Now that Jessie is the preferred OS I decided to transfer all my files to a newly downloaded Jessie installation.
I have run into trouble with the installation of Bluetooth. I have followed the instructions at "www.piborg.org/rpi-ps3-help" but it falls over at the first hurdle, after typing:

sudo apt-get -y install bluez-utils bluez-compat bluez-hcidump checkinstall

I get the following error messages

That Package bluez-utils is not available, but is referred to by another package, This may mean that the package is missing, has been obsoleted, or is only availablef rom another source.
However the following packages replace it.
bluez

E: Package 'bluez-utils' has no installation candidate
E: Unable to locate package bluez-compat

I have tried continuing with the rest of the installation but unsurprisingly it does not work.
I would be really grateful if you could point me in the right direction.

I've made some progress since I wrote the last post. After some heavy googling I discovered that it was only necessary to do a "sudo install bluez". I now have a working Bluetooth connection. I am still having difficulty in getting the sixaxis to connect, having pressed the PS button when prompted the sixaxis leds flash but don't settle onto one channel. There is an error message saying that the buffer is unavailable (or something similar). I'll have another go tomorrow.

piborg's picture

It seems like some of the changes for Jessie have caused issues with the PS3 setup in general.

Unfortunately I do not have a PS3 remote available to test with at the moment (all are in use for PiWars) but I did make some progress.

It seems that not only have there been some package changes but there is also a bug with the version of QtSixA which causes the build to fail.

From a fresh install of Jessie Lite this gets me to the point I should be able to connect the controller:

sudo apt-get -y install bluez-hcidump checkinstall libusb-dev libbluetooth-dev 
sudo apt-get -y install joystick libusb-1.0-0-dev bluez pyqt4-dev-tools python-dbus
wget http://www.pabr.org/sixlinux/sixpair.c
gcc -o sixpair sixpair.c -lusb
wget http://sourceforge.net/projects/qtsixa/files/QtSixA%201.5.1/QtSixA-1.5.1-src.tar.gz
tar xfvz QtSixA-1.5.1-src.tar.gz
cd QtSixA-1.5.1
wget https://www.piborg.org/compilation_sid.txt
patch -np1 -i compilation_sid.txt
cd sixad
make
sudo mkdir -p /var/lib/sixad/profiles
sudo checkinstall

Thanks piborg,
I followed your script but I'm still having problems I'm afraid. I'm not sure Bluetooth is working, my iPhone can't detect anything nearby. Is there any way to check from the RPi?
There seem to be a couple of errors in your script which threw me for a while as I got a 404 error when downloading from sourceforge. The files should be "QtSixA" and not "qtsixa". Also, the patch didn't work with your txt file, "Patch is full of garbage" or a similar error message. I used a patch from "https://bugs.launchpad.net/qtsixa/+bug/1036744/+attachment/3260906/+file..." which I found on a RetroPie site, it seems to have worked.
I'm not sure what is wrong with my connection, it seems to pair correctly with the USB cable plugged in but otherwise there is no response when the PS button is pressed, all the leds flashing together rather than cycling through the channels as it does when I revert back to my Wheezy setup, which is still working correctly.
Perhaps when your PS3 controllers return from battle you could check things out?
You'll notice I use "seem" a lot in the above, that should give you a clue that I'm a little out of my depth!

piborg's picture

Thanks for pointing the errors out, I must have made all the text lower case by mistake...

I will have a proper look at this next week when PiWars is over, it sounds like it will be a bit of a pain to fix.
Last time they did a major update of the kernel we had the same sort of problem, everything seemed to run but the controller would not connect like it used to.

Thanks. Yes, updates are necessary I suppose, but a pain. I've also had problems with cv2.imshow() which would not work in Jessie using a "tightvnc" server on the Pi, although not a problem with Wheezy. I managed to work around it by changing to "11xvnc" server.
I look forward to your solution for the joystick. In the meantime I'll continue with the Wheezy version.

piborg's picture

Well I eventually gave up on getting sixad to behave, it did not seem to want to work anymore.

Instead we came across BaseBot's awesome guide to setting up a PS3 controller without relying on sixad here: http://pythonhosted.org/triangula/sixaxis.html

After some experimenting we managed to repeatably get a controller to connect via Bluetooth from a freshly installed copy of Jessie Lite without too much hassle.

I have updated our guide to cover the new method, I am assuming that if it works with Jessie Lite it should also work fine with the ful Jessie install:
PlayStation 3 controller help sheet - Setup for Jessie and Jessie Lite.

Thanks again, piborg. It will be a few days before I can try it but I have every faith!
Your support for your brilliant products is exemplary.

I finally managed to find time to try the PS3 with Jessie using your latest instructions. It seems to pair correctly and works all the way up to "jstest /dev/input/js0".
"ls /dev/input/js*" shows that js0 is available but when I run the test the screen fills with axis and button numbers and then stalls, pressing or moving buttons gives no response. The controller has only one led lit as expected.
I'm pretty certain that the controller is working as it functions well with my "Wheezy" set up. I am reluctant to completely reinstall a newly download Jessie as I have spent hours getting VNC, OpenCV and various other bits and pieces installed and working but if all else fails I will have to. The "Jessie" I'm running at the moment was fully updated with "apt-get dist-upgrade" as per the RPi website blog for the latest version of "Jessie".
I also tried running my Diddy software but there is no response to the joystick.
Any help gratefully received!

piborg's picture

It is possible that sixad is still running as well and causing problems.

This set of commands should stop it loading at boot:

sudo sixad --stop
sudo sixad --boot-no

You will also want to remove any sudo sixad --start commands you are using.
When you run any of our DiddyBorg or PicoBorg Reverse scripts use the ./run*** versions instead of ./ps3***, otherwise they will try and load sixad as well.

Once you have done all of the above restart the Raspberry Pi and try the PS3 controller again, hopefully it will now work properly.

This afternoon I installed the latest full version Jessie downloaded from RPi web site onto a fresh SD card (as an "img", not "noobs"). No possibility of sixad running as I haven't installed it or any DiddyBorg or PicoBorg Reverse scripts. I'm afraid I'm still getting the same problem, jstest fills the screen with axis and button values and then stalls after less than a second.
I have successfully connected the controller (although it took many attempts to get "trust") with only one LED alight after pressing PS.
Have you tried it using a full install of Jessie? Perhaps it only works with Jessie Lite? If so I'm stymied as I need the GUI.
Just to check I put my Wheezy SD card back into Diddy and confirmed that the controller works properly with sixad. Do you think it would be possible to get sixad working with Jessie?
I would quite like to upgrade to Jessie as I am using the GPIO pins and RPi.GPIO needs sudo in Wheezy which is a bit of a pain when running headless. The print statements will not show in Terminal when my script is run with gksudo although it's ok from a sudo "Idle" shell. This is ok when using my laptop but becomes difficult when using a rather pathetic Android tablet!

piborg's picture

You could try to get sixad to work, but we had very little success.
It is possible others have had more luck, it may be worth asking around.

I do not remember if we tested this with the full copy of Jessie, it is possible that we did not.
Unfortunately we are rather busy with the office move and the Raspberry Pi birthday coming up so it is difficult to find time to try everything right now.

Looking at BaseBot's guide (http://pythonhosted.org/triangula/sixaxis.html) there are a couple of things to try.
First he has installed some more bits:

sudo apt-get install bluetooth libbluetooth3 libusb-dev
sudo systemctl enable bluetooth.service

Secondly he has changed some permission settings:

sudo usermod -G bluetooth -a pi

I also noticed that BaseBot talks about actually disconnecting the power completely, not just restarting the Raspberry Pi.
I know it is a long shot, but have you tried that at any stage?

After much Googling I have managed to get QtSixA-1.5.1 installed and working in a fresh install of Jessie, with "jstest /dev/input/js0" working and the numbers changing when sticks are waggled and buttons pressed.
As it was a bit hit and miss as to how I managed this I am now trying it on a second SD card and recording the steps I take while things are fresh in my mind.
If I am successful again I'll report back with the procedure.

Installing Sixad in "Jessie"

In a freshly installed version of "Jessie" (updated and upgraded) install the following packages:

sudo apt-get -y install bluetooth
sudo apt-get -y install libusb-dev
sudo apt-get -y install joystick
(python-pygame already installed in Jessie)
sudo apt-get -y install bluez-hcidump
sudo apt-get -y install checkinstall
sudo apt-get -y install libbbluetooth-dev
sudo apt-get -y install pyqt4-dev-tools
sudo apt-get -y install libjack0
sudo apt-get -y install libjack-dev

# It's possible that some of these installs are not necessary but I don't have enough knowledge to investigate this. This combination that works on my setup.

# Get sixpair from web site
wget http://www.pabr.org/sixlinux/sixpair.c
gcc -o sixpair sixpair.c -lusb

# get QtSixA from web site
wget http://sourceforge.net/projects/qtsixa/files/QtSixA%201.5.1/QtSixA-1.5.1...
tar xfvz QtSixA-1.5.1-src.tar.gz

At this point remove or rename the file "shared.h" from /home/pi/QtSixA-1.5.1/sixad

# From GitHub get an updated copy of "shared.h"
https://github.com/falkTX/qtsixa/tree/master/sixad

I did this in Windows cutting and pasting from the RAW file in GitHub into Notepad and converting it to Linux line endings in "PyPe", there's probably a better way but this worked.

Copy downloaded "shared.h" into /home/pi/QtSixA-1.5.1/sixad

# (Thanks to robl at PiBorg-Home-Forums-Raspberry Pi General Discussions-make failure for QtSixA for this information).

cd QtSixA-1.5.1/sixad

make

sudo mkdir -p /var/lib/sixad/profiles
sudo checkinstall

# At this point the file /etc/default/sixad needs modifying to prevent a "bad buffer" error when trying to connect with sixad.

sudo nano /etc/default/sixad - change LEGACY=0 to LEGACY=2

Proceed as described in the rest of the PiBorg Setup instructions for "Wheezy", i.e. pair with sixpair and then run sixad and press the PS button. Test with jstest /dev/input/js0 and it should work.

This is not perfect and I would welcome any advice as to how to improve things:

Firstly the pairing doesn't survive a reboot so the controller needs re-pairing with a usb lead and sixpair each time.

Secondly the controller only works in Legacy mode, i.e. no vibration, no motion sensing, no axis output from buttons other than the joysticks. However, this is exactly how my previous "Wheezy" installation worked.

I will also post this in the RPi forum.

piborg's picture

We have seen the same problem as you now, a controller pairing but getting stuck at the jstest stage.

After a lot of playing around we discovered the following:

  • Both Jessie and Jessie Lite had the same behaviour
  • Old working SD card images seemed to have the same issue
  • Swapping the PS3 controller saw no change in behaviour
  • Swapping the Bluetooth module for a different one fixed the problem!

We did some more testing and it seems like some Bluetooth modules do not like our new instructions.
I suspect the same modules may be causing the need for legacy mode with sixad as well.

If you can I would try and get a different Bluetooth module from somewhere to try, it may just solve your re-pairing trouble.

Glad I'm not the only one!
Any chance you could let me know which make/model of Bluetooth model worked with you? Random "Amazoning" or "eBaying" could get expensive and Mrs "Il Diavolo" keeps a tight rein on my Diddy budget.

piborg's picture

The dongle that we have had running without any trouble for years is a Hama Nano Bluetooth USB Adapter, version 3.0.
The model number is 00049238.

The part number for the other one I have confirmed working this morning is: GUBTCR42I-NT.
It does not have a manufacturer printed on it so I am not sure who makes it.

The module I'm using is a "Dynamode" which I bought from you a few months ago.
If you have any of these in stock I wonder if you could test one to see if it works with Jessie?
Please don't take this a complaint, I'm quite happy using it in Legacy mode.

piborg's picture

Unfortunately it seems like they do have this problem.

It looks like some of those modules do work, but some do not.
Upon closer inspection the older one I have been using for testing with is not quite the same as the current ones we are selling.
The old one does work, but the current ones do not seem to...

On a different note the new Raspberry Pi has built-in Bluetooth:
https://www.raspberrypi.org/blog/raspberry-pi-3-on-sale/
https://www.modmypi.com/raspberry-pi/rpi3-model-b/raspberry-pi-3-model-b
We will be getting our hands on some to test with, but this week is a bit busy for us with the upcoming Raspberry Pi birthday party at the weekend.

piborg's picture

We got our hands on a Raspberry Pi 3 this morning and I can confirm that it works with a PS3 controller.

I made a slight change to our instructions as the bluetooth package is no longer required with the new copy of Jessie and Jessie Lite.
I am expecting your sixad procedure will work also, hopefully without the need for legacy mode.

Given the extra performance and the built-in WiFi it may be a better investment to upgrade to a Raspberry Pi 3 instead of looking for a different Bluetooth dongle.

I may well buy a Pi 3 but I will probably leave my Pi 2 in Diddy for the foreseeable future, it's well bedded in with a PiRack and a Gertboard attached on a frame made up with various bits of old Meccano which I would have to take apart to swap it.
In that case, are you able to sell me a Bluetooth Dongle that you know will work correctly (with Jessie + Pi 2)?
I don't mind if you have to take it out of the packaging to test it. Sorry if I'm being presumptuous, I know you're busy people.

piborg's picture

No problem, I have one or two which are working properly but missing their packaging if you are okay with that.

If this is fine with you place an order for this custom item and I will send you one that I am certain is working correctly:
https://www.piborg.org/custom-order-2

Order placed, thanks very much.

Could you possibly give some detailed instructions on how to set up the PS3 controller with RPi 3?

I can connect with USB cable ok, and have successfully set the Bluetooth master correctly using sixpair.

When I try to connect wirelessly, i get a message asking me to put in a passcode 0000 on the controller ( which is not possible), then the pairing fails.

When I press the PS button, I get 4 lights flashing and it never connects and has only one light flashing.

Any ideas?

piborg's picture

We use the bluetoothctl program to setup the Raspberry Pi to accept the PS3 controller.
This works with both the built-in Bluetooth on the RPi 3 and with a USB dongle on the RPi Zero.

We go through how to do this on our PlayStation 3 controller help sheet.

I have followed those instructions, and when I press the PS button, I get a message saying the device has connected.
[CHG] Device 00:26:5C:B8:03:01 Connected: yes
After that i run the connect command
[bluetooth]# connect 00:26:5C:B8:03:01
and i get a message
Attempting to connect to 00:26:5C:B8:03:01
Failed to connect: org.bluez.Error.InProgress

The problem I have is that the 4 lights keep flashing after the device says its connected, and then it disconnects.

Am I missing something??

piborg's picture

It sounds like things have gotten a bit confused and the controller is sort of connected already.

First I would try skipping to the trust step:
trust 00:26:5C:B8:03:01
and see if things proceed normally from that point.

If it still does not work try all of the following:

  1. Shutdown the Raspberry Pi
  2. Disconnect the power from the Pi
  3. Make sure the PS3 controller is not attached to anything by USB
  4. Wait until the LEDs on the controller are all off (not blinking)
  5. Re-connect the Raspberry Pi power
  6. Go straight to the terminal and try the setup sequence on our page from the start

Hopefully that will force it to behave nicely :)

No luck unfortunately.

I was able to complete the trust step successfully, getting a message back:
Changing 00:26:5C:B8:03:01 trust succeeded

Then I get the following message on the screen:
[CHG] Device 00:26:5C:B8:03:01 Connected: no

Then I press the PS button on the controller, the 4 lights start quick flashing and I get:
[CHG] Device 00:26:5C:B8:03:01 Connected: yes

Then if I wait a few seconds, the 4 light stop flashing and I get:
[CHG] Device 00:26:5C:B8:03:01 Connected: no again.

In another terminal, I have been checking to see if I get a /dev/input/js0 entry - I don't get anything here at all, even if in the bluetooth config I get a message saying its connected.

Note: I can connect the controller via USB and read joystick data, so I think the controller works OK.

Do you have any other tips on how I might troubleshoot this?

PS My DiddyBorg arrived yesterday and I am impressed!

piborg's picture

Glad to hear you like your DiddyBorg ^_^

I guess you have probably already tried this, but could you repeat the pairing command with the PS3 controller attached via the USB cable:
sudo ~/sixpair
It might help, but probably not.

We had some trouble like this ourselves in the past.
In particular we have seen this when we have upgraded a copy of Raspbian or using the old wheezy instructions on Jessie.

If you have a spare SD card I would suggest downloading a fresh copy of Jessie or Jessie Lite an re-running the setup from scratch.
I would also avoid using the Bluetooth setup in the GUI as it might be the cause of the problems.

I got a new download of Raspbian, and it seems to be working ok now.

Not sure what the problem was, but anyway...

Thanks for your suggestions.

Subscribe to Comments for "Failure to install Bluetooth in new Jessie OS"