4

Occasionally I'm trying to debug a (usually serial) device that starts very quickly.

If I get the device running, I can connect to it using:

minicom -D /dev/ttyUSB0

Then, if the device disconnects, minicom stays open until it reconnects.

Is there a switch to tell minicom to open in this "waiting" state, even if the device has not yet been created?

I've tried -o (Do not initialize.)

1 Answer 1

5

If all you want to do initially is capture all the output from the device you can use:

tail -F /dev/ttyUSB0

as this will wait until the device exists then read from it. If the device disappears and reappears, it will valiantly re-open it.


You can try creating a fifo and using minicom on this as the device. Then, in a loop, wait for the real device to appear, and open and connect it the fifo when it does, for example with socat. minicom will not see the re-opens.

mkfifo ~/myfifo
while sleep 1; do socat /dev/ttyUSB0,b19200,echo=0,raw ~/myfifo; done &
minicom -o -D ~/myfifo

b19200 is an example of setting the speed, which you can remove if it doesn't need to be set.

4
  • Unfortunately, this doesn't allow me to interact with the device, merely to read it. :-( Commented Jul 8, 2015 at 0:36
  • @tudor I added a socat/fifo example for bidirectional use. Commented Jul 8, 2015 at 7:00
  • Ah! That's a smart way to think about it. :-) Commented Jul 8, 2015 at 23:53
  • This looked like a good idea, but didn't work in Ubuntu 22.04 unfortunately. I got three messages in this sequence: 1. "tail: cannot open '/dev/ttyACM0' for reading: No such file or directory 2. "tail: '/dev/ttyACM0' has appeared; following new file" 3. tail: /dev/ttyACM0: cannot seek to offset 0: Illegal seek" Commented Nov 14, 2022 at 7:45

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.