I am trying to compile TinyB library from Intel. I found this script:
https://gist.github.com/StevenRudenko/b6c032c3c1fdfb5c641ff95883e6cd02
https://github.com/intel-iot-devkit/tinyb
https://mcuoneclipse.com/2016/12/19/tutorial-ble-pairing-the-raspberry-pi-3-model-b-with-hexiwear/
# Update BlueZ
sudo apt-get update
sudo apt-get install git build-essential autoconf cmake libtool libglib2.0 libdbus-1-dev libudev-dev libical-dev libreadline-dev
wget http://www.kernel.org/pub/linux/bluetooth/bluez-5.39.tar.xz
tar xvf bluez-5.39.tar.xz
cd bluez-5.39/
aclocal
autoheader
automake --force-missing --add-missing
autoconf
./configure --prefix=/usr --mandir=/usr/share/man --sysconfdir=/etc --localstatedir=/var --enable-experimental --with-systemdsystemunitdir=/lib/systemd/system --with-systemduserunitdir=/usr/lib/systemd
./configure --prefix=/usr \
--mandir=/usr/share/man \
--sysconfdir=/etc \
--localstatedir=/var \
--enable-experimental \
--enable-maintainer-mode
make
sudo make install
sudo cp attrib/gatttool /usr/local/bin
sudo sed -i '/^ExecStart.*bluetoothd\s*$/ s/$/ --experimental/' /lib/systemd/system/bluetooth.service
sudo ln -s /lib/firmware /etc/firmware
sudo systemctl enable bluetooth
sudo systemctl daemon-reload
sudo apt-mark hold bluez
sudo nano /lib/systemd/system/bluetooth.service
ExecStart=/usr/local/libexec/bluetooth/bluetoothd --experimental
sudo systemctl daemon-reload
sudo systemctl restart bluetooth
bluetoothctl
power on
agent on
scan on
scan off
info 00:34:40:0A:00:4E
pair 00:34:40:0A:00:4E
devices
list-attributes 00:34:40:0A:00:4E
read
atribute-info
select-attribute /org/bluez/hci0/dev_00_32_40_08_00_12/service002e/char002f
write 0x3 0x4 0x10 0x20 0x30 0x40
disconnect 00:32:40:08:00:12
quit
sudo apt-get install cmake build-essentials check-install libglib2.0-dev doxygen
git clone https://github.com/intel-iot-devkit/tinyb.git
mkdir build
cd build
cmake -DBUILDJAVA=ON ..
make
sudo checkinstall install
// to remove dpkg -r build
java -Djava.library.path=/usr/lib/jni -cp /usr/share/java/RXTXcomm.jar -jar your.jar
but this is a bit irrelevant. Could you help me fix this?
Firstly:
This script wants to compile bluez-5.39 with the -enable-experimental flag. Is it really necessary now? Can I just download the newest release of the library? If not, then when compiling BlueZ, there are many warnings that complete the compilation with the -Werror flag. Also, there is a problem with the “SIOCGSTAMP” function and I don’t know which function should I use here: “SIOCGSTAMP_NEW” or “SIOCGSTAMP_OLD”?
Second: sudo systemctl enable bluetooth
does not work, due Unit file /etc/systemd/system/bluetooth.service is masked.
Should I unmasked it?
Third: what exactly does this command do:
sudo nano /lib/systemd/system/bluetooth.service
ExecStart=/usr/local/libexec/bluetooth/bluetoothd --experimental
and why I need it?
I did not go further through the script, because the third part seems meaningless to me. Why duplicate ExecStart=/usr/local/libexec/bluetooth/bluetoothd --experimental at the beginning of the file? I hope for your help.
Maybe some repository already has a compiled tinyB library that will work?