在本机bash中读取/解析来自BTMON的流输出?

在本机bash中读取/解析来自BTMON的流输出?,bash,shell,bluetooth-lowenergy,hci,Bash,Shell,Bluetooth Lowenergy,Hci,我正在尝试实时解析来自btmon的流输出。一个lescan进程正在后台运行:sudo hcitool lescan& 经过大量测试后,我不知所措,因为当root在第一个会话中执行以下脚本时,: while read -r line; do echo "$line" done < <(btmon 2>&1) sudo btmon 2>&1 Bluetooth monitor ver 5.43 = Note: Linux version 4.14.71+ (armv6l)

我正在尝试实时解析来自
btmon
的流输出。一个
lescan
进程正在后台运行:
sudo hcitool lescan&

经过大量测试后,我不知所措,因为当root在第一个会话中执行以下脚本时,

while read -r line; do
echo "$line"
done < <(btmon 2>&1)
sudo btmon 2>&1

Bluetooth monitor ver 5.43
= Note: Linux version 4.14.71+ (armv6l)                                                                      0.563610
= Note: Bluetooth subsystem version 2.22                                                                     0.563625
= New Index: B8:27:EB:C8:9E:A6 (Primary,UART,hci0)                                                    [hci0] 0.563632
= Open Index: B8:27:EB:C8:9E:A6                                                                       [hci0] 0.563634
= Index Info: B8:27:EB:C8:9E:A6 (Broadcom Corporation)                                                [hci0] 0.563638
@ MGMT Open: bluetoothd (privileged) version 1.14                                                   {0x0001} 0.563644
@ MGMT Open: btmon (privileged) version 1.14                                                        {0x0002} 0.563788
@ MGMT Open: btmon (privileged) version 1.14                                                        {0x0003} 2.149663
@ RAW Open: hcitool (privileged) version 2.22                                                      {0x0004} 11.269034
@ RAW Close: hcitool                                                                               {0x0004} 11.270311
@ RAW Open: hcitool (privileged) version 2.22                                               {0x0004} [hci0] 11.271277
< HCI Command: LE Set Scan Parameters (0x08|0x000b) plen 7                                           [hci0] 11.272202
        Type: Active (0x01)
        Interval: 10.000 msec (0x0010)
        Window: 10.000 msec (0x0010)
        Own address type: Public (0x00)
        Filter policy: Accept all advertisement (0x00)
> HCI Event: Command Complete (0x0e) plen 4                                                          [hci0] 11.272708
      LE Set Scan Parameters (0x08|0x000b) ncmd 1
        Status: Success (0x00)
< HCI Command: LE Set Scan Enable (0x08|0x000c) plen 2                                               [hci0] 11.275396
        Scanning: Enabled (0x01)
        Filter duplicates: Enabled (0x01)
> HCI Event: Command Complete (0x0e) plen 4                                                          [hci0] 11.276126
      LE Set Scan Enable (0x08|0x000c) ncmd 1
        Status: Success (0x00)
> HCI Event: LE Meta Event (0x3e) plen 35                                                            [hci0] 11.287680
      LE Advertising Report (0x02)
        Num reports: 1
        Event type: Connectable undirected - ADV_IND (0x00)
        Address type: Random (0x01)
        Address: 49:D3:E5:61:AE:36 (Resolvable)
        Data length: 23
        Flags: 0x06
          LE General Discoverable Mode
          BR/EDR Not Supported
        Company: Apple, Inc. (76)
          Type: Unknown (12)
          Data: 0063169caf541000a9cd5d9975f7
        RSSI: -86 dBm (0xaa)
> HCI Event: LE Meta Event (0x3e) plen 12                                                            [hci0] 11.288789
      LE Advertising Report (0x02)
        Num reports: 1
        Event type: Scan response - SCAN_RSP (0x04)
        Address type: Random (0x01)
        Address: 49:D3:E5:61:AE:36 (Resolvable)
        Data length: 0
        RSSI: -85 dBm (0xab)
> HCI Event: LE Meta Event (0x3e) plen 43                                                            [hci0] 11.301135
      LE Advertising Report (0x02)
        Num reports: 1
        Event type: Connectable undirected - ADV_IND (0x00)
        Address type: Public (0x00)
        Address: 28:39:5E:49:DB:23 (OUI 28-39-5E)
        Data length: 31
        Flags: 0x1a
          LE General Discoverable Mode
          Simultaneous LE and BR/EDR (Controller)
          Simultaneous LE and BR/EDR (Host)
        Company: Samsung Electronics Co. Ltd. (117)
          Data: 420401017e28395e49db232a395e49db2201000000000000
        RSSI: -71 dBm (0xb9)
> HCI Event: LE Meta Event (0x3e) plen 40                                                            [hci0] 11.305925
      LE Advertising Report (0x02)
        Num reports: 1
        Event type: Scan response - SCAN_RSP (0x04)
        Address type: Public (0x00)
        Address: 28:39:5E:49:DB:23 (OUI 28-39-5E)
        Data length: 28
        Name (short): [TV] Samsung 9 Series (65)
        RSSI: -72 dBm (0xb8)
