Jump to content

Helios64 - Setting Serial TTY Size with Picocom


mrjpaxton
Go to solution Solved by mrjpaxton,

Recommended Posts

Hi,

 

I have an issue that is irritating me, and I'm not sure what to do about it.

 

So on the Helios64 page (I am also using it with the Kobol enclosure), they give you a simple command like this to use:

 

picocom -b 1500000 /dev/ttyUSB0

 

This is so you can access a serial TTY without an Internet connection.

 

My problem is that the "window size" is set back to 80x24 characters. I'm not sure why this happens. I've also noticed that it somehow sets "TERM=linux" instead of what I have in my host PC's "$TERM" which is "xterm-256color"

 

Is this by design, or is there something strange going on that I don't understand? The thing is, I would really like to set the terminal screen size to my host's terminal size each time, whether or not I'm using a TTY, or a terminal emulator, or... whatever!

 

It's just so annoying to have to type in "stty cols 240 rows 60" for example with a 1080p screen. Instead, I would just like picocom or some other application, whatever is supposed to be setting the TTY, to automatically set the terminal to whatever the host's is.

 

As an aside, there have also been really strange problems where after using that "stty" command, the serial console may actually freeze. Even after quitting from picocom with Ctrl-A, Ctrl-Q, and launching again, it will still remain frozen. I would like to avoid these freezing problems since the serial TTY is supposed to be super-duper reliable (duh). Now that I think about it, the freezing may have been caused by something else in the past. I haven't had it happen in the past month or so....

 

So is there any way to do what I want? I would be really grateful for any help!

Edited by mrjpaxton
Link to comment
Share on other sites

  • Solution
On 1/15/2021 at 7:45 AM, _r9 said:

Hi @mrjpaxton


this forum is an opensource project that focuses mainly on the development of Armbian.
So maybe you try your luck here https://wiki.archlinux.org/index.php/Working_with_the_serial_console

But feel free to write here if you'll solve your issue ; )

 

Sure thing.

 

Luckily, it didn't take much time to figure it out. Thanks to the person who answered here: https://unix.stackexchange.com/questions/16578/resizable-serial-console-window/283206

 

I was able to use something POSIX standard like the "res()" shell function he described to get it working.

 

I just put it in as a bash function in my .bashrc file and had it only call when "TERM=linux" which seems reasonable to me for now, since picocom (and the regular Linux pTTY) always seems to set the TERM variable to that.

 

resize-term() {
    OLDSTTY=$(stty -g)
    stty raw -echo min 0 time 5
    printf '\0337\033[r\033[999;999H\033[6n\0338' > /dev/tty
    IFS='[;R' read -r _ rows cols _ < /dev/tty
    stty "$OLDSTTY"
    echo "Set cols = $cols"; echo "Set rows = $rows"
    stty cols "$cols" rows "$rows"
}

[ "$TERM" == "linux" ] && resize-term

 

Edited by mrjpaxton
Link to comment
Share on other sites

This thread is quite old. Please consider starting a new thread rather than reviving this one.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...

Important Information

Terms of Use - Privacy Policy - Guidelines