I'm using tshark to capture RSSI values in an attempt at wifi triangulation. I have it set up so that the log only outputs the RSSI value. The command I'm using is: 'tshark -I -i wlan2 -R "wlan.addr == 58:1f:aa:2a:80:1e && wlan.addr == Broadcast" -o column.format:'"RSSI", %e' > /tmp/log.txt' I'm using python function readline() to grab the first line of the log file and assign the RSSI to a variable to be sent into a triangulation algorithm. I'm wondering if there's a way to have the log update constantly re-writing the first line of the log file. asked 04 Oct '13, 18:53 Evan Watler edited 04 Oct '13, 18:54 |
2 Answers:
I see a couple of options:
If you really need to read from a file, then you can use some command line piping to overwrite the first line, something like:
answered 05 Oct '13, 01:44 SYN-bit ♦♦ |
That's where named pipes can help. They work like a FIFO and thus you will always get the lines in the order they were written, one by one, just by calling readline() on them. Here is how you can do it:
I added some options (-l and 2>/dev/null) to your tshark command. Here is the (very basic!) python code. Please extend it to your needs. Obviously you need to extract the RSSI values from the line in the python code and then feed that into your algorithm.
Regards answered 07 Oct ‘13, 13:40 Kurt Knochner ♦ edited 07 Oct ‘13, 13:41 |