> HCI Event: LE Meta Event (0x3e) plen 26                                                            [hci0] 11.311464
      LE Advertising Report (0x02)
        Num reports: 1
        Event type: Connectable undirected - ADV_IND (0x00)
        Address type: Random (0x01)
        Address: 5D:C2:ED:93:59:1F (Resolvable)
        Data length: 14
        Flags: 0x1a
          LE General Discoverable Mode
          Simultaneous LE and BR/EDR (Controller)
          Simultaneous LE and BR/EDR (Host)
        Company: Apple, Inc. (76)
          Type: Unknown (16)
          Data: 071c6824b9
        RSSI: -92 dBm (0xa4)
> HCI Event: LE Meta Event (0x3e) plen 34                                                            [hci0] 11.329588
      LE Advertising Report (0x02)
        Num reports: 1
        Event type: Connectable undirected - ADV_IND (0x00)
        Address type: Random (0x01)
        Address: 6A:46:64:F2:25:57 (Resolvable)
        Data length: 22
        Flags: 0x1a
          LE General Discoverable Mode
          Simultaneous LE and BR/EDR (Controller)
          Simultaneous LE and BR/EDR (Host)
        Company: Apple, Inc. (76)
          Type: Unknown (14)
          Data: 01004f000702
          Type: Unknown (16)
          Data: 0a1cca57b2
        RSSI: -77 dBm (0xb3)
> HCI Event: LE Meta Event (0x3e) plen 12                                                            [hci0] 11.332246
      LE Advertising Report (0x02)
        Num reports: 1
        Event type: Scan response - SCAN_RSP (0x04)
        Address type: Random (0x01)
        Address: 6A:46:64:F2:25:57 (Resolvable)
        Data length: 0
        RSSI: -77 dBm (0xb3)
> HCI Event: LE Meta Event (0x3e) plen 26                                                            [hci0] 11.373918
      LE Advertising Report (0x02)
        Num reports: 1
        Event type: Connectable undirected - ADV_IND (0x00)
        Address type: Random (0x01)
        Address: 78:D0:8A:A5:8B:43 (Resolvable)
        Data length: 14
        Flags: 0x1a
          LE General Discoverable Mode
          Simultaneous LE and BR/EDR (Controller)
          Simultaneous LE and BR/EDR (Host)
        Company: Apple, Inc. (76)
          Type: Unknown (16)
          Data: 031c429af9
        RSSI: -88 dBm (0xa8)
> HCI Event: LE Meta Event (0x3e) plen 12                                                            [hci0] 11.376067
      LE Advertising Report (0x02)
        Num reports: 1
        Event type: Scan response - SCAN_RSP (0x04)
        Address type: Random (0x01)
        Address: 78:D0:8A:A5:8B:43 (Resolvable)
        Data length: 0
        RSSI: -87 dBm (0xa9)
> HCI Event: LE Meta Event (0x3e) plen 27                                                            [hci0] 11.385151
      LE Advertising Report (0x02)
        Num reports: 1
        Event type: Non connectable undirected - ADV_NONCONN_IND (0x03)
        Address type: Random (0x01)
        Address: 33:CA:22:86:F5:4D (Non-Resolvable)
        Data length: 15
        Flags: 0x1b
          LE Limited Discoverable Mode
          LE General Discoverable Mode
          Simultaneous LE and BR/EDR (Controller)
          Simultaneous LE and BR/EDR (Host)
        Company: Apple, Inc. (76)
          Type: Apple TV (9)
          Data: 032bc0a8012b
        RSSI: -68 dBm (0xbc)
> HCI Event: LE Meta Event (0x3e) plen 23                                                            [hci0] 11.400609
      LE Advertising Report (0x02)
        Num reports: 1
        Event type: Connectable undirected - ADV_IND (0x00)
        Address type: Public (0x00)
        Address: C8:69:CD:6A:89:2A (Apple, Inc.)
        Data length: 11
        Flags: 0x1a
          LE General Discoverable Mode
          Simultaneous LE and BR/EDR (Controller)
          Simultaneous LE and BR/EDR (Host)
        Company: Apple, Inc. (76)
          Type: Unknown (16)
          Data: 0104
        RSSI: -80 dBm (0xb0)
> HCI Event: LE Meta Event (0x3e) plen 32                                                            [hci0] 11.486780
      LE Advertising Report (0x02)
        Num reports: 1
        Event type: Connectable undirected - ADV_IND (0x00)
        Address type: Random (0x01)
        Address: 6A:4E:F6:F6:BB:8C (Resolvable)
        Data length: 20
        Flags: 0x1a
          LE General Discoverable Mode
          Simultaneous LE and BR/EDR (Controller)
          Simultaneous LE and BR/EDR (Host)
        Company: Apple, Inc. (76)
          Type: Unknown (13)
          Data: 53d559a3
          Type: Unknown (16)
          Data: 031cf2b2a6
        RSSI: -85 dBm (0xab)
> HCI Event: LE Meta Event (0x3e) plen 12                                                            [hci0] 11.489229
      LE Advertising Report (0x02)
        Num reports: 1
        Event type: Scan response - SCAN_RSP (0x04)
        Address type: Random (0x01)
        Address: 6A:4E:F6:F6:BB:8C (Resolvable)
        Data length: 0
        RSSI: -87 dBm (0xa9)
