This guide will show how to set up Linux using the BlueZ Bluetooth stack to connect to the serial port on the Airconsole 2 via Bluetooth EDR.


Airconsole uses Bluetooth EDR 2.1+ with Secure Simple Pairing.


Note: the examples below wre done using Ubuntu 14.04


Creating an Ad-Hoc Connection For Testing


Make sure Bluetooth is enabled and turned on - go to the System Settings applet, click Bluetooth, and ensure the slider at the top of the screen is set to "On"



Open a Terminal window - either search for Terminal in the search function of the Dash or alternatively use the keyboard shortcut Ctrl-Alt-T


First check to see to see the details of your Bluetooth adapter using the hciconfig tool. In this case our Bluetooth has device name "hci0"



We now need to make sure Secure Simple Pairing is enabled and put the adapter into Page & Inquiry scan mode.

sudo hciconfig hci0 sspmode 1

sudo hciconfig hci0 piscan


Verify that the settings have been set using "hciconfig hci0 sspmode" and "hciconfig hci0"



Once these settings are in place, we can scan for the Airconsole to determine its MAC/BDADDR. Use the command hcitool scan



In this case the BDADDR is 02:B2:07:00:AA:EF - the value will be different for your Airconsole.


You now need to add the serial port service to Service Discovery Protocol using the command "sudo sdptool add SP"


You can now initiate the Bluetooth serial connection using the command "sudo rfcomm connect /dev/rfcomm0 02:B2:07:00:AA:EF" (note replace the Mac with the value you obtained above for your Airconsole)



You will now have a virtual serial device /dev/rfcomm0 that can be used by normal terminal programs that connect to serial ports. The example here uses gtkterm but you could use screen, etc.





Creating a More Permanent Setup


The example above created an ad-hoc connection - this part of the guide shows how to edit your configuration files to make the connection more permanent.


Open a terminal and edit the file /etc/bluetooth/rfcomm.conf


You will need to set the following settings

rfcomm0 {

  bind: yes;

  device: <Your Airconsole BDADDR>;

  channel 1;

}


See the screenshot



After editing the file you should restart the Bluetooth service (or reboot)

sudo service bluetooth restart


You will now have a device node /dev/rfcomm0 which will map to the Airconsole serial port every time your computer boots.


The permissions on /dev/rfcomm0 allow users of the "dialout" group to connect. You can add yourself to this group to gain access to the serial port without root access. Use the command "sudo useradd myusername dialout". After adding yourself into the dialout group you will need to log in again to ensure that group membership has taken effect.




If you still get permission denied errors it may be because of a conflict with ModemManager obtaining a lock on the device. You can remove ModemManager using the command: "sudo apt-get purge modemmanager"