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.)

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.

3
  • Unfortunately, this doesn't allow me to interact with the device, merely to read it. :-( – tu-Reinstate Monica-dor duh Jul 8 '15 at 0:36
  • @tudor I added a socat/fifo example for bidirectional use. – meuh Jul 8 '15 at 7:00
  • Ah! That's a smart way to think about it. :-) – tu-Reinstate Monica-dor duh Jul 8 '15 at 23:53

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.