> HCI Event: LE Meta Event (0x3e) plen 12                                                            [hci0] 11.585662
      LE Advertising Report (0x02)
        Num reports: 1
        Event type: Scan response - SCAN_RSP (0x04)
        Address type: Public (0x00)
        Address: C8:69:CD:6A:89:2A (Apple, Inc.)
        Data length: 0
        RSSI: -82 dBm (0xae)
> HCI Event: LE Meta Event (0x3e) plen 12                                                            [hci0] 11.855660
      LE Advertising Report (0x02)
        Num reports: 1
        Event type: Scan response - SCAN_RSP (0x04)
        Address type: Random (0x01)
        Address: 5D:C2:ED:93:59:1F (Resolvable)
        Data length: 0
        RSSI: -90 dBm (0xa6)
> HCI Event: LE Meta Event (0x3e) plen 23                                                            [hci0] 11.999393
      LE Advertising Report (0x02)
        Num reports: 1
        Event type: Connectable undirected - ADV_IND (0x00)
        Address type: Public (0x00)
        Address: 7C:D1:C3:DA:91:14 (Apple, Inc.)
        Data length: 11
        Flags: 0x06
          LE General Discoverable Mode
          BR/EDR Not Supported
        Company: Apple, Inc. (76)
          Type: Unknown (16)
          Data: 0b08
        RSSI: -97 dBm (0x9f)
> HCI Event: LE Meta Event (0x3e) plen 12                                                            [hci0] 12.191914
      LE Advertising Report (0x02)
        Num reports: 1
        Event type: Scan response - SCAN_RSP (0x04)
        Address type: Public (0x00)
        Address: 7C:D1:C3:DA:91:14 (Apple, Inc.)
        Data length: 0
        RSSI: -87 dBm (0xa9)
> HCI Event: LE Meta Event (0x3e) plen 26                                                            [hci0] 12.772156
      LE Advertising Report (0x02)
        Num reports: 1
        Event type: Connectable undirected - ADV_IND (0x00)
        Address type: Random (0x01)
        Address: 6D:D2:11:18:37:F1 (Resolvable)
        Data length: 14
        Flags: 0x1a
          LE General Discoverable Mode
          Simultaneous LE and BR/EDR (Controller)
          Simultaneous LE and BR/EDR (Host)
        Company: Apple, Inc. (76)
          Type: Unknown (16)
          Data: 0198b24d86
        RSSI: -80 dBm (0xb0)
> HCI Event: LE Meta Event (0x3e) plen 12                                                            [hci0] 12.773961
      LE Advertising Report (0x02)
        Num reports: 1
        Event type: Scan response - SCAN_RSP (0x04)
        Address type: Random (0x01)
        Address: 6D:D2:11:18:37:F1 (Resolvable)
        Data length: 0
        RSSI: -80 dBm (0xb0)
> HCI Event: LE Meta Event (0x3e) plen 40                                                            [hci0] 13.347879
      LE Advertising Report (0x02)
        Num reports: 1
        Event type: Non connectable undirected - ADV_NONCONN_IND (0x03)
        Address type: Public (0x00)
        Address: F8:77:B8:8A:01:C1 (Samsung Electronics Co.,Ltd)
        Data length: 28
        Company: Samsung Electronics Co. Ltd. (117)
          Data: 4204018060f877b88a01c1fa77b88a01c001000000000000
        RSSI: -100 dBm (0x9c)
> HCI Event: LE Meta Event (0x3e) plen 26                                                            [hci0] 14.016707
      LE Advertising Report (0x02)
        Num reports: 1
        Event type: Connectable undirected - ADV_IND (0x00)
        Address type: Public (0x00)
        Address: FF:FF:C0:22:6B:36 (OUI FF-FF-C0)
        Data length: 14
        Flags: 0x05
          LE Limited Discoverable Mode
          BR/EDR Not Supported
        TX power: 0 dBm
        Appearance: Keyboard (0x03c1)
        16-bit Service UUIDs (partial): 1 entry
          Unknown (0xffe0)
        RSSI: -90 dBm (0xa6)
