2012/05/12

Adding Bluetooth support to the TonidoPlug2


I'm planning to use my TonidoPlug2 (TP2) for reading out the electricity production of my solar panels. I attached a very small USB bluetooth dongle to my TP2. The USB bluetooth device is detected, but the default kernel has no bluetooth support:
root@TonidoPlug2:~# lsusb 
... 
Bus 001 Device 003: ID 0a5c:4500 Broadcom Corp. BCM2046B1 USB 2.0 Hub (part of BCM2046 Bluetooth) 
... 
The only solution to this problem is to build a new TP2 kernel with bluetooth enabled. The next section details the specific steps that did the trick for me.
Important note: Do NOT change the kernel on the internal flash memory as it might brick your device! Configure your TP2 to boot from the SATA HD first. I created a dedicated 32GB boot partition on my SATA device. Details:
Once you are booting from the SATA HD, you can proceed with the instructions below.

Building a TP2 kernel with bluetooth
The arm-kernel can be built on a linux desktop. I used my regular Ubuntu laptop.
First start with building a normal TP2 kernel:
After you built the kernel and modules you can enable bluetooth by modifying the .config file:
   make menuconfig 
  • Options to enable: (toggle by pressing 'space' until an * or M appears)
    • Networking → <*>Bluetooth subsystem support (CONFIG_BT)
    • Networking → Bluetooth subsystem support → <*>L2CAP protocol support (CONFIG_BT_L2CAP)
    • Networking → Bluetooth subsystem support → <*>SCO links support (CONFIG_BT_SCO)
    • Networking → Bluetooth subsystem support → <*>RFCOMM protocol support (CONFIG_BT_RFCOMM)
    • Networking → Bluetooth subsystem support → [*]RFCOMM TTY support (CONFIG_BT_RFCOMM_TTY)
    • Networking → Bluetooth subsystem support → <*>BNEP protocol support (CONFIG_BT_BNEP)
    • Networking → Bluetooth subsystem support → <*>HID protocol support (CONFIG_BT_HID)
    • Networking → Bluetooth subsystem support → Bluetooth device drivers → HCI USB driver (CONFIG_BT_HCIUSB)
  • this is how my .config file was modified:
    ~/tonido/kernel-2.6.31$ diff .config.old .config 
    4c4 
    < # Sat May 12 21:21:58 2012 
    --- 
    > # Sat May 12 22:24:11 2012 
    654c654,673 
    < # CONFIG_BT is not set 
    --- 
    > CONFIG_BT=y 
    > CONFIG_BT_L2CAP=y 
    > CONFIG_BT_SCO=y 
    > CONFIG_BT_RFCOMM=y 
    > CONFIG_BT_RFCOMM_TTY=y 
    > CONFIG_BT_BNEP=y 
    > # CONFIG_BT_BNEP_MC_FILTER is not set 
    > # CONFIG_BT_BNEP_PROTO_FILTER is not set 
    > CONFIG_BT_HIDP=y 
    >  
    > # 
    > # Bluetooth device drivers 
    > # 
    > CONFIG_BT_HCIBTUSB=m 
    > # CONFIG_BT_HCIBTSDIO is not set 
    > # CONFIG_BT_HCIUART is not set 
    > # CONFIG_BT_HCIBCM203X is not set 
    > # CONFIG_BT_HCIBPA10X is not set 
    > # CONFIG_BT_HCIBFUSB is not set 
    > # CONFIG_BT_HCIVHCI is not set 
    1351a1371,1372 
    > CONFIG_HID_APPLE=y 
    > CONFIG_HID_WACOM=y 
    
You can continue with the instructions for building a TP2 kernel at step 15:
make uImage 
... 
Some attention points with the last activation step:
  • remove two unnecessary symlinks before running scp:
    ~/tonido/kernel-2.6.31$ rm ../current_kernel/lib/modules/2.6.31.8-topkick1281p2-001-004-20101214/build 
    ~/tonido/kernel-2.6.31$ rm ../current_kernel/lib/modules/2.6.31.8-topkick1281p2-001-004-20101214/source 
    
  • run scp (don't forget the -r for a directory):
    ~/tonido/kernel-2.6.31$ scp ../current_kernel/boot/uImage root@tp2-ip:/boot 
    ~/tonido/kernel-2.6.31$ scp -r ../current_kernel/lib/modules root@tp2-ip:/lib/ 
    
  • double-check if all transfers were OK before rebooting
If the TP2 booted successfully you can now enable and test bluetooth:
  • apt-get install bluez
  • test with hcitool:
    root@TonidoPlug2:~# hcitool scan 
    Scanning ... 
     E4:D5:3D:EB:EA:E4 ubuntu-0 
     00:80:25:1F:9A:F4 SMA001d SN: ... 
    
Background info:
Post a Comment