【发布时间】:2014-10-07 10:52:44
【问题描述】:
为了调试蓝牙通信,我想启动嗅探器(hcidump -Xt)并将数据转储到文件中。在终端上,我可以启动这个命令:
hcidump -Xt > myfile.txt
然后使用 Ctrl+C 终止同样的操作。
我想使用 python 脚本来实现这一点。比如:
#start sniffer
call(["hcidump","-Xt", ">", "myfile.txt"])
#perform any activity
#Stop the sniffer - hcidump
最后,它应该停止嗅探器进程,并且所有日志都应该存储在 myfile.txt 文件中。 我尝试了一些东西,例如this one。但它没有创建预期的文件。
请告知是否有任何方法可以实现我所需要的。
【问题讨论】:
标签: python bluetooth packet-sniffers hci