awneil
Posts: 8
Joined: Wed Dec 10, 2014 4:56 pm
Location: Basingstoke, Hants, UK
Contact: Website

RPi 3 Bluetooth LE - bluetoothctl missing commands

Thu Sep 29, 2016 12:57 pm

I have the latest Raspbian Jessie image: 2016-09-23-raspbian-jessie.img

I have been able to do basics like scan for & connect to BLE devices.

This blog post: https://acassis.wordpress.com/2016/06/
says that “gatttool” is deprecated and will be removed soon, then we need to use bluetoothctl instead.

I can, indeed, use bluetoothctl - but some of the mentioned commands are missing!

eg, 'list-attributes' and 'attribute-info' are both used in that blog, but both just return "Invalid command" on my Pi.

Are they just not available on the Pi?
Or what do I need to do to get them?

dpkg -s bluez gives the following:

Code: Select all

Package: bluez
Status: install ok installed
Priority: optional
Section: admin
Installed-Size: 2588
Maintainer: Debian Bluetooth Maintainers <[email protected]>
Architecture: armhf
Multi-Arch: foreign
Version: 5.23-2+rpi2
Replaces: bluez-audio (<= 3.36-3), bluez-input, bluez-network, bluez-serial, bluez-utils (<= 3.36-3), udev (<< 170-1)
Depends: libc6 (>= 2.15), libdbus-1-3 (>= 1.1.1), libglib2.0-0 (>= 2.28.0), libreadline6 (>= 6.0), libudev1 (>= 196), init-system-helpers (>= 1.18~), kmod, udev (>= 170-1), lsb-base, dbus
Breaks: udev (<< 170-1)
Conflicts: bluez-audio (<= 3.36-3), bluez-utils (<= 3.36-3)
Conffiles:
 /etc/bluetooth/input.conf 9f85017f861ac34d983fa76fa715f9c3
 /etc/bluetooth/main.conf 297ad1bff9ec02f760eb6b5b7bf48e74
 /etc/bluetooth/network.conf 0c7497c405b963382ff71789d0730abd
 /etc/bluetooth/proximity.conf b75823a140e00905d41465c380bf89fe
 /etc/dbus-1/system.d/bluetooth.conf 98bb1c2cf393ac16f0ba3bb0153a4f30
 /etc/default/bluetooth 1e25cf981f29147187311b94f8e0ea89
 /etc/init.d/bluetooth 1d503f26c72a83c43b90422ec5907626
Description: Bluetooth tools and daemons
 This package contains tools and system daemons for using Bluetooth devices.
 .
 BlueZ is the official Linux Bluetooth protocol stack. It is an Open Source
 project distributed under GNU General Public License (GPL).
Homepage: http://www.bluez.org

_RobP
Posts: 45
Joined: Sat Feb 13, 2016 9:01 pm

Re: RPi 3 Bluetooth LE - bluetoothctl missing commands

Thu Sep 29, 2016 1:31 pm

If you notice the context that the blog is in changes after the author connects to the bluetooth device:
[CHG] Device EC:F2:E5:CE:30:5B Connected: yes
Connection successful

//get information from device
[Nordic_UART]# info
I haven't seen this happen in my experience with bluetoothctl. I have to type info <MAC_ADDRESS> to return the connected devices information.

I haven't got a solution for you, but it could explain why you're seeing the error you're getting.

awneil
Posts: 8
Joined: Wed Dec 10, 2014 4:56 pm
Location: Basingstoke, Hants, UK
Contact: Website

Re: RPi 3 Bluetooth LE - bluetoothctl missing commands

Thu Sep 29, 2016 1:50 pm

Cheers.

Yes, I did notice that.

But the commands on my RPi seem to be completely missing - not just taking (slightly) different parameters?

This guy seems to have a similar observation about the "missing" commands: http://stackoverflow.com/a/34284055/4618900

His explanation is rather sketchy - looks like Bluez has to be (re-?) installed with some "experimental" option(s)? Plus some other configuration tweaks?

awneil
Posts: 8
Joined: Wed Dec 10, 2014 4:56 pm
Location: Basingstoke, Hants, UK
Contact: Website

Re: RPi 3 Bluetooth LE - bluetoothctl missing commands

Thu Sep 29, 2016 2:09 pm


User avatar
Douglas6
Posts: 4471
Joined: Sat Mar 16, 2013 5:34 am
Location: Chicago, IL

Re: RPi 3 Bluetooth LE - bluetoothctl missing commands

Thu Sep 29, 2016 2:16 pm

The author of that blog is using BlueZ 5.40. Raspbian Jessie comes with BlueZ 5.23. So you'll either need to build a newer version of BlueZ, or stick with gatttool.

awneil
Posts: 8
Joined: Wed Dec 10, 2014 4:56 pm
Location: Basingstoke, Hants, UK
Contact: Website

Re: RPi 3 Bluetooth LE - bluetoothctl missing commands

Thu Sep 29, 2016 2:40 pm

OK - thanks.

So, to update BlueZ, would I have to uninstall the existing version first? If so, how would I do that?

Or would just building the newer version automatically update/overwrite the existing one?

User avatar
Douglas6
Posts: 4471
Joined: Sat Mar 16, 2013 5:34 am
Location: Chicago, IL

Re: RPi 3 Bluetooth LE - bluetoothctl missing commands

Thu Sep 29, 2016 2:53 pm

I haven't tried it myself in Jessie. My instinct would be to not uninstall BlueZ first, but let/make the new version replace the old. I haven't seen a guide for that, so if you're successful, please share your steps.

leoliuhui25
Posts: 1
Joined: Fri Jan 12, 2018 3:14 am

Re: RPi 3 Bluetooth LE - bluetoothctl missing commands

Fri Jan 12, 2018 6:44 am

I am using bluez Version 5.48.

From help command you will find there is a Submenu,
# help
Menu main:
Available commands:
-------------------
advertise Advertise Options Submenu
scan Scan Options Submenu
gatt Generic Attribute Submenu
list List available controllers
show [ctrl] Controller information
select <ctrl> Select default controller

Then you can enter the gatt Submenu via command:
#menu gatt

You can use the missing commands now.

awneil
Posts: 8
Joined: Wed Dec 10, 2014 4:56 pm
Location: Basingstoke, Hants, UK
Contact: Website

Re: RPi 3 Bluetooth LE - bluetoothctl missing commands

Fri Jan 12, 2018 10:40 am

leoliuhui25 wrote: I am using bluez Version 5.48.
Well, I guess things have moved on since the last post in this thread - Sep 2016.

So what version of Raspbian are you using :?:

Did this version of BlueZ come with that version of Raspbian - or did you have to manually install or update it?

Return to “General discussion”