24 BlueZ Pairing

V0.0.1

24.1 Histroy

  • 2014-08-20, rayoslee, release V0.0.1

24.2 FAQ

  1. How to pairing bluetooth mouse(not BLE ver.) in ubuntu ?
    • Python version
      • ./simple-agent hci0 00:07:61:DC:37:8D (or bluez-simple-agent) and give 0000 PIN Code
      • ./test-device trusted 00:07:61:DC:37:8D yes (or bluez-test-device)
      • ./test-input connect 00:07:61:DC:37:8D (or bluez-test-input)
      • now you can use bluetooth mouse.
    • C version (not available until now)
      • ./agent ‘0000’ 00:07:61:DC:37:8D (or bluetooth-agent)
  2. How to build “pairing” libraries for S605-32’s bluez ?
    • Set environment variable

      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 NM_TOOL=$TOOLCHAIN_PATH/bin/arm-linux-nm
      export LD_TOOL=$TOOLCHAIN_PATH/bin/arm-linux-ld
      
      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
    • Config expat-2.0.1

       ./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"
    • Config dbus-1.4.18

      rm -f arm-linux.cache
      echo 'ac_cv_have_abstract_sockets=yes'>arm-linux.cache
      
      LIBS="-liconv" \
      ./configure --prefix=$INSTALL_PATH --host=arm-linux --enable-static \
      NM=nm CC="$CC_TOOL -I$INSTALL_PATH/include -L$INSTALL_PATH/lib" \
      AR="$AR_TOOL" \
      RANLIB="$RANLIB_TOOL" \
      LD="$LD_TOOL" \
      --cache-file=arm-linux.cache --with-x=no \
      --with-system-pid-file=/var/run/dbus/pid \
      --with-system-socket=/var/run/dbus/system_bus_socket
    • Config gettext-0.15

      ./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"
    • Config libiconv-1.13.1

      ./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"
    • Config libffi-3.0.13

      ./configure --prefix=$INSTALL_PATH --host=arm-linux \
      CC="$CC_TOOL -I$INSTALL_PATH/include -L$INSTALL_PATH/lib" \
      AR="$AR_TOOL" \
      RANLIB="$RANLIB_TOOL"
    • Config readline-6.2

      ./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"
    • Config Python-2.7.3

      ./configure
      sudo make python Parser/pgen
      mv python hostpython
      mv Parser/pgen Parser/hostpgen
      sudo make distclean
      cp ../"Python-2.7.3-xcompile.patch" . 
      patch -p1 < Python-2.7.3-xcompile.patch
      
      CC=$CC_TOOL CXX=$CXX_TOOL AR=$AR_TOOL RANLIB=$RANLIB_TOOL LD=$LD_TOOL ./configure --host=arm-linux --build=x86_64-linux-gnu \
      --prefix=$INSTALL_PATH --exec-prefix=$BLUEZ_EXEC_PATH \
      -cache-file=arm-linux.cache \
      LIBS="-L$INSTALL_PATH/lib -lffi" \
      CFLAGS="-I$INSTALL_PATH/lib/libffi-3.0.13/include -I$INSTALL_PATH/include" \
      NM=$NM_TOOL -disable-ipv6
    • Config glib-2.28.6

      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 --enable-debug=no \
      CC="$CC_TOOL -I$INSTALL_PATH/include -L$INSTALL_PATH/lib" \
      AR="$AR_TOOL" \
      RANLIB="$RANLIB_TOOL"
    • Config libusb-0.1.12

      ./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" 
    • Config ncurses-5.7

      ./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"  
    • Config readline-6.2

      ./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"
    • Config bluez-4.91

      ./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 --enable-test --disable-cups \
      --disable-audio --disable-alsa --disable-pie --with-gnu-ld \
      READLINE_CFLAGS="-I$INSTALL_PATH/include" READLINE_LIBS="-L$INSTALL_PATH/lib -lreadline" \
      LIBS="-lncurses"
    • Config bluez-hcidump-2.5

      ./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"
    • Config dbus-glib-0.90

      rm -f arm-linux.cache
      
      echo ac_cv_func_posix_getpwnam_r=yes > arm-linux.cache
      echo ac_cv_have_abstract_sockets=yes >> arm-linux.cache
      
      ./configure --prefix=$INSTALL_PATH --host=arm-linux \
      LIBS="-liconv" \
      CC="$CC_TOOL -I$INSTALL_PATH/include -L$INSTALL_PATH/lib" \
      AR="$AR_TOOL" CXX="$CXX_TOOL" \
      RANLIB="$RANLIB_TOOL" \
      --with-xml=expat \
      --with-dbus-binding-tool=$PWD/dbus/.libs/dbus-binding-tool \
      --cache-file=arm-linux.cache 
      
      cat dbus/Makefile | sed -n '373p'
      cat dbus/Makefile | sed '373c SUBDIRS = . #examples' > dbus/M.bak
      cp dbus/M.bak dbus/Makefile
      
      cat Makefile | sed -n '339p'
      cat Makefile | sed '339c SUBDIRS = dbus test doc' > M.bak
      cp M.bak Makefile                 
      cat dbus/Makefile | sed -n '373p' 
      cat Makefile | sed -n '339p'
      echo -e "replace ok!\n"
    • Config dbus-python-0.84.0

      ./configure --prefix=$INSTALL_PATH --host=arm-linux \
      CC="$CC_TOOL -I$INSTALL_PATH/include -L$INSTALL_PATH/lib -I$INSTALL_PATH/include/python2.7" \
      AR="$AR_TOOL" RANLIB="$RANLIB_TOOL"
    • Config PYGOBJECT_2_28_6

      ./autogen.sh                 
      ./configure --prefix=$INSTALL_PATH --host=arm-linux \
      CC="$CC_TOOL -I$INSTALL_PATH/include -L$INSTALL_PATH/lib -I$INSTALL_PATH/include/python2.7" \
      AR="$AR_TOOL" \
      RANLIB="$RANLIB_TOOL" --enable-introspection=no
    • Config all libs and make and make install. About Python, however, we use the script as the following

      sudo make HOSTPYTHON=./hostpython HOSTPGEN=./Parser/hostpgen
      CROSS_COMPILE=arm-linux- CROSS_COMPILE_TARGET=yes HOSTARCH=arm-linux BUILDARCH=x86_64-linux-gnu

      sudo make install HOSTPYTHON=./hostpython HOSTPGEN=./Parser/hostpgen
      CROSS_COMPILE=arm-linux- CROSS_COMPILE_TARGET=yes HOSTARCH=arm-linux BUILDARCH=x86_64-linux-gnu

  3. How to fix Failed to start message bus: Could not get UID and GID for username “messagebus” issues in S605-32 when using dbus-daemon –system?
    • Modify /etc/group in BSP/initramfs
      +++messagebus:x:105
    • Modify /etc/passwd in BSP/initramfs
      +++messagebus:x:102:105::/var/run/dbus:
    • Modify /etc/gshadow in BSP/initramfs
      +++messagebus:!::
    • Rebuld kernel!
  4. How to fix Can’t get default adapter. The name org.bluez was not provided by any .service files issues in S605-32 when using ./agent? (to be continued)

  5. How to fix python: can’t resolve symbol ‘PyUnicodeUCS4_AsEncodedString’ issues in S605-32 when using import dbus? (to be continued)

  6. How to fix python: can’t resolve symbol ‘Py_InitModule4_64’ issues in S605-32 when using import gobject? (to be continued)