VAR-SOM-AM33 Bluetooth Krogoth: Difference between revisions
From Variscite Wiki
(Added BLE commands) |
(Fixed indentation) |
||
Line 125: | Line 125: | ||
Connecting to BLE devices requires different command sequence: | Connecting to BLE devices requires different command sequence: | ||
<pre> | |||
$ btmgmt | $ btmgmt | ||
[mgmt]# power on | [mgmt]# power on | ||
Line 135: | Line 135: | ||
$ gatttool -b <MAC> [-t random] -I | $ gatttool -b <MAC> [-t random] -I | ||
</pre> | |||
For example when connecting to "BLE Peripheral Simulator" on Android phone the following is done:</br> | For example when connecting to "BLE Peripheral Simulator" on Android phone the following is done:</br> | ||
<pre> | |||
root@varsomam33:~# btmgmt | root@varsomam33:~# btmgmt | ||
[mgmt]# info | [mgmt]# info | ||
Line 179: | Line 180: | ||
Indication handle = 0x0003 value: 01 00 ff ff | Indication handle = 0x0003 value: 01 00 ff ff | ||
[74:B9:AB:CF:13:A9][LE]> | [74:B9:AB:CF:13:A9][LE]> | ||
</pre> |
Revision as of 15:21, 20 November 2016
Bluetooth
Bluetooth initialization
Load bluetooth driver
$ modprobe btwilink [ 71.683001] (stc): chnl_id list empty :4 [ 71.686976] (stk) : st_kim_startroot@varsomam33:~# (stk) :ldisc_install = 1 [ 71.856713] (stc): st_tty_open (stk) :line discipline installed [ 71.869458] (stk) :ti-connectivity/TIInit_11.8.32.bts(stk) :change remote baud rate command in firmware [ 71.888650] (stk) :skipping the wait event of change remote baud[ 72.647550] Bluetooth: BNEP (Ethernet Emulation) ver 1.3 [ 72.665758] Bluetooth: BNEP filters: protocol multicast [ 72.685879] Bluetooth: BNEP socket layer initialized [ 72.700329] (stc): add_channel_to_table: id 4 [ 72.704738] (stc): add_channel_to_table: id 2 [ 72.709373] (stc): add_channel_to_table: id 3 [ 72.844898] Bluetooth: RFCOMM TTY layer initialized [ 72.863512] Bluetooth: RFCOMM socket layer initialized [ 72.898377] Bluetooth: RFCOMM ver 1.11 [ 74.746065] (stc): remove_channel_from_table: id 3 [ 74.750912] (stc): remove_channel_from_table: id 2 [ 74.755769] (stc): remove_channel_from_table: id 4 [ 74.762149] (stc): all chnl_ids unregistered [ 74.766525] (stk) :ldisc_install = 0(stc): st_tty_close
Device identification
After the File system is up 'hciconfig' should show the connected bluetooth module.
hciconfig hci0: Type: BR/EDR Bus: UART BD Address: 64:A3:CB:5B:69:F0 ACL MTU: 1021:8 SCO MTU: 64:1 UP RUNNING PSCAN RX bytes:1772 acl:0 sco:0 events:69 errors:0 TX bytes:1152 acl:0 sco:0 commands:65 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@varsomam33:~# hcitool dev Devices: hci0 64:A3:CB:5B:69:F0
Connecting to classic bluetooth devices
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]# agent on [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@varsomam33:~# bluetoothctl [NEW] Controller 78:A5:04:2A:E0:C8 varsomam33 [default] [bluetooth]# power on [ 418.812442] (stc): chnl_id list empty :4 (stk) : st_kim_start [ 418.927451] (stk) :ldisc_install = 1[bluetooth]# (stc): st_tty_open [ 418.986169] (stk) :line discipline installed(stk) :ti-connectivity/TIInit_11.8.32.bts [ 418.999664] (stk) :change remote baud rate command in firmware(stk) :skipping the wait event of change remote baud [ 419.826440] (stc): add_channel_to_table: id 4 [ 419.831116] (stc): add_channel_to_table: id 2 [ 419.835494] (stc): add_channel_to_table: id 3 [CHG] Controller 78:A5:04:2A:E0:C8 Class: 0x200000 Changing power on succeeded [CHG] Controller 78:A5:04:2A:E0:C8 Powered: yes [bluetooth]# agent on Agent 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@varsomam33:~#
Connecting to BLE devices
Connecting to BLE devices requires different command sequence:
$ btmgmt [mgmt]# power on [mgmt]# find Copy MAC address of LE device [mgmt]# quit $ gatttool -b <MAC> [-t random] -I
For example when connecting to "BLE Peripheral Simulator" on Android phone the following is done:
root@varsomam33:~# btmgmt [mgmt]# info Index list with 1 item hci0: Primary controller addr 78:A5:04:2A:E0:C8 version 7 manufacturer 13 class 0x000000 supported settings: powered connectable fast-connectable discoverable bondable link-security ssp br/edr hs le advertising secure-conn debug-keys privacy static-addr current settings: bondable ssp br/edr le secure-conn name varsomam33 short name [mgmt]# power on [mgmt]# [ 79.807814] (stc): chnl_id list empty :4 (stk) : st_kim_start [ 79.923886] (stk) :ldisc_install = 1(stc): st_tty_open [ 79.982113] (stk) :line discipline installed(stk) :ti-connectivity/TIInit_11.8.32.bts [ 79.991772] (stk) :change remote baud rate command in firmware(stk) :skipping the wait event of change remote baud [ 80.559380] (stc): add_channel_to_table: id 4 [ 80.564007] (stc): add_channel_to_table: id 2 [ 80.570047] (stc): add_channel_to_table: id 3 hci0 class of device changed: 0x000000 hci0 Set Powered complete, settings: powered bondable ssp br/edr le secure-conn [mgmt]# find Discovery started hci0 type 7 discovering on hci0 dev_found: 74:B9:AB:CF:13:A9 type LE Random rssi -90 flags 0x0000 AD flags 0x1a name Galaxy S5 hci0 dev_found: 00:1A:7D:DA:71:0B type BR/EDR rssi -79 flags 0x0000 name SMTBT hci0 dev_found: 00:1A:7D:DA:71:11 type BR/EDR rssi -96 flags 0x0001 eir_len 5 confirm_name succeeded for 00:1A:7D:DA:71:11 hci0 type 7 discovering off [mgmt]# quit root@varsomam33:~# gatttool -t random -b 74:B9:AB:CF:13:A9 -I [74:B9:AB:CF:13:A9][LE]> connect Attempting to connect to 74:B9:AB:CF:13:A9 [74:B9:AB:CF:13:A9][LE]> [ 132.648712] NET: Registered protocol family 38 Connection successful Indication handle = 0x0003 value: 01 00 ff ff [74:B9:AB:CF:13:A9][LE]>