5.43版蓝牙监视器
=注意:Linux版本4.14.71+(armv6l)0.563610
=注:蓝牙子系统版本2.22 0.563625
=新索引:B8:27:EB:C8:9E:A6(主、UART、hci0)[hci0]0.563632
=开放指数:B8:27:EB:C8:9E:A6[hci0]0.563634
=索引信息:B8:27:EB:C8:9E:A6(博通公司)[hci0]0.563638
@管理开放:蓝牙(特权)版本1.14{0x0001}0.563644
@管理打开:btmon(特权)版本1.14{0x0002}0.563788
@管理打开:btmon(特权)版本1.14{0x0003}2.149663
@原始打开:hcitool(特权)版本2.22{0x0004}11.269034
@原始关闭:hcitool{0x0004}11.270311
@原始打开:hcitool(特权)版本2.22{0x0004}[hci0]11.271277
HCI事件:命令完成(0x0e)plen 4[hci0]11.272708
LE设置扫描参数(0x08 | 0x000b)ncmd 1
状态:成功(0x00)
HCI事件:命令完成(0x0e)plen 4[hci0]11.276126
LE设置扫描启用(0x08 | 0x000c)ncmd 1
状态:成功(0x00)
>HCI事件:LE元事件(0x3e)plen 35[hci0]11.287680
乐视广告报道(0x02)
报告数量:1
事件类型:可连接的无方向-ADV_IND(0x00)
地址类型:随机(0x01)
地址:49:D3:E5:61:AE:36(可解决)
数据长度:23
标志:0x06
通用可发现模式
BR/EDR不受支持
公司:苹果公司(76)
类型:未知(12)
数据:0063169caf541000a9cd5d9975f7
RSSI:-86 dBm(0xaa)
>HCI事件:LE元事件(0x3e)plen 12[hci0]11.288789
乐视广告报道(0x02)
报告数量:1
事件类型:扫描响应-扫描RSP(0x04)
地址类型:随机(0x01)
地址:49:D3:E5:61:AE:36(可解决)
数据长度:0
RSSI:-85 dBm(0xab)
>HCI事件:LE元事件(0x3e)plen 43[hci0]11.301135
乐视广告报道(0x02)
报告数量:1
事件类型:可连接的无方向-ADV_IND(0x00)
地址类型:公共(0x00)
地址:28:39:5E:49:DB:23(OUI 28-39-5E)
数据长度:31
标志:0x1a
通用可发现模式
同时进行LE和BR/EDR(控制器)
同时进行LE和BR/EDR(主机)
公司:三星电子有限公司(117)
数据:420401017E28395E49DB232A395E49DB22010000000000
RSSI:-71 dBm(0xb9)
>HCI事件:LE元事件(0x3e)plen 40[hci0]11.305925
乐视广告报道(0x02)
报告数量:1
事件类型:扫描响应-扫描RSP(0x04)
地址类型:公共(0x00)
地址:28:39:5E:49:DB:23(OUI 28-39-5E)
数据长度:28
姓名(简称):[电视]三星9系列(65)
RSSI:-72 dBm(0xb8)
>HCI事件:LE元事件(0x3e)plen 26[hci0]11.311464
乐视广告报道(0x02)
报告数量:1
事件类型:可连接的无方向-ADV_IND(0x00)
地址类型:随机(0x01)
地址:5D:C2:ED:93:59:1F(可解决)
数据长度:14
标志:0x1a
通用可发现模式
同时进行LE和BR/EDR(控制器)
同时进行LE和BR/EDR(主机)
公司:苹果公司(76)
类型:未知(16)
数据:071c6824b9
RSSI:-92 dBm(0xa4)
>HCI事件:LE元事件(0x3e)plen 34[hci0]11.329588
乐视广告报道(0x02)
报告数量:1
事件类型:可连接的无方向-ADV_IND(0x00)
地址类型:随机(0x01)
地址:6A:46:64:F2:25:57(可解析)
数据长度:22
标志:0x1a
通用可发现模式
同时进行LE和BR/EDR(控制器)
同时进行LE和BR/EDR(主机)
公司:苹果公司(76)
类型:未知(14)
数据:01004f000702
类型:未知(16)
数据:0a1cca57b2
RSSI:-77 dBm(0xb3)
>HCI事件:LE元事件(0x3e)plen 12
Bluetooth monitor ver 5.43
= Note: Linux version 4.14.71+ (armv6l)                                                                      0.563610
= Note: Bluetooth subsystem version 2.22                                                                     0.563625
= New Index: B8:27:EB:C8:9E:A6 (Primary,UART,hci0)                                                    [hci0] 0.563632
= Open Index: B8:27:EB:C8:9E:A6                                                                       [hci0] 0.563634
= Index Info: B8:27:EB:C8:9E:A6 (Broadcom Corporation)                                                [hci0] 0.563638
@ MGMT Open: bluetoothd (privileged) version 1.14                                                   {0x0001} 0.563644
@ MGMT Open: btmon (privileged) version 1.14                                                        {0x0002} 0.563788
@ MGMT Open: btmon (privileged) version 1.14                                                        {0x0003} 2.149663
@ RAW Open: hcitool (privileged) version 2.22                                                      {0x0004} 11.269034
@ RAW Close: hcitool                                                                               {0x0004} 11.270311
@ RAW Open: hcitool (privileged) version 2.22                                               {0x0004} [hci0] 11.271277
< HCI Command: LE Set Scan Parameters (0x08|0x000b) plen 7                                           [hci0] 11.272202
        Type: Active (0x01)
        Interval: 10.000 msec (0x0010)
        Window: 10.000 msec (0x0010)
        Own address type: Public (0x00)
        Filter policy: Accept all advertisement (0x00)
> HCI Event: Command Complete (0x0e) plen 4                                                          [hci0] 11.272708
      LE Set Scan Parameters (0x08|0x000b) ncmd 1
        Status: Success (0x00)
< HCI Command: LE Set Scan Enable (0x08|0x000c) plen 2                                               [hci0] 11.275396
        Scanning: Enabled (0x01)
        Filter duplicates: Enabled (0x01)
