Bluetooth

This feature is only available on certain products and models (not available with all devices).

Bluetooth Setup

The device includes BlueZ 4 software used as a Bluetooth stack.  To operate, you must install BlueZ 4 on your Linux computer.

For newer levels of Linux, you may need to find BlueZ 4 outside of the normal software package manager.

You can also use BlueZ 5 with Ubuntu on your Linux machine. You need to set up BlueZ 5 with compatibility mode for BlueZ 4 on your PC.

BlueZ 5 using Ubuntu on Linux Computer – Set Compatibility Mode

To set BlueZ 5 in compatibility mode:

1. Find the file /etc/systemd/system/dbus-org.bluez.service.
2. Change the line by replacing:

ExecStart=/usr/lib/bluetooth/bluetoothd

with

ExecStart=/usr/lib/bluetooth/bluetoothd --compat

3. To restart bluetooth, enter: 

pc: sudo systemctl daemon-reload
pc: sudo systemctl restart bluetooth

4. To change permissions on /var/run/sdp , enter: 

pc: sudo chmod 777 /var/run/sdp

5. If you are using GUI management on your Linux system, verify that Bluetooth is on and set it to visible. Or if you are using the command line, enter: 

pc: sudo hciconfig hci0 piscan

Classic Bluetooth Serial Communications

If you log in through the debug port to the device using Minicom, you need to change the Minicom control character. You can’t have two levels of Minicom and control both with the same character.

You can also use SSH instead.

To change the character in Minicom:

1. Enter the command:

pc: sudo minicom -s

 This command displays the Configuration menu for Minicom.

2.   Under the Configuration, select Screen and keyboard.

3.   Enter the command key: B (the resulting command key is <ctrl> + B).

4.   Select <esc> which returns you to Configuration.

5.   Select Save setup as dfl which sets your recent configuration as default.

6.   Select Exit from Minicom.

Bring up Bluetooth

To bring up Bluetooth using Ubuntu, enter this command:

pc: sudo hciconfig hci0 up

Bluetooth reset

Bluetooth resets automatically on reboot.

To manually reset Bluetooth, enter the following commands:

pc: sudo systemctl daemon-reload
pc: systemctl restart bluetooth

Bluetooth TTY communications with Ubuntu

To use Ubuntu for Bluetooth communications:

1. Enter the command:

pc: sudo hciconfig hci0 up

2. On Ubuntu Linux, determine the bluetooth MAC address.  Enter the command: 

pc: hciconfig

The system displays the following: 

hci0:  Type: BR/EDR  Bus: USB
BD Address: 00:02:72:21:A7:D7  ACL MTU: 1021:7  SCO MTU: 64:1
UP RUNNING PSCAN ISCAN
RX bytes:59680 acl:3203 sco:0 events:1827 errors:0
TX bytes:47076 acl:3264 sco:0 commands:115 errors:0

For this example above, the address is: 00:02:72:21:A7:D7

3. Create a TTY node for Bluetooth communications (for both sides). Enter the following: 

pc: sudo mknod -m 666 /dev/rfcomm0 c 216 0

4. Make Bluetooth discoverable on a scan. Enter: 

pc: sudo /usr/sbin/hciconfig hci0 piscan

5. Add the channel. Enter: 

pc: sudo /usr/bin/sdptool add --channel=22 SP

6. Start RFCOMM to listen for a connection. Enter: 

pc: sudo rfcomm listen /dev/rfcomm0 22 &

7. Now log into the device. Use the MAC address from Ubuntu on the rfcomm command line as in this example. Enter the following: 

mtcdt: /usr/sbin/bluetoothd
mtcdt: hciconfig hci0 up
mtcdt: hcitool scan
mtcdt: mknod -m 666 /dev/rfcomm0 c 216 0
mtcdt: rfcomm connect /dev/rfcomm0 00:02:72:21:A7:D7 22 &

Example output (Bluetooth messages are written to the console): 

[1] 571
Bluetooth: RFCOMM TTY layer initialized
Bluetooth: RFCOMM socket layer initialized
Bluetooth: RFCOMM ver 1.11
Connected /dev/rfcomm0 to 00:02:72:21:A7:D7 on channel 22
Press CTRL-C for hangup

8. Now you list the connections from each side entering the same hcitool con command twice (one for master and one for slave): 

mtcdt: hcitool con
Connections:
< ACL 00:02:72:21:A7:D7 handle 1 state 1 lm MASTER
mtcdt: hcitool con
Connections:
> ACL 00:23:A7:49:5C:D9 handle 11 state 1 lm SLAVE

The other system should now see the connection.

9. Start minicom on the computer and the device: 

pc: sudo minicom -D /dev/rfcomm0
mtcdt: <ctrl>bE  [This turns echo on]
mtcdt: <ctrl>bA  [This adds a line feed]
mtcdt: minicom -D /dev/rfcomm0
mtcdt: <ctrl>aE  [This turns echo on]
mtcdt: <ctrl>aA  [This adds a line feed]

Now you have a TTY connection to communicate.

10. Type a message and watch it appear on the other side.

11. To terminate in minicom, enter:

mtcdt: <ctrl>aX or <ctrl>bX.

12. If you connect to the rfcomm0 device because the interface is in a bad state, reset as shown: 

mtcdt: rfcomm release 0
mtcdt: hciconfig hci0 up
mtcdt: /usr/sbin/hciconfig hci0 piscan

This clears rfcomm0

13. Now enter the appropriate rfcomm command on both sides and the link should come back up.

Classic Bluetooth File Push (sending data)

To do File Push on Bluetooth, you first must verify your computer runs Ubuntu with Bluetooth. Use the Ubuntu system with Bluetooth to receive the data.

Follow these instructions to do File Push:

1. On the device, install the following two packages:

mtcdt: libopenobex1_1.5-r0.0_arm926ejste.ipk
mtcdt: obexftp_0.23-r0.0_arm926ejste.ipk

2. In Ubuntu, under Personal File Sharing Preferences and Receive Files over Bluetooth, check Receive Files in Downloads folder over Bluetooth.

3. In the drop-down, Accept files, select Always and check Notify about received files.

Received files will be in the Downloads directory.

4. Obtain the MAC address of the ubuntu system using this command:

mtcdt: hciconfig

The system displays the following results: 

hci0:  Type: BR/EDR  Bus: USB
BD Address: 5C:F3:70:74:04:AF  ACL MTU: 1021:8  SCO MTU: 64:1
UP RUNNING PSCAN ISCAN
RX bytes:98993 acl:854 sco:0 events:904 errors:0
TX bytes:21459 acl:632 sco:0 commands:289 errors:0

In this case, the MAC address is 5C:F3:70:74:04:AF labeled as BD address.

5. Copy a large file to the device for testing.

mtcdt: cd /boot
mtcdt: scp initrd.img-3.13.0-98-generic root@conduit:/var/volatile

6. On the PC, find the channel number to specify in the list the services of the Ubuntu system. Enter: 

PC: sdptool browse local

 The following results display: 

...
Service Name: OBEX Object Push
Service RecHandle: 0x10008
Service Class ID List:
       "OBEX Object Push" (0x1105)
Protocol Descriptor List:
      "L2CAP" (0x0100)
      "RFCOMM" (0x0003)
           Channel: 9
      "OBEX" (0x0008)
Profile Descriptor List:
   "OBEX Object Push" (0x1105)
           Version: 0x0100
...

Under OBEX Object Push, look for Channel in the listing. In this case, the channel number is 9.

7.To execute the File Push, enter the directory location and the following command including the MAC address and channel number: 

mtcdt: cd /var/volatile
mtcdt: time obexftp -SH -b 5C:F3:70:74:04:AF -B 9 -U none -p linux_3.13.0.orig.tar.gz -o f1

Bring down Bluetooth

To bring down Bluetooth using Ubuntu, enter this command:

pc: sudo hciconfig hci0 down