Bluetooth on Intel® Galileo - Bluetooth tethering

Following up the series of my recent Intel® Galileo blogs (see Using Intel® Galileo as access point, and  WiFi access on Intel® Galileo) we'll focus on Bluetooth this time. We'll use the same Intel® Centrino™ Wireless-N 135 adapter used in the other blogs which supports WiFi and Bluetooth in one adapter. As an example of Bluetooth functionality internet via Bluetooth Network Access Point (NAP) is shown


We run a Yocto* iot-devkit Linux with BlueZ 5* enabled. BlueZ 5 comes with the bluetoothctl command line tool as well with test scripts which we will use in the following. 


Like connmanctl (see other posts) for general connectivity bluetoothctl combines various command line tools to control Bluetooth. At the end it is a frontend for BlueZ DBus communication which all obviously could be achieved by direct DBus communication as well. Bluetoothctl comes with a brief help on the provided commands:

# bluetoothctl 

	[NEW] Controller 0C:D2:92:6D:E3:B2 clanton [default]

	[bluetooth]# help

	Available commands:

	  list                       List available controllers

	  show [ctrl]                Controller information


	  discoverable <on/off>      Set controller discoverable mode

	  agent <on/off/capability>  Enable/disable agent with given capability

  default-agent              Set agent as the default one


Let's check our adapter:

	[bluetooth]# show

	Controller 0C:D2:92:6D:E3:B2

	    Name: clanton

	    Alias: clanton

	    Class: 0x220104

	    Powered: yes

	    Discoverable: no

	    Pairable: yes

	    UUID: PnP Information           (00001200-0000-1000-8000-00805f9b34fb)

	    UUID: Generic Access Profile    (00001800-0000-1000-8000-00805f9b34fb)

	    UUID: Generic Attribute Profile (00001801-0000-1000-8000-00805f9b34fb)

	    UUID: A/V Remote Control        (0000110e-0000-1000-8000-00805f9b34fb)

	    UUID: A/V Remote Control Target (0000110c-0000-1000-8000-00805f9b34fb)

	    UUID: Handsfree                 (0000111e-0000-1000-8000-00805f9b34fb)

	    UUID: NAP                       (00001116-0000-1000-8000-00805f9b34fb)

	    Modalias: usb:v1D6Bp0246d0512

	    Discovering: no


Ok, it's powered but not yet discoverable so let's make it discoverable:

	[bluetooth]# discoverable on

	Changing discoverable on succeeded

	[CHG] Controller 0C:D2:92:6D:E3:B2 Discoverable: yes

	[bluetooth]# show

	Controller 0C:D2:92:6D:E3:B2

	    Name: clanton

	    Alias: clanton

	    Class: 0x220104

	    Powered: yes

	    Discoverable: yes


Ok, next step is to pair with another device. First we will have to define which type of I/O our device provides.Checking in BlueZ* agent.c we find following options








For the exercise here we will set the default agent simply to "NoInputNoOutput" - For a production system you should go for some more security:

	[bluetooth]# agent NoInputNoOutput

	Agent registered

	[bluetooth]# default-agent

	Default agent request successful

Bluetooth tethering

In order to demonstrate Bluetooth tethering we use the test-nap python script coming with BlueZ tests. It has to be started before Bluetooth pairing is initiated in order to expose the PAN profile to the remote side.

Update [June 17]

Even easier to test: 

connmanctl tether bluetooth on

switches on bluetooth tethering


Initialization from the remote side


After setting Intel® Galileo discoverable you should be able to see it when scanning for Bluetooth devices. For this example we use an Intel® Atom Z2580 based Lenovo K900* Android* 4.2.1 mobile. Going to the Settings -> Bluetooth tab there and selecting "Clanton", the pairing process is initiated:

	[NEW] Device EC:89:F5:00:52:AB Lenovo K900

	Request authorization

	[agent] Accept pairing (yes/no): yes


	[CHG] Device EC:89:F5:00:52:AB Paired: yes

	Authorize service

	[agent] Authorize service 0000111e-0000-1000-8000-00805f9b34fb (yes/no): yes

	Authorize service

	[agent] Authorize service 0000000f-0000-1000-8000-00805f9b34fb (yes/no): yes


where we have to accept the pairing by typing in "yes". Hence, the agent within bluetoothctl still requires some interaction - if you really want no interaction you would need to go for your own agent. You may use the simple-agent test script as starting point to write your own.

Initialization from Intel® Galileo

Similarly you could initiate the pairing from Intel® Galileo side. Within bluetoothct this is done by 

# pair <remote MAC - here EC:89:F5:00:52:AB>

	Attempting to pair with EC:89:F5:00:52:AB

[CHG] Device EC:89:F5:00:52:AB Connected: yes

	[CHG] Device EC:89:F5:00:52:AB Modalias: bluetooth:v000Fp1200d1436

	[CHG] Device EC:89:F5:00:52:AB UUIDs:


[CHG] Device EC:89:F5:00:52:AB Paired: yes



Selecting PAN access

The final stage is to select "Internet access" in the profiles tab. Within bluetoothctl you have to accept this request. You can now access internet via Bluetooth on Intel® Galileo.

Per informazioni più dettagliate sulle ottimizzazioni basate su compilatore, vedere il nostro Avviso sull'ottimizzazione.