Score:1

Why do screen and minicom drop incoming bytes from a serial port while cat does not?

es flag

I recently needed to reset the password on an old APC UPS which requires connecting their proprietary serial cable, hitting the reset button, and logging in with the default username and password over the serial interface. I connected it to the serial port on an R720XD, and passed the port through to a Ubuntu VM.

I used stty to configure the serial port according to APC's documentation, launched screen /dev/ttyS0 <options>, and went to work. For some reason, the output was a total mess. It seemed like it would pick up the first 3-4 characters of every transmission, then miss the rest. I tried minicom with the same results.

So I did a loopback test - connected RX and TX together - to see if what I sent would come back in. Same issue. I hooked up an oscilloscope to the wire and discovered that every keypress was sent properly; I could see it going over the wire. But for some reason, most of the characters wouldn't show up on screen.

I then discovered that if I did cat /dev/ttyS0 in one terminal, and echo alongstring > /dev/ttyS0 in another, I could see everything just fine!

I ended up just leaving the cat open to view the incoming bytes, and running screen in another terminal to send keypresses, which worked just fine and was a lot easier than using echo over and over. Password was successfully reset using this.

But now I'm curious... does anyone have any ideas why screen and minicom had issues? I tried every option I could find in man, but no luck. It seemed like there might be something else pulling the bytes out of the buffer, but I have no idea what that could be.

mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.