17 BlueZ
17.1 Histroy
- 2014-08-07, rayoslee, release V0.0.3,
- add “build hcidump and bccmd for S605-32”
- 2014-07-09, rayoslee, release V0.0.2,
- add gatttool and some usage
- add build BlueZ 4.84, 4.85, 4.91, 4.98, 5.18, 5.19, 5.21 for ubuntu
- 2014-06-27, rayoslee, release V0.0.1
17.2 FAQ
- How to buile BlueZ 5.11 for ubuntu ?
Install Required Libraries
sudo apt-get install libusb-dev libdbus-1-dev libglib2.0-dev libudev-dev
libical-dev libreadline-devExtract bluez-5.11.tar.xz
tar -Jxvf bluez-5.11.tar.xz
Compile BlueZ
cd bluez-5.11 (default gatttool, hcidump)
sudo ./configure –disable-systemd
sudo make
- How to build BlueZ 4.84, 4.85, 4.91 for ubuntu ?
Build commands
sudo make distclean
sudo ./configure –enable-attrib //add gatttool
sudo make
(these versions don’t support hcidump)
- How to build 4.98 for ubuntu ?
Build commands
sudo make distclean
sudo ./configure //default gatttool
sudo make
- How to build 5.18, 5.19, 5.21 for ubuntu ?
- Build commands
cd dubs-1.8.0 export INSTALL_PATH=`pwd`/myinstall sudo make distclean sudo ./configure --prefix=$INSTALL_PATH sudo make sudo make install cd bluez-5.18, 5.19, 5.21 sudo make distclean sudo ./configure --prefix=$INSTALL_PATH DBUS_CFLAGS="-I$INSTALL_PATH/include/dbus-1.0 -I$INSTALL_PATH/lib/dbus-1.0/include/dbus" \ DBUS_LIBS="-L$INSTALL_PATH/lib -ldbus-1" \ PKG_CONFIG_PATH=$INSTALL_PATH/lib/pkgconfig:$PKG_CONFIG_PATH --disable-systemd sudo make
- How to build BlueZ 4.91 for S605-32 ?
- Install Required Libraries and compile them
export TOOLCHAIN_PATH=/usr/local/arm_linux_4.2 export CC_TOOL=$TOOLCHAIN_PATH/bin/arm-linux-gcc export AR_TOOL=$TOOLCHAIN_PATH/bin/arm-linux-ar export RANLIB_TOOL=$TOOLCHAIN_PATH/bin/arm-linux-ranlib export CXX_TOOL=$TOOLCHAIN_PATH/bin/arm-linux-g++ export INSTALL_PATH=/bluez export BLUEZ_EXEC_PATH=/bluezEXE export PKG_CONFIG_PATH=$INSTALL_PATH/lib/pkgconfig:$PKG_CONFIG_PATH export LD_LIBRARY_PATH=$INSTALL_PATH/lib:$LD_LIBRARY_PATH cd expat-2.0.1 sudo make distclean ./configure --prefix=$INSTALL_PATH --host=arm-linux --enable-static \ CC="$CC_TOOL -I$INSTALL_PATH/include -L$INSTALL_PATH/lib" \ AR="$AR_TOOL" \ RANLIB="$RANLIB_TOOL" sudo make sudo make install cd dbus-1.4.8 sudo make distclean rm -f arm-linux.cache echo 'ac_cv_have_abstract_sockets=yes'>arm-linux.cache ./configure --prefix=$INSTALL_PATH --host=arm-linux --enable-static \ CC="$CC_TOOL -I$INSTALL_PATH/include -L$INSTALL_PATH/lib" \ AR="$AR_TOOL" \ RANLIB="$RANLIB_TOOL" \ --cache-file=arm-linux.cache --with-x=no \ --with-session-socket-dir=/tmp \ --with-system-socket=/var/run/dbus/system_bus_socket sudo make sudo make install cd gettext-0.15 sudo make distclean ./configure --prefix=$INSTALL_PATH --host=arm-linux \ CC="$CC_TOOL -I$INSTALL_PATH/include -L$INSTALL_PATH/lib" \ AR="$AR_TOOL" \ RANLIB="$RANLIB_TOOL" \ CXX="$CXX_TOOL" sudo make sudo make install cd libiconv-1.13.1 sudo make distclean ./configure --prefix=$INSTALL_PATH --host=arm-linux \ CC="$CC_TOOL -I$INSTALL_PATH/include -L$INSTALL_PATH/lib" \ AR="$AR_TOOL" \ RANLIB="$RANLIB_TOOL" \ CXX="$CXX_TOOL" sudo make sudo make install cd glib-2.22.5 or glib-2.28.6 sudo make distclean rm -f arm-linux.cache echo ac_cv_type_long_long=yes>arm-linux.cache echo glib_cv_stack_grows=no>>arm-linux.cache echo glib_cv_uscore=no>>arm-linux.cache echo ac_cv_func_posix_getpwuid_r=yes>>arm-linux.cache echo ac_cv_func_posix_getgrgid_r=yes>>arm-linux.cache ./configure --prefix=$INSTALL_PATH --host=arm-linux --cache-file=arm-linux.cache \ --with-libiconv=gnu \ CC="$CC_TOOL -I$INSTALL_PATH/include -L$INSTALL_PATH/lib" \ AR="$AR_TOOL" \ RANLIB="$RANLIB_TOOL" sudo make sudo make install cd libusb-0.1.12 sudo make distclean ./configure --prefix=$INSTALL_PATH --host=arm-linux \ CC="$CC_TOOL -I$INSTALL_PATH/include -L$INSTALL_PATH/lib" \ AR="$AR_TOOL" \ RANLIB="$RANLIB_TOOL" \ CXX="$CXX_TOOL" sudo make sudo make install cd ncurses-5.7 sudo make distclean ./configure --prefix=$INSTALL_PATH --host=arm-linux \ --with-gnu-ld --with-shared --without-ada \ CC="$CC_TOOL -I$INSTALL_PATH/include -L$INSTALL_PATH/lib" \ AR="$AR_TOOL" \ RANLIB="$RANLIB_TOOL" \ CXX="$CXX_TOOL" sudo make sudo make install cd readline-6.2 sudo make distclean ./configure --prefix=$INSTALL_PATH --host=arm-linux --with-curses=$INSTALL_PATH \ --disable-static \ CC="$CC_TOOL -I$INSTALL_PATH/include -L$INSTALL_PATH/lib" \ AR="$AR_TOOL" \ RANLIB="$RANLIB_TOOL" sudo make sudo make install
- Compile BlueZ
cd bluez-4.91 sudo make distclean ./configure --prefix=$INSTALL_PATH --exec-prefix=$BLUEZ_EXEC_PATH --host=arm-linux --enable-static \ CC="$CC_TOOL -I$INSTALL_PATH/include -L$INSTALL_PATH/lib" \ AR="$AR_TOOL" RANLIB="$RANLIB_TOOL" \ --enable-attrib --enable-bccmd --disable-test --disable-cups \ --disable-audio --disable-pie --with-gnu-ld \ READLINE_CFLAGS="-I$INSTALL_PATH/include" READLINE_LIBS="-L$INSTALL_PATH/lib -lreadline" \ LIBS="-lncurses" sudo make sudo make install cd bluez-hcidump-2.5 sudo make distclean ./configure --prefix=$INSTALL_PATH --exec-prefix=$BLUEZ_EXEC_PATH --host=arm-linux \ CC="$CC_TOOL -I$INSTALL_PATH/include -L$INSTALL_PATH/lib" \ AR="$AR_TOOL" \ RANLIB="$RANLIB_TOOL" sudo make sudo make install
- How to use BlueZ 4.91 in S605-32 ?
- Copy SD1-1_BlueZ to SD card
- Mount, Up BLE (HCI mode) device
/mnt/nand1-1 # hciattach /dev/ttyS0 any 9600 noflow Device setup complete /mnt/nand1-1 # hciconfig hci0 up /mnt/nand1-1 # hciconfig hci0: Type: BR/EDR Bus: UART BD Address: 11:22:55:EE:CC:AA ACL MTU: 0:0 SCO MTU: 0:0 UP RUNNING RX bytes:99 acl:0 sco:0 events:10 errors:0 TX bytes:45 acl:0 sco:0 commands:10 errors:0
- LE Scan
/mnt/nand1-1 # ^M/mnt/nand1-1 # hcitool -i hci0 lescan LE Scan ... E0:C7:9D:6A:81:14 E0:C7:9D:6A:81:14 E0:C7:9D:6A:81:14 E0:C7:9D:6A:81:14 78:C5:E5:6E:53:B2 78:C5:E5:6E:53:B2
GATT Connect with interaction (There are some bugs to be resolved)
/mnt/nand1-1 # hcitool -i hci0 lecc 78:C5:E5:6E:53:B2
Connection handle 0
/mnt/nand1-1 # hcitool -i hci0 ledc 0
/mnt/nand1-1 # hcitool -i hci0 lecc 78:C5:E5:6E:53:B2
Connection handle 0
/mnt/nand1-1 # gatttool -i hci0 -b 78:C5:E5:6E:53:B2 -I
[ ][78:C5:E5:6E:53:B2][LE]> connect
l2cap_bind: Success (0)
[ ][78:C5:E5:6E:53:B2][LE]> primary
Command failed: disconnectedGATT Connect without interaction (There are some bugs to be resolved)
/mnt/nand1-1 # gatttool -i hci0 -b 78:C5:E5:6E:53:B2 –primary
l2cap_bind: Success (0)
/mnt/nand1-1 # hcitool -i hci0 lecc 78:C5:E5:6E:53:B2
Connection handle 0
/mnt/nand1-1 # gatttool -i hci0 -b 78:C5:E5:6E:53:B2 –primary
l2cap_bind: Success (0)