In order to use gatttool I believe you'll need to install a different version of BlueZ, because the one included with the Edison doesn't include it. You could try following a guide like this one: jared wolff | Get started with Bluetooth Low Energy
Note that the BlueZ version included in this guide is old, but you could apply it to later versions of the package, you'll find them here: BlueZ
I want to advertise services from Edison as a peripheral BLE device. I'm currently trying to find out what I can do with bleno but I'm also searching for gattool on Edison.
Did you also manage to get gattool only on Ubilinux or were you able to do it on Yocto as well (what I'm trying right now) ?
I have downloaded bluez-5.24 and in attrib/ : gcc gatttool.c -o gatttool but compilation ends because unable to find glib.h
Any advice/help for this ?
Nope, "package installed in root is up to date" !
Anyway thanks for helping !
I manage to have quite what I want with bleno I think. I'll try to advertise a custom BLE service based on this script: bleno/test.js at master · sandeepmistry/bleno · GitHub in order to have read and write characteristics. Hope it'll do it fine !
I think your issue is related with the location of glib.h. I also ran gcc gatttool.c -o gatttool and the error was with the location of glib.h in #include <glib.h> . This is because when you use gcc to compile, it will look the libraries under /usr/include and glib.h is not in there, it is in /usr/include/glib-2.0 so you will need to use #include <glib-2.0/glib.h> . But there are issues with other libraries so you may need to do more changes. I'm not sure it vallave had to do some changes to make it work or if found an easier way.
thanks for the reply.
Changing <glib.h> to <glib-2.0/glib.h> effectively removed the error.
And as you supposed I have another library error (in glib.h, glib/galloca.h -> no such file) so applying the previous resolution should fix this and probably I should do it recursively until no error !!
Well, as I managed to have what I want with bleno, I'm no longer trying anything with gatttool ! Sure this will help anybody trying to compile gatttool !
1 of 1 people found this helpful
I am also working on testing Bluetooth LE in Yocto but not on Edison. I am testing it on a Quark-based platform (Intel Galileo Gen 2).
If you're using BlueZ 5, note that gatttool is being built but not installed in the process of building your image (bitbake).
If you wish to use gatttool, a simple and quick solution is to copy gatttool (not the source files i.e. .c & .h) in your ../build/tmp/work/i586-poky-linux/bluez5/5.x-r0/bluez5.22/attrib directory to your /usr/bin folder after booting your image.
I have attached a screenshot on where gatttool is located. It is the file highlighted in green (executable file).
Copy that file to your microSD card and boot your image.
Lastly, copy gatttool to your /usr/bin directory.
You're done. Now you just have to test it out. Type gatttool --help to see the available options to you
Extra note: if you wish to try out some new BLE experimental tools like 'btgatt-client', you can check out the post below. I've been playing around with this new tool for service and characteristics discovery.
Hope this helps!
QuackieDuck - Thanks for your approach.
For installing Gatttool you can also check this document: Using the Generic Attribute Profile (GATT) in Bluetooth* Low Energy with your Intel® Edison Board | Intel® Developer Zon…