![读取 btmon 日志文件](https://linux22.com/image/194656/%E8%AF%BB%E5%8F%96%20btmon%20%E6%97%A5%E5%BF%97%E6%96%87%E4%BB%B6.png)
我用于btmon
监视从对等方发送/接收的蓝牙数据包。当我btmon
在 Ubuntu 机器上运行该命令时,我会收集如下所述的日志。我还阅读了以下手册页:https://manpages.debian.org/testing/bluez/btmon.1.en.html
我必须弄清楚哪个数据包被视为发送数据包以及哪个数据包被视为接收所有数据。
我观察到日志中提到了 Tx 和 Rx,还有时间,但我无法弄清楚数据包发送从哪里开始以及数据包接收从哪里结束。
基本上,我想弄清楚对等设备发送数据包后需要多长时间。
< ACL Data TX: Handle 3585 flags 0x01 dlen 27 [hci0] 20.084811
ATT: Write Command (0x52) len 130
Handle: 0x0013
Data: 00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001ffffffffffffffffffffffffffffffffffffff000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
> HCI Event: Number of Completed Packets (0x13) plen 5 [hci0] 20.085678
Num handles: 1
Handle: 3585
Count: 1
< ACL Data TX: Handle 3585 flags 0x00 dlen 19 [hci0] 20.085759
ATT: Write Command (0x52) len 14
Handle: 0x0013
Data: 0000000000000000edfa5318
> HCI Event: Number of Completed Packets (0x13) plen 5 [hci0] 20.086641
Num handles: 1
Handle: 3585
Count: 1
> HCI Event: Number of Completed Packets (0x13) plen 5 [hci0] 20.087638
Num handles: 1
Handle: 3585
Count: 1
> HCI Event: Number of Completed Packets (0x13) plen 5 [hci0] 20.088637
Num handles: 1
Handle: 3585
Count: 1
> HCI Event: Number of Completed Packets (0x13) plen 5 [hci0] 20.132702
Num handles: 1
Handle: 3585
Count: 1
> HCI Event: Number of Completed Packets (0x13) plen 5 [hci0] 20.133698
Num handles: 1
Handle: 3585
Count: 1
> HCI Event: Number of Completed Packets (0x13) plen 5 [hci0] 20.134653
Num handles: 1
Handle: 3585
Count: 1
> HCI Event: Number of Completed Packets (0x13) plen 5 [hci0] 20.135646
Num handles: 1
Handle: 3585
Count: 1
> ACL Data RX: Handle 3585 flags 0x02 dlen 9 [hci0] 20.182235
ATT: Handle Value Notification (0x1b) len 4
Handle: 0x0010
Data: 0206
> ACL Data RX: Handle 3585 flags 0x02 dlen 17 [hci0] 20.282358
ATT: Handle Value Notification (0x1b) len 12
Handle: 0x0010
Data: 000c000007177df11e96
< ACL Data TX: Handle 3585 flags 0x00 dlen 27 [hci0] 20.301577
< ACL Data TX: Handle 3585 flags 0x01 dlen 27 [hci0] 20.301615
< ACL Data TX: Handle 3585 flags 0x01 dlen 27 [hci0] 20.301618
< ACL Data TX: Handle 3585 flags 0x01 dlen 27 [hci0] 20.301620
< ACL Data TX: Handle 3585 flags 0x01 dlen 27 [hci0] 20.301622
ATT: Write Command (0x52) len 130
Handle: 0x0013
Data: 0202010c00000718000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
< ACL Data TX: Handle 3585 flags 0x00 dlen 27 [hci0] 20.319607
< ACL Data TX: Handle 3585 flags 0x01 dlen 27 [hci0] 20.319734
> HCI Event: Number of Completed Packets (0x13) plen 5 [hci0] 20.332684
Num handles: 1
Handle: 3585
Count: 1
< ACL Data TX: Handle 3585 flags 0x01 dlen 27 [hci0] 20.332724
> HCI Event: Number of Completed Packets (0x13) plen 5 [hci0] 20.333649
Num handles: 1
Handle: 3585
Count: 1
< ACL Data TX: Handle 3585 flags 0x01 dlen 27 [hci0] 20.333696
> HCI Event: Number of Completed Packets (0x13) plen 5 [hci0] 20.334697
Num handles: 1
Handle: 3585
Count: 1
< ACL Data TX: Handle 3585 flags 0x01 dlen 27 [hci0] 20.334817
ATT: Write Command (0x52) len 130
Handle: 0x0013
Data: 0000000000000000000000000000000000000000000000000000000080c0e0f0f0fcfcfeffffffffffffffffffffffffff7f1f1f07070101010000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
> HCI Event: Number of Completed Packets (0x13) plen 5 [hci0] 20.335683
Num handles: 1
Handle: 3585
Count: 1
< ACL Data TX: Handle 3585 flags 0x00 dlen 19 [hci0] 20.335759
ATT: Write Command (0x52) len 14
Handle: 0x0013
Data: 000000000000000093c682c9
> HCI Event: Number of Completed Packets (0x13) plen 5 [hci0] 20.336693
Num handles: 1
Handle: 3585
Count: 1
> HCI Event: Number of Completed Packets (0x13) plen 5 [hci0] 20.337651
Num handles: 1
Handle: 3585
Count: 1
> HCI Event: Number of Completed Packets (0x13) plen 5 [hci0] 20.338651
Num handles: 1
Handle: 3585
Count: 1
> HCI Event: Number of Completed Packets (0x13) plen 5 [hci0] 20.382660
Num handles: 1
Handle: 3585
Count: 1
> HCI Event: Number of Completed Packets (0x13) plen 5 [hci0] 20.383658
Num handles: 1
Handle: 3585
Count: 1
> HCI Event: Number of Completed Packets (0x13) plen 5 [hci0] 20.384657
Num handles: 1
Handle: 3585
Count: 1
> HCI Event: Number of Completed Packets (0x13) plen 5 [hci0] 20.385682
Num handles: 1
Handle: 3585
Count: 1
> ACL Data RX: Handle 3585 flags 0x02 dlen 9 [hci0] 20.432153
ATT: Handle Value Notification (0x1b) len 4
Handle: 0x0010
Data: 0206
> ACL Data RX: Handle 3585 flags 0x02 dlen 17 [hci0] 20.532366
ATT: Handle Value Notification (0x1b) len 12
Handle: 0x0010
Data: 000c0000071845bea32b
< ACL Data TX: Handle 3585 flags 0x00 dlen 27 [hci0] 20.555377
< ACL Data TX: Handle 3585 flags 0x01 dlen 27 [hci0] 20.555479
< ACL Data TX: Handle 3585 flags 0x01 dlen 27 [hci0] 20.555499
< ACL Data TX: Handle 3585 flags 0x01 dlen 27 [hci0] 20.555514
< ACL Data TX: Handle 3585 flags 0x01 dlen 27
有人可以向我解释 btmon 日志格式,以便我得到我需要的东西吗?格式记录在哪里?
答案1
man btmon
告诉我们它是 btsnoop 格式。
https://git.kernel.org/pub/scm/bluetooth/bluez.git/tree/doc/btsnoop.txt