Changes between Version 17 and Version 18 of serial
- Timestamp:
- 09/05/2019 03:50:13 PM (5 years ago)
Legend:
- Unmodified
- Added
- Removed
- Modified
-
serial
v17 v18 671 671 console applications running inside Linux virtual terminal applications (xterm, rxvt etc) will receive SIGWINCH after a resize operation has taken place and adjust accordingly. 672 672 673 When using a serial console there is no such mechanism and you can see the affect of this by connecting to a serial console (ie jtag_com/jtag_gang)and showing your size either via env vars or via the 'stty size' app:673 When using a serial console there is no such mechanism and you can see the affect of this by connecting to a serial console and showing your size either via env vars or via the 'stty size' app: 674 674 {{{#!bash 675 675 ~# echo $LINES $COLUMNS … … 681 681 No matter how you resize that virtual terminal window (ie xterm), the above commands will always report the same size. 682 682 683 It is possible for the application to actively ask for the current console window size so the second best thing is to do this every time a command prompt is printed by the shell. This can be achieved by sending a ANSI code to position the cursor to 999,999 then request the cursor position.684 685 The 'resize' app from the 'xterm'package does this, but here is also a cleaner version with less dependencies:683 It is possible for the application to actively ask for the current console window size. This can be achieved by sending a ANSI code to position the cursor to 999,999 then request the cursor position. 684 685 The {{{resize}}} app from the {{{xterm}}} package does this, but here is also a cleaner version with less dependencies: 686 686 {{{#!bash 687 687 wget http://web.archive.org/web/20081224152013/http://www.davehylands.com/gumstix-wiki/resize/resize.c … … 689 689 }}} 690 690 691 You can also do this with shell scriptsthat do the same thing:691 You can also do this with a shell script that do the same thing: 692 692 {{{#!bash 693 693 resize() { … … 702 702 }}} 703 703 704 you could add this and the following to your /etc/bash.bashrc:704 you could add this and the following to your {{{/etc/bash.bashrc}}} so that the console size is detected and adjusted on login: 705 705 {{{#!bash 706 # IMX6 serial console 706 707 [[ "$(tty)" =~ "/dev/ttymxc" ]] && { resize; } 707 }}} 708 709 some people also opt to use the 'trap' shell function to execute it on every command: 708 # Newport serail console 709 [[ "$(tty)" =~ "/dev/ttyAMA" ]] && { resize; } 710 }}} 711 712 Some people also opt to use the 'trap' shell function to execute it on every command in order to adjust continually: 710 713 {{{#!bash 714 # IMX6 serial console 711 715 [[ "$(tty)" =~ "/dev/ttymxc" ]] && { trap resize DEBUG; } 716 # Newport serail console 717 [[ "$(tty)" =~ "/dev/ttyAMA" ]] && { trap resize DEBUG; } 712 718 }}} 713 719