> HCI Event: Command Complete (0x0e) plen 4                                                          [hci0] 11.276126
      LE Set Scan Enable (0x08|0x000c) ncmd 1
        Status: Success (0x00)
> HCI Event: LE Meta Event (0x3e) plen 35                                                            [hci0] 11.287680
      LE Advertising Report (0x02)
        Num reports: 1
        Event type: Connectable undirected - ADV_IND (0x00)
        Address type: Random (0x01)
        Address: 49:D3:E5:61:AE:36 (Resolvable)
        Data length: 23
        Flags: 0x06
          LE General Discoverable Mode
          BR/EDR Not Supported
        Company: Apple, Inc. (76)
          Type: Unknown (12)
          Data: 0063169caf541000a9cd5d9975f7
        RSSI: -86 dBm (0xaa)
> HCI Event: LE Meta Event (0x3e) plen 12                                                            [hci0] 11.288789
      LE Advertising Report (0x02)
        Num reports: 1
        Event type: Scan response - SCAN_RSP (0x04)
        Address type: Random (0x01)
        Address: 49:D3:E5:61:AE:36 (Resolvable)
        Data length: 0
        RSSI: -85 dBm (0xab)
> HCI Event: LE Meta Event (0x3e) plen 43                                                            [hci0] 11.301135
      LE Advertising Report (0x02)
        Num reports: 1
        Event type: Connectable undirected - ADV_IND (0x00)
        Address type: Public (0x00)
        Address: 28:39:5E:49:DB:23 (OUI 28-39-5E)
        Data length: 31
        Flags: 0x1a
          LE General Discoverable Mode
          Simultaneous LE and BR/EDR (Controller)
          Simultaneous LE and BR/EDR (Host)
        Company: Samsung Electronics Co. Ltd. (117)
          Data: 420401017e28395e49db232a395e49db2201000000000000
        RSSI: -71 dBm (0xb9)
> HCI Event: LE Meta Event (0x3e) plen 40                                                            [hci0] 11.305925
      LE Advertising Report (0x02)
        Num reports: 1
        Event type: Scan response - SCAN_RSP (0x04)
        Address type: Public (0x00)
        Address: 28:39:5E:49:DB:23 (OUI 28-39-5E)
        Data length: 28
        Name (short): [TV] Samsung 9 Series (65)
        RSSI: -72 dBm (0xb8)
> HCI Event: LE Meta Event (0x3e) plen 26                                                            [hci0] 11.311464
      LE Advertising Report (0x02)
        Num reports: 1
        Event type: Connectable undirected - ADV_IND (0x00)
        Address type: Random (0x01)
        Address: 5D:C2:ED:93:59:1F (Resolvable)
        Data length: 14
        Flags: 0x1a
          LE General Discoverable Mode
          Simultaneous LE and BR/EDR (Controller)
          Simultaneous LE and BR/EDR (Host)
        Company: Apple, Inc. (76)
          Type: Unknown (16)
          Data: 071c6824b9
        RSSI: -92 dBm (0xa4)
> HCI Event: LE Meta Event (0x3e) plen 34                                                            [hci0] 11.329588
      LE Advertising Report (0x02)
        Num reports: 1
        Event type: Connectable undirected - ADV_IND (0x00)
        Address type: Random (0x01)
        Address: 6A:46:64:F2:25:57 (Resolvable)
        Data length: 22
        Flags: 0x1a
          LE General Discoverable Mode
          Simultaneous LE and BR/EDR (Controller)
          Simultaneous LE and BR/EDR (Host)
        Company: Apple, Inc. (76)
          Type: Unknown (14)
          Data: 01004f000702
          Type: Unknown (16)
          Data: 0a1cca57b2
        RSSI: -77 dBm (0xb3)
> HCI Event: LE Meta Event (0x3e) plen 12                                                            [hci0] 11.332246
      LE Advertising Report (0x02)
        Num reports: 1
        Event type: Scan response - SCAN_RSP (0x04)
        Address type: Random (0x01)
        Address: 6A:46:64:F2:25:57 (Resolvable)
        Data length: 0
        RSSI: -77 dBm (0xb3)
> HCI Event: LE Meta Event (0x3e) plen 26                                                            [hci0] 11.373918
      LE Advertising Report (0x02)
        Num reports: 1
        Event type: Connectable undirected - ADV_IND (0x00)
        Address type: Random (0x01)
        Address: 78:D0:8A:A5:8B:43 (Resolvable)
        Data length: 14
        Flags: 0x1a
          LE General Discoverable Mode
          Simultaneous LE and BR/EDR (Controller)
          Simultaneous LE and BR/EDR (Host)
        Company: Apple, Inc. (76)
          Type: Unknown (16)
          Data: 031c429af9
        RSSI: -88 dBm (0xa8)
> HCI Event: LE Meta Event (0x3e) plen 12                                                            [hci0] 11.376067
      LE Advertising Report (0x02)
        Num reports: 1
        Event type: Scan response - SCAN_RSP (0x04)
        Address type: Random (0x01)
        Address: 78:D0:8A:A5:8B:43 (Resolvable)
        Data length: 0
        RSSI: -87 dBm (0xa9)
