Question

I have a USB-Dongle that can recive radio signals (868Mhz). This dongle coud be controlled over a screen terminal session:

screen /dev/ttyACM0

In this Terminal all 120sec appear strings:

T350B00B64C19

How can I save this strings in a variable to work with them.

Any ideas?

Was it helpful?

Solution

Starting screen with the -L option creates a log in the current working directory. I guess that should serve your requirements.

$ screen --help
...
-L            Turn on output logging.
...

From man 1 screen:

-L   tells screen to turn on automatic output logging for the windows.

OTHER TIPS

If I understand correctly, you don't actually need screen; you just need to read from the serial device. For example:

while read data; do
    # Work with value in $data
done < /dev/ttyACM0

Each call to read should block until the dongle writes another string to the serial device.

If you need to send commands to the device, you can also simply write the appropriate string to the same file:

printf "my-command" > /dev/ttyACM0
read response < /dev/ttyACM0
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top