VAR-SOM-MX6 Bluetooth: Difference between revisions
No edit summary |
No edit summary |
||
Line 1: | Line 1: | ||
{{PageHeader|VAR-SOM-MX6 - Bluetooth}} {{DocImage|category1=VAR-SOM-MX6|category2=Yocto}} __toc__ | {{PageHeader|VAR-SOM-MX6 - Bluetooth}} {{DocImage|category1=VAR-SOM-MX6|category2=Yocto}} __toc__ | ||
= Bluetooth boot messages = | = Bluetooth boot messages = |
Revision as of 15:41, 23 December 2015
Bluetooth boot messages
During boot the following Bluetooth kernel messages are received:
$ dmesg | grep -i bluetooth [ 0.233230] Bluetooth: Core ver 2.18 [ 0.233273] Bluetooth: HCI device and connection manager initialized [ 0.233286] Bluetooth: HCI socket layer initialized [ 0.233298] Bluetooth: L2CAP socket layer initialized [ 0.233331] Bluetooth: SCO socket layer initialized [ 1.963274] Bluetooth: HCI UART driver ver 2.2 [ 1.966442] Bluetooth: HCI H4 protocol initialized [ 1.969938] Bluetooth: HCI BCSP protocol initialized [ 1.973606] Bluetooth: HCILL protocol initialized [ 1.977029] Bluetooth: HCI Three-wire UART (H5) protocol initialized [ 3.313905] Bluetooth: RFCOMM TTY layer initialized [ 3.317503] Bluetooth: RFCOMM socket layer initialized [ 3.321376] Bluetooth: RFCOMM ver 1.11 [ 3.323859] Bluetooth: BNEP (Ethernet Emulation) ver 1.3 [ 3.327876] Bluetooth: BNEP filters: protocol multicast [ 3.331814] Bluetooth: BNEP socket layer initialized [ 3.335498] Bluetooth: HIDP (Human Interface Emulation) ver 1.2 [ 3.340131] Bluetooth: HIDP socket layer initialized
Device identification
After the File system is up 'hciconfig' should show the connected bluetooth module.
root@var-som-mx6:~# hciconfig hci0: Type: BR/EDR Bus: UART BD Address: 50:72:24:11:EF:B0 ACL MTU: 1021:6 SCO MTU: 180:4 UP RUNNING PSCAN RX bytes:701 acl:0 sco:0 events:44 errors:0 TX bytes:2233 acl:0 sco:0 commands:44 errors:0
The hcitool can be used to show the Bluetooth MAC address of the Bluetooth module with the respective hci connection. Type help to show commands.
root@var-som-mx6:~# hcitool dev Devices: hci0 50:72:24:11:EF:B0
Managing bluetooth
You can manage bluetooth with bluetoothctl, type 'bluetoothctl' and enter the interface. Type help to show commands.
For connecting a device do the following:
$ bluetoothctl [bluetooth]# power on [bluetooth]# default-agent [bluetooth]# pairable on Push the connect button in the device [bluetooth]# scan on Copy mac address [bluetooth]# scan off [bluetooth]# pair <mac address> Approve pairing on Device if required [bluetooth]# trust <mac address> [bluetooth]# connect <mac address> [bluetooth]# quit
For example when connecting a microsoft bluetooth mouse the following is done:
root@var-som-mx6:~# bluetoothctl [NEW] Controller 50:72:24:11:EF:B0 BlueZ 5.28 [default] [bluetooth]# power on Changing power on succeeded [bluetooth]# default-agent No agent is registered [bluetooth]# pairable on Changing pairable on succeeded [bluetooth]# scan on Discovery started [CHG] Controller 50:72:24:11:EF:B0 Discovering: yes [NEW] Device 00:1D:D8:39:93:46 Microsoft Bluetooth Notebook Mouse 5000 [bluetooth]# scan off [CHG] Device 00:1D:D8:39:93:46 RSSI is nil Discovery stopped [CHG] Controller 50:72:24:11:EF:B0 Discovering: no [bluetooth]# pair 00:1D:D8:39:93:46 Attempting to pair with 00:1D:D8:39:93:46 [CHG] Device 00:1D:D8:39:93:46 Connected: yes [CHG] Device 00:1D:D8:39:93:46 Modalias: usb:v045Ep0700d0100 [CHG] Device 00:1D:D8:39:93:46 UUIDs: 00001000-0000-1000-8000-00805f9b34fb 00001124-0000-1000-8000-00805f9b34fb 00001200-0000-1000-8000-00805f9b34fb [CHG] Device 00:1D:D8:39:93:46 Paired: yes Pairing successful [CHG] Device 00:1D:D8:39:93:46 Connected: no [bluetooth]# trust 00:1D:D8:39:93:46 [CHG] Device 00:1D:D8:39:93:46 Trusted: yes Changing 00:1D:D8:39:93:46 trust succeeded [bluetooth]# connect 00:1D:D8:39:93:46 Attempting to connect to 00:1D:D8:39:93:46 [CHG] Device 00:1D:D8:39:93:46 Connected: yes [bluetooth]# hid-generic 0005:045E:0700.0001: unknown main item tag 0x0 input: Microsoft Bluetooth Notebook Mouse 5000 as /devices/soc0/soc.0/2100000.aips-bus/21e8000.serial/tty/ttymxc1/hci0/hci0:1/0005:045E:0700.0001/input/input1 Connection successful [bhid-generic 0005:045E:0700.0001: input: BLUETOOTH HID v1.00 Mouse [Microsoft Bluetooth Notebook Mouse 5000] on 50:72:24:11:ef:b0 [bluetooth]# quit [DEL] Controller 50:72:24:11:EF:B0 BlueZ 5.28 [default] root@var-som-mx6:~#
File Transfer
Sending a file from the board to the bluetooth device using the obex transfer.
1) First, establish connection to the device as described above.
2) Start obex daemon and obexctl. Type help to show commands.
$ export DISPLAY=:0.0 $ /usr/lib/bluez5/bluetooth/obexd & $ obexctl
3) connect to Device
[obex]# connect <mac addr>
4) Send a file from obexctl to the device
[<mac addr>]# send <file>
5) Once it's done, close the session
[<mac addr>]# disconnect [<mac addr>]# quit