> HCI Event: LE Meta Event (0x3e) plen 27                                                            [hci0] 11.385151
      LE Advertising Report (0x02)
        Num reports: 1
        Event type: Non connectable undirected - ADV_NONCONN_IND (0x03)
        Address type: Random (0x01)
        Address: 33:CA:22:86:F5:4D (Non-Resolvable)
        Data length: 15
        Flags: 0x1b
          LE Limited Discoverable Mode
          LE General Discoverable Mode
          Simultaneous LE and BR/EDR (Controller)
          Simultaneous LE and BR/EDR (Host)
        Company: Apple, Inc. (76)
          Type: Apple TV (9)
          Data: 032bc0a8012b
        RSSI: -68 dBm (0xbc)
> HCI Event: LE Meta Event (0x3e) plen 23                                                            [hci0] 11.400609
      LE Advertising Report (0x02)
        Num reports: 1
        Event type: Connectable undirected - ADV_IND (0x00)
        Address type: Public (0x00)
        Address: C8:69:CD:6A:89:2A (Apple, Inc.)
        Data length: 11
        Flags: 0x1a
          LE General Discoverable Mode
          Simultaneous LE and BR/EDR (Controller)
          Simultaneous LE and BR/EDR (Host)
        Company: Apple, Inc. (76)
          Type: Unknown (16)
          Data: 0104
        RSSI: -80 dBm (0xb0)
> HCI Event: LE Meta Event (0x3e) plen 32                                                            [hci0] 11.486780
      LE Advertising Report (0x02)
        Num reports: 1
        Event type: Connectable undirected - ADV_IND (0x00)
        Address type: Random (0x01)
        Address: 6A:4E:F6:F6:BB:8C (Resolvable)
        Data length: 20
        Flags: 0x1a
          LE General Discoverable Mode
          Simultaneous LE and BR/EDR (Controller)
          Simultaneous LE and BR/EDR (Host)
        Company: Apple, Inc. (76)
          Type: Unknown (13)
          Data: 53d559a3
          Type: Unknown (16)
          Data: 031cf2b2a6
        RSSI: -85 dBm (0xab)
> HCI Event: LE Meta Event (0x3e) plen 12                                                            [hci0] 11.489229
      LE Advertising Report (0x02)
        Num reports: 1
        Event type: Scan response - SCAN_RSP (0x04)
        Address type: Random (0x01)
        Address: 6A:4E:F6:F6:BB:8C (Resolvable)
        Data length: 0
        RSSI: -87 dBm (0xa9)
> HCI Event: LE Meta Event (0x3e) plen 12                                                            [hci0] 11.585662
      LE Advertising Report (0x02)
        Num reports: 1
        Event type: Scan response - SCAN_RSP (0x04)
        Address type: Public (0x00)
        Address: C8:69:CD:6A:89:2A (Apple, Inc.)
        Data length: 0
        RSSI: -82 dBm (0xae)
> HCI Event: LE Meta Event (0x3e) plen 12                                                            [hci0] 11.855660
      LE Advertising Report (0x02)
        Num reports: 1
        Event type: Scan response - SCAN_RSP (0x04)
        Address type: Random (0x01)
        Address: 5D:C2:ED:93:59:1F (Resolvable)
        Data length: 0
        RSSI: -90 dBm (0xa6)
> HCI Event: LE Meta Event (0x3e) plen 23                                                            [hci0] 11.999393
      LE Advertising Report (0x02)
        Num reports: 1
        Event type: Connectable undirected - ADV_IND (0x00)
        Address type: Public (0x00)
        Address: 7C:D1:C3:DA:91:14 (Apple, Inc.)
        Data length: 11
        Flags: 0x06
          LE General Discoverable Mode
          BR/EDR Not Supported
        Company: Apple, Inc. (76)
          Type: Unknown (16)
          Data: 0b08
        RSSI: -97 dBm (0x9f)
> HCI Event: LE Meta Event (0x3e) plen 12                                                            [hci0] 12.191914
      LE Advertising Report (0x02)
        Num reports: 1
        Event type: Scan response - SCAN_RSP (0x04)
        Address type: Public (0x00)
        Address: 7C:D1:C3:DA:91:14 (Apple, Inc.)
        Data length: 0
        RSSI: -87 dBm (0xa9)
> HCI Event: LE Meta Event (0x3e) plen 26                                                            [hci0] 12.772156
      LE Advertising Report (0x02)
        Num reports: 1
        Event type: Connectable undirected - ADV_IND (0x00)
        Address type: Random (0x01)
        Address: 6D:D2:11:18:37:F1 (Resolvable)
        Data length: 14
        Flags: 0x1a
          LE General Discoverable Mode
          Simultaneous LE and BR/EDR (Controller)
          Simultaneous LE and BR/EDR (Host)
        Company: Apple, Inc. (76)
          Type: Unknown (16)
          Data: 0198b24d86
        RSSI: -80 dBm (0xb0)
> HCI Event: LE Meta Event (0x3e) plen 12                                                            [hci0] 12.773961
      LE Advertising Report (0x02)
        Num reports: 1
        Event type: Scan response - SCAN_RSP (0x04)
        Address type: Random (0x01)
        Address: 6D:D2:11:18:37:F1 (Resolvable)
        Data length: 0
        RSSI: -80 dBm (0xb0)
