LXC Bluetooth Image

This article decribes the usage of the Bluetooth BLE 4.2 inteface on a NB800 router insinde of a LXC virtualisation container.

Requirements

Beside of a NB800 Router, you will need the correct LXC Container file to run Bluetooth on your router. This file can be downloaded here (debian-jessie-bluetooth.tar.xz; Size 54.6MB; Checksum b3907135c41721a70cfbd72cc2873cda).

Beside that, you will need a virtualization licence to run LXC container. You can Contact support for further informations.

Configuration

  • If you are using Windows to set up your router, use f.e. WinSCP to connect to your routers file system.
  • The standard IP is 192.168.1.1, the user name is root, for password just hit enter as you didn't set up a password yet. On your router, navigate to /mnt/storage0/lxc.
  • Take the Debian-Jessie-bluetooth.tar-file you downloaded and copy it in this folder.
  • Open a SSH or Telnet program or use your root shell and connect to your router. Again, the IP is 192.168.1.1, the user is root, for password just press enter.
  • To navigate to the folder where you uploaded your image file to, enter
cd /mnt/storage0/lxc
  • Enter
mkdir guest0

to create a new guest0 folder for your new LXC container.

tar -xJvf debian-jessie-bluetooth.tar.gz -C /mnt/storage0/lxc/guest0
  • Extract the tar file to the guest0 folder.
  • To add a new virtualization profile in the router GUI, go to System - Virtualization

  • Enable the Administrative Status and click on the Plus button to add a new guest for LXC Containers.

  • Set up this LXC config for your needs, make sure that you enable the BLUEZ1 module in the Devices menu.

  • Switch back to your shell and reconnect to your router. The user name is still root, but when asked for the password, use the one you set when configuring your router in your web browser.
  • Go back to your LXC folder and enter
chmod 755 -R guest0

to give the guest0-container the correct right to function properly.

Container

  • Normally, the LXC container is started automaticly when you create a new guest in the router GUI. To check this up, enter
lxc-info -n guest0

USER
~ $ lxc-info -n guest0 Name: guest0 State: RUNNING PID: 3072 IP: 192.168.240.1 CPU use: 48.65 seconds Memory use: 8.51 MiB Link: virt0 TX bytes: 1.42 KiB RX bytes: 1.37 KiB Total bytes: 2.79 KiB ~ $

  • If the container is not running, enter
/etc/init.d/virt start

to start it manually.

  • To enter the LXC container type
lxc-attach -n guest0

USER
~ $ lxc-attach -n guest0 root@jessie:~#

Testing

  • In the container, enter
cd

to change to the containers root folder and

./start-bluetooth.sh

USER
root@jessie:~# ./start-bluetooth.sh Found a Texas Instruments' chip! Firmware file : /lib/firmware/ti-connectivity/TIInit_11.8.32.bts Loaded BTS script version 1 texas: changing baud rate to 3000000, flow control to 1 Device setup complete

to start the bluetooth starting script. If everything works correctly, you will get a confirmation like in the picture.

  • When everything is set up correctly, for example, you can use commands like
hcitool scan

USER
root@jessie:~# hcitool scan Scanning …

      6C:4D:73:E3:31:AA       Phone
    

to scan your surrounding for active bluetooth devices.