OSMC BlueZ package and missing gatttools

Hi everybody

I have been enjoying OSMC for two years now, and use it as a base OS for Domoticz.

With PI3 I started using the integrated Bluetooth, playing with Parrot Flower, Bluetooth beacons, and now Xiaomi Mi flora.

I noticed the gatttools are missing from the installed BlueZ packages.

Is there a “safe and easy” way to add them without impairing OSMC stability ?

Or should I reinstall the full 5.43 last release BlueZ package ?

Thanks a lot !

Hi

The source for BlueZ can be found in our Git repo.

Is ‘gattools’ part of Bluez, or an external package? I suspect you can install them manually from Debian’s repositories.

Sam

Hi,

Thanks for the (so quick) answer.

Yes the gatttool I’m refering to (tools to manage bluetooth) is part of Bluez, and usually installed with it.
Don’t think there is a stand lone package I could use just for the tools.
There is at least another gattool in the repo for “analysis of genomic structural variation”, not relevant here.

As I understand it, the version number of the Bluez OSMC package was artificially set to be higher than any current version of Bluez to maintain OSMC dependencies ?
But it prevents from keeping it up to date (current would be bluez-5.43).

Would be useful for recent bluetooth Low Energy devices better managed with later releases.

Already tried to remove the Bluez package trying to recompile it and upgrade it ,
but I chocked on the armv7-network-osmc end libglib2 dependency part.

I will have a look at the Bluez source in repo, even if I’m afraid it’s too much for my current skills

Thanks anyway

Hello

Yes – it is updated so that the OSMC version superseded installations of BlueZ.

My understanding is that Pi does not implement BT Low Energy yet, so future versions won’t necessarily be beneficial.

You can update to a different version, but we are trying to follow the Debian style of stability and slow incremental change. I’m not really aware of any benefits a future version of BlueZ would bring just yet.

P.S. you need some patches (see our Git) for Pi Bluetooth to work properly. This is why we started distributing bluez ourselves.

Hi,

Same thing here. I’d like to communicate with the MiFlora but gatttools is not installed.
@lec668 , did you manage to install it from one way or another?

I don’t know if I should try to install bluez from source or if I sould try to force the Jessie package installation.

Trying quickly to install the deb from the Jessie website I got the following error:

dpkg: warning: downgrading bluez from 9.99-9 to 5.23-2+b1
dpkg: warning: files list file for package 'armv7-eventlircd-osmc' missing; assuming package has no files currently installed
(Reading database ... 50141 files and directories currently installed.)
Preparing to unpack bluez_5.23-2+b1_armhf.deb ...
Unpacking bluez (5.23-2+b1) over (9.99-9) ...
dpkg: error processing archive bluez_5.23-2+b1_armhf.deb (--install):
 trying to overwrite '/usr/bin/rfcomm', which is also in package armv7-bluez-osmc 5.3.9-1
dpkg-deb: error: subprocess paste was killed by signal (Broken pipe)
Errors were encountered while processing:
 bluez_5.23-2+b1_armhf.deb

Cheers
Benoit

bluez is already distributed in OSMC.

Don’t try and install a custom version of bluez, or you’ll have problems

Ok, but then how can gatttools be made available as it is not part of the OSMC bluez package?

Benoit

Replying to myself.
I just compiled bluez from the source and an executable for gatttool has been generated and is working.

Ben

Hi camfrout,

I’m exactly in the same situation as you… but i’m very newbie with linux environment. Could you please explain step by step how did you do ?

Regards

Hi Ten,

Not sure that this is the best solution but I did the following:

  1. Download bluez from here: Index of /pub/linux/bluetooth/ . If I recall correctly I had issues to compile the version 5.44 but 5.43 worked well
  2. Untar the archive: tar xvf bluez-5.43.tar.xz
  3. Go to the new directory cd bluez-5.43
  4. Install dependencies: sudo apt-get update followed by
    sudo apt-get install -y libusb-dev libdbus-1-dev libglib2.0-dev libudev-dev libical-dev libreadline-dev
  5. Execute ./configure
  6. Run the command make
  7. I didn’t run make install by fear of messing with the existing osmc packages, so I let the programs where they are. You will find gatttool in the folder attrib. You can type the following to have the program easily accessible from the command line sudo cp attrib/gatttool /usr/local/bin/

Cheers
Ben

2 Likes

Perfect! I was near but with your instructions i know that i’m not messing around with osmc.

Thank you Camfrout

Hi Sam,

I need to pick up this thread again. As a Vero 4K owner I’m also missing gatttool in the custom OSMC bluez package. Since it’s part of the upstream package and a few people already expressed their need for it, would it be possible to add it to the OSMC flavored package as well?

Thanks!

Can you let me know what this utility is used for?

Sam

Guess i’m in the same boat.

We’re trying to use the pi running osmc as a BLE → mqtt gateway for some plant sensors, using

GitHub - ThomDietrich/miflora-mqtt-daemon: Linux service to collect and transfer Xiaomi Mi Flora plant sensor data via MQTT to your smart home system, with cluster support 🌱🌼🥀🏡🌳 e.g.

You can download the bluez package and extract the gatttool executable:

cd  /tmp
apt-get download bluez
dpkg -X bluez_5.50-1.2~deb10u1_armhf.deb blz
sudo cp ./blz/usr/bin/gatttool /usr/local/bin

On my Pi3, it shows the help screen without error:

./gatttool --help
Usage:
  gatttool [OPTION?]

Help Options:
  -h, --help                                Show help options
  --help-all                                Show all help options
  --help-gatt                               Show all GATT commands
  --help-params                             Show all Primary Services/Characteristics arguments
  --help-char-read-write                    Show all Characteristics Value/Descriptor Read/Write arguments

Application Options:
  -i, --adapter=hciX                        Specify local adapter interface
  -b, --device=MAC                          Specify remote Bluetooth address
  -t, --addr-type=[public | random]         Set LE address type. Default: public
  -m, --mtu=MTU                             Specify the MTU size
  -p, --psm=PSM                             Specify the PSM for GATT/ATT over BR/EDR
  -l, --sec-level=[low | medium | high]     Set security level. Default: low
  -I, --interactive                         Use interactive mode

Yeah I managed to get it to work by compiling bluez locally as per @camfrout instructions.

Just wondering if there is any solid reason not to include gatttool :slight_smile: It doesnt seem big, and would safe some time / re-figuring out when my sdcard eventually dies. I understand osmc over versions to ensure compatibility, just would be really nice to have this working as the ‘normal’ bluez would in this regard.

No idea. You should bear in mind that OSMC is primarily a media-focused distribution. It would probably have been a decision of Sam or one of the devs.