To debug Bluetooth communication, I want to start sniffer (hcidump -Xt) and dump the data in a file. On the terminal, I can start this command:
hcidump -Xt > myfile.txt
Then use Ctrl+C to terminate the same.
I want to achieve this using python script. Something like:
#start sniffer
call(["hcidump","-Xt", ">", "myfile.txt"])
#perform any activity
#Stop the sniffer - hcidump
Finally, it should stop the sniffer process and all the logs should be stored in the myfile.txt file. I tried few things such as this one. But it is not creating the intended file.
Please advise if there is any way to achieve the what I need.