1

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.

Community
  • 1
  • 1
user846316
  • 6,037
  • 6
  • 31
  • 40

1 Answers1

0

You don't need to use ">" for redirection!
Nearly the same as this one How do I pipe a subprocess call to a text file?

VivienG
  • 2,143
  • 3
  • 24
  • 43