> HCI Event: LE Meta Event (0x3e) plen 40                                                            [hci0] 13.347879
      LE Advertising Report (0x02)
        Num reports: 1
        Event type: Non connectable undirected - ADV_NONCONN_IND (0x03)
        Address type: Public (0x00)
        Address: F8:77:B8:8A:01:C1 (Samsung Electronics Co.,Ltd)
        Data length: 28
        Company: Samsung Electronics Co. Ltd. (117)
          Data: 4204018060f877b88a01c1fa77b88a01c001000000000000
        RSSI: -100 dBm (0x9c)
> HCI Event: LE Meta Event (0x3e) plen 26                                                            [hci0] 14.016707
      LE Advertising Report (0x02)
        Num reports: 1
        Event type: Connectable undirected - ADV_IND (0x00)
        Address type: Public (0x00)
        Address: FF:FF:C0:22:6B:36 (OUI FF-FF-C0)
        Data length: 14
        Flags: 0x05
          LE Limited Discoverable Mode
          BR/EDR Not Supported
        TX power: 0 dBm
        Appearance: Keyboard (0x03c1)
        16-bit Service UUIDs (partial): 1 entry
          Unknown (0xffe0)
        RSSI: -90 dBm (0xa6)
Bluetooth monitor ver 5.43
= Note: Linux version 4.14.71+ (armv6l)                                0.149535
= Note: Bluetooth subsystem version 2.22                               0.149551
= New Index: B8:27:EB:C8:9E:A6 (Primary,UART,hci0)              [hci0] 0.149556
= Open Index: B8:27:EB:C8:9E:A6                                 [hci0] 0.149559
= Index Info: B8:27:EB:C8:9E:A6 (Broadcom Corporation)          [hci0] 0.149563
@ MGMT Open: btmon (privileged) version 1.14                  {0x0002} 0.149569
@ MGMT Open: bluetoothd (privileged) version 1.14             {0x0001} 0.149573
@ MGMT Open: btmon (privileged) version 1.14                  {0x0003} 0.149663
@ RAW Open: hcitool (privileged) version 2.22                 {0x0004} 9.269034
@ RAW Close: hcitool                                          {0x0004} 9.270311
@ RAW Open: hcitool (privileged) version 2.22          {0x0004} [hci0] 9.271277
< HCI Command: LE Set Scan Parameters (0x08|0x000b) plen 7      [hci0] 9.272202
Type: Active (0x01)
Interval: 10.000 msec (0x0010)
Window: 10.000 msec (0x0010)
Own address type: Public (0x00)
Filter policy: Accept all advertisement (0x00)
> HCI Event: Command Complete (0x0e) plen 4                     [hci0] 9.272708
LE Set Scan Parameters (0x08|0x000b) ncmd 1
Status: Success (0x00)
< HCI Command: LE Set Scan Enable (0x08|0x000c) plen 2          [hci0] 9.275396
Scanning: Enabled (0x01)
Filter duplicates: Enabled (0x01)
> HCI Event: Command Complete (0x0e) plen 4                     [hci0] 9.276126
LE Set Scan Enable (0x08|0x000c) ncmd 1
Status: Success (0x00)
> HCI Event: LE Meta Event (0x3e) plen 35                       [hci0] 9.287680
LE Advertising Report (0x02)
Num reports: 1
Event type: Connectable undirected - ADV_IND (0x00)
Address type: Random (0x01)
Address: 49:D3:E5:61:AE:36 (Resolvable)
Data length: 23
Flags: 0x06
LE General Discoverable Mode
BR/EDR Not Supported
Company: Apple, Inc. (76)
Type: Unknown (12)
Data: 0063169caf541000a9cd5d9975f7
RSSI: -86 dBm (0xaa)
> HCI Event: LE Meta Event (0x3e) plen 12                       [hci0] 9.288789
LE Advertising Report (0x02)
Num reports: 1
Event type: Scan response - SCAN_RSP (0x04)
Address type: Random (0x01)
Address: 49:D3:E5:61:AE:36 (Resolvable)
Data length: 0
RSSI: -85 dBm (0xab)
> HCI Event: LE Meta Event (0x3e) plen 43                       [hci0] 9.301135
LE Advertising Report (0x02)
Num reports: 1
Event type: Connectable undirected - ADV_IND (0x00)
Address type: Public (0x00)
Address: 28:39:5E:49:DB:23 (OUI 28-39-5E)
Data length: 31
Flags: 0x1a
LE General Discoverable Mode
Simultaneous LE and BR/EDR (Controller)
Simultaneous LE and BR/EDR (Host)
Company: Samsung Electronics Co. Ltd. (117)
Data: 420401017e28395e49db232a395e49db2201000000000000
RSSI: -71 dBm (0xb9)
> HCI Event: LE Meta Event (0x3e) plen 40                       [hci0] 9.305925
LE Advertising Report (0x02)
Num reports: 1
Event type: Scan response - SCAN_RSP (0x04)
Address type: Public (0x00)
Address: 28:39:5E:49:DB:23 (OUI 28-39-5E)
Data length: 28
Name (short): [TV] Samsung 9 Series (65)
RSSI: -72 dBm (0xb8)
> HCI Event: LE Meta Event (0x3e) plen 26                       [hci0] 9.311464
LE Advertising Report (0x02)
Num reports: 1
Event type: Connectable undirected - ADV_IND (0x00)
Address type: Random (0x01)
Address: 5D:C2:ED:93:59:1F (Resolvable)
Data length: 14
Flags: 0x1a
LE General Discoverable Mode
Simultaneous LE and BR/EDR (Controller)
Simultaneous LE and BR/EDR (Host)
Company: Apple, Inc. (76)
Type: Unknown (16)
Data: 071c6824b9
RSSI: -92 dBm (0xa4)
> HCI Event: LE Meta Event (0x3e) plen 34                       [hci0] 9.329588
LE Advertising Report (0x02)
Num reports: 1
Event type: Connectable undirected - ADV_IND (0x00)
Address type: Random (0x01)
Address: 6A:46:64:F2:25:57 (Resolvable)
Data length: 22
Flags: 0x1a
LE General Discoverable Mode
Simultaneous LE and BR/EDR (Controller)
Simultaneous LE and BR/EDR (Host)
Company: Apple, Inc. (76)
Type: Unknown (14)
Data: 01004f000702
Type: Unknown (16)
Data: 0a1cca57b2
RSSI: -77 dBm (0xb3)
> HCI Event: LE Meta Event (0x3e) plen 12                       [hci0] 9.332246
LE Advertising Report (0x02)
Num reports: 1
Event type: Scan response - SCAN_RSP (0x04)
Address type: Random (0x01)
Address: 6A:46:64:F2:25:57 (Resolvable)
Data length: 0
RSSI: -77 dBm (0xb3)
> HCI Event: LE Meta Event (0x3e) plen 26                       [hci0] 9.373918
LE Advertising Report (0x02)
Num reports: 1
Event type: Connectable undirected - ADV_IND (0x00)
Address type: Random (0x01)
Address: 78:D0:8A:A5:8B:43 (Resolvable)
Data length: 14
Flags: 0x1a
LE General Discoverable Mode
Simultaneous LE and BR/EDR (Controller)
Simultaneous LE and BR/EDR (Host)
Company: Apple, Inc. (76)
Type: Unknown (16)
Data: 031c429af9
RSSI: -88 dBm (0xa8)
> HCI Event: LE Meta Event (0x3e) plen 12                       [hci0] 9.376067
LE Advertising Report (0x02)
Num reports: 1
Event type: Scan response - SCAN_RSP (0x04)
Address type: Random (0x01)
Address: 78:D0:8A:A5:8B:43 (Resolvable)
Data length: 0
RSSI: -87 dBm (0xa9)
> HCI Event: LE Meta Event (0x3e) plen 27                       [hci0] 9.385151
LE Advertising Report (0x02)
Num reports: 1
Event type: Non connectable undirected - ADV_NONCONN_IND (0x03)
Address type: Random (0x01)
Address: 33:CA:22:86:F5:4D (Non-Resolvable)
Data length: 15
Flags: 0x1b
LE Limited Discoverable Mode
LE General Discoverable Mode
Simultaneous LE and BR/EDR (Controller)
Simultaneous LE and BR/EDR (Host)
Company: Apple, Inc. (76)
Type: Apple TV (9)
Data: 032bc0a8012b
RSSI: -68 dBm (0xbc)
> HCI Event: LE Meta Event (0x3e) plen 23                       [hci0] 9.400609
LE Advertising Report (0x02)
Num reports: 1
Event type: Connectable undirected - ADV_IND (0x00)
Address type: Public (0x00)
Address: C8:69:CD:6A:89:2A (Apple, Inc.)
Data length: 11
Flags: 0x1a
LE General Discoverable Mode
Simultaneous LE and BR/EDR (Controller)
Simultaneous LE and BR/EDR (Host)
Company: Apple, Inc. (76)
Type: Unknown (16)
Data: 0104
RSSI: -80 dBm (0xb0)
> HCI Event: LE Meta Event (0x3e) plen 32                       [hci0] 9.486780
LE Advertising Report (0x02)
Num reports: 1
Event type: Connectable undirected - ADV_IND (0x00)
Address type: Random (0x01)
Address: 6A:4E:F6:F6:BB:8C (Resolvable)
Data length: 20
Flags: 0x1a
LE General Discoverable Mode
Simultaneous LE and BR/EDR (Controller)
Simultaneous LE and BR/EDR (Host)
Company: Apple, Inc. (76)
Type: Unknown (13)
Data: 53d559a3
Type: Unknown (16)
Data: 031cf2b2a6
RSSI: -85 dBm (0xab)
> HCI Event: LE Meta Event (0x3e) plen 12                       [hci0] 9.489229
LE Advertising Report (0x02)
Num reports: 1
Event type: Scan response - SCAN_RSP (0x04)
Address type: Random (0x01)
Address: 6A:4E:F6:F6:BB:8C (Resolvable)
Data length: 0
RSSI: -87 dBm (0xa9)
while IFS= read -r line; do
  printf '%s\n' "$line"
done < <(unbuffer btmon 2>&1)