Jump to content

How To install Bluetooth on the Tetra


r3dfish

Recommended Posts

# The Goal:

I would like to make a pineapple module that uses a bluetooth radio plugged into the USB port.  The goal for version 1.0 is to simply list bluetooth devices in range.  I chose the Tetra because of its storage space, I originally tried this on the nano, but because there is only ~2MB of storage, it becomes difficult to install the kernel modules and bluetooth libraries to the SD card, so once I get it working on the Tetra I will figure out how to deploy the same solution to the nano.

# The Setup:

Wifi Pineapple Tetra running version 1.0.2 of the firmware.  I started this with a fresh install of the firmware by performing the ‘firmware recovery’ steps from this page: https://www.wifipineapple.com/pages/faq (except your IP address needs to be 192.168.1.2).

# Update the opkg cache:

root@Pineapple:~# opkg update

# Install kmod-bluetooth

Next we need to install the bluetooth kernel module, but the one in the pineapple repos is out of date.  running ‘opkg list | grep bluetooth’ shows version 3.18.20-1 while ‘uname -r’ shows 3.18.23.  If you run ‘opkg install kmod-bluetooth’ you will get an error that complains about kernel version mismatch, ending with the following:

If the above errors were only about a kernel version missmatch, please ignore them. The package was installed successfully.

Which is true, the new module is installed in /lib/modules/3.18.20/ while all of the other kernel modules are installed in /lib/modules/3.18.23.  Instead, lets just get the newer version of the bluetooth kernel module straight from the openwrt repo (which can be found here) :

root@Pineapple:~# wget https://downloads.openwrt.org/latest/ar71xx/generic/packa
ges/base/kmod-bluetooth_3.18.23-1_ar71xx.ipk

Now well install the ipk we just downloaded:

root@Pineapple:~# opkg install ./kmod-bluetooth_3.18.23-1_ar71xx.ipk

This command still complains about a kernel mismatch, so well tell opkg to ignore dependencies:

root@Pineapple:~# opkg –nodeps install ./kmod-bluetooth_3.18.23-1_ar71xx.ipk

# Install the bluez libraries and utilities

This package will give us commands like hciconfig and hcitool

root@Pineapple:~# opkg install bluez-libs
root@Pineapple:~# opkg install bluez-utils

At this point we should have the ‘hciconfig’ and ‘hcitool’ commands available to us, but they will error out:

root@Pineapple:~# hciconfig -a
Can’t open HCI socket.: Address family not supported by protocol
root@Pineapple:~# hcitool dev
Devices:
root@Pineapple:~#

# Insert the kernel modules

root@Pineapple:~# cd /lib/modules/3.18.23/
root@Pineapple:/lib/modules/3.18.23# insmod ./bluetooth.ko
root@Pineapple:/lib/modules/3.18.23# insmod ./btusb.ko
root@Pineapple:/lib/modules/3.18.23# insmod ./rfcomm.ko

# Plugging in the Bluetooth USB dongle

This part sucks.  For some reason, even when using the 12 volt 2 amp power supply that the tetra came with, when I plug in a bluetooth dongle, the device resets.  All the interfaces go down, my computer drops from the pineapples wireless network, and the pineapple reinitializes all of its interfaces.  If you watch the available networks, you will even see the ‘Pineapple_XXYY’ unencrypted network get thrown up then immediately taken back down before the management network comes back up.  The problem with this is now the kernel has been reloaded, so all of the modules we just loaded are no longer loaded.  After the pineapple is done rebooting, reconnect to it.

# Make sure we can see the USB dongle

root@Pineapple:~# lsusb
Bus 001 Device 002: ID 0a12:0001 Cambridge Silicon Radio, Ltd Bluetooth Dongle (HCI mode)
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub

# Reload the kernel modules

root@Pineapple:~# cd /lib/modules/3.18.23/
root@Pineapple:/lib/modules/3.18.23# insmod ./bluetooth.ko
root@Pineapple:/lib/modules/3.18.23# insmod ./btusb.ko
root@Pineapple:/lib/modules/3.18.23# insmod ./rfcomm.ko

# Check out the hci0 interface

root@Pineapple:/lib/modules/3.18.23# hciconfig -a
hci0: Type: BR/EDR Bus: USB
BD Address: 00:00:00:00:00:00 ACL MTU: 0:0 SCO MTU: 0:0
DOWN
RX bytes:0 acl:0 sco:0 events:0 errors:0
TX bytes:0 acl:0 sco:0 commands:1 errors:0
Features: 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00
Packet type: DM1 DH1 HV1
Link policy:
Link mode: SLAVE ACCEPT

# Bring the interface up

Now we can see the interface, but when we try to bring it up, the pineapple can’t initialize the interface.

root@Pineapple:/lib/modules/3.18.23# hciconfig hci0 up
Can’t init device hci0: Connection timed out (145)

# Next Step

This is as far as I have gotten.  Next I’ll work on figuring out why the interface cant initialize, and then I should be able to build an infusion that will bring bluetooth to the pineapple.  Stay tuned.

Link to comment
Share on other sites

Wondering what info you want to gsther with a normal,bluetooth device? Hcitool scan or hcitool inq will only list devices that are set as discoverable..

I like your detailled progress post... just wondering what you plan to get out of the end result..

And yes! A powered usb hub should do the trick!

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...