USB bluetooth setup

rough draft of configuring usb bluetooth connection


first install your linux friendy usb bluetooth dongle...

1/ interupt the OVmenu at startup and then exit to the shell so you get a command prompt


2/ check the usb bluetooth device recognised

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

you can see mine is the Cambridge Silicon Radio one.

3/ follow the steps/ enter commands after the #...
root@openvario-57lvds:~# systemctl enable bluetooth.service
root@openvario-57lvds:~# systemctl start bluetooth.service
root@openvario-57lvds:~# rfkill unblock bluetooth
root@openvario-57lvds:~# hciconfig hci0 up
root@openvario-57lvds:~# hcitool scan
Scanning ...
        98:D3:31:30:0D:8B       SoarTronic_BT1n 239

here its detected my soartronic module , yay !


4/ now edit the rfcomm.conf file so it can pair it every time

root@openvario-57lvds:~# nano /etc/bluetooth/rfcomm.conf

make your file look my edited file below, but change the device address to reflect yours... 
you can change the comment part to ;)

#
# RFCOMM configuration file.
#

rfcomm0 {
#       # Automatically bind the device at startup
        bind yes;
#
#       # Bluetooth address of the device
        device 98:D3:31:30:0D:8B;
#
#       # RFCOMM channel for the connection
        channel 1;
#
#       # Description of the connection
        comment "TOBY SOARTRONIC";
}

5/ for each detected USB bluetooth device, there is a driver file created automatically, this is in a dir using its MAC address as the name
So check its there,

root@openvario-57lvds:~# ls /var/lib/bluetooth/
00:15:83:3D:0A:57

My bluetooth device has this MACaddress, and this is the dir it created, you can see the contents with,

root@openvario-57lvds:~# ls /var/lib/bluetooth/00:15:83:3D:0A:57
classes   config    eir       lastseen


6/add the pincode to pair to your device in this directory in a file that you create

~# echo "98:D3:31:30:0D:8B 1234" >> /var/lib/bluetooth/00:15:83:3D:0A:57/pincodes

Can now see the file we created
root@openvario-57lvds:~# ls /var/lib/bluetooth/00:15:83:3D:0A:57
classes   config    eir       lastseen  pincodes

7/ now test connect the dongle to your bluetooth source

root@openvario-57lvds:~# rfcomm connect 0
Connected /dev/rfcomm0 to 98:D3:31:30:0D:8B on channel 1
Press CTRL-C for hangup

If you get this then you have paired successfully !
 do the CTRL -C to exit out

8/ edit the ovmenu script to autorun pairing..

root@openvario-57lvds:~# nano /opt/bin/ovmenu-ng.sh

and add the lines

# run bluetooth rfcomm to catch bt when activated
rfcomm bind all

just before the 

main_menu () {
while true

section..

Save the file, ctrl X

9/ reboot the OV with CTRL-ALT-DEL

10/ when OV restarts, let it get to Xcsoar

make sure your bluetooth device is on and transmitting, connected to your flarm

11/ from XCSoar menu, go to config-devices
add a new device, 
select rfcomm0 as the device
suggest baud rate as 19200 ( it should match your BT transmitter )
driver FLARM

12/ thats it, the flarm data should be appearing on your new device, 





No comments:

Post a Comment