backspace shows ^? in serial communications

Polytropon freebsd at edvax.de
Wed Feb 6 06:50:51 UTC 2013


On Wed, 6 Feb 2013 09:44:37 +0330, s m wrote:
> hi all
> 
> i have a problem with backspace in serial communications. i have a
> freebsd8.2 box with a serial card on it. when i connect to other freebsd
> box via serial port backspace does not act as i expected. backspace shows
> ^? on screen. i searched alot and find out that stty has two parameters
> -erase and erase2- to identify erase characters in terminal and they should
> be set correctly. i set erase and erase2 to ^? by "stty erase \^?" and
> "stty erase2 \^?" commands but nothing happened.
> please let me know how i can fix it. i know it is simple issue but i really
> do not know how to do that.

If I remember correctly, ^? is delete, ^H is backspace. You
should check your terminal emulator if it outputs ^? instead
of ^H when you press the backspace key.

FreeBSD's default configuration handles keys correctly (if
you have the proper terminal emulation set, e. g. vt100 or
vt220 for your serial line), so there's probably something
wrong with the settings of the terminal program you're using.

For comparison:

% echo $TERM
xterm
% stty -a
speed 9600 baud; 24 rows; 80 columns;
lflags: icanon isig iexten echo echoe echok echoke -echonl echoctl
        -echoprt -altwerase -noflsh -tostop -flusho -pendin -nokerninfo
        -extproc
iflags: -istrip icrnl -inlcr -igncr ixon -ixoff -ixany -imaxbel -ignbrk
        -brkint -inpck -ignpar -parmrk
oflags: opost onlcr -ocrnl tab3 -onocr -onlret
cflags: cread cs8 parenb -parodd hupcl -clocal -cstopb -crtscts -dsrflow
        -dtrflow -mdmbuf
cchars: discard = ^O; dsusp = ^Y; eof = ^D; eol = <undef>;
        eol2 = <undef>; erase = ^H; erase2 = ^H; intr = ^C; kill = ^U;
        lnext = ^V; min = 1; quit = ^\; reprint = ^R; start = ^Q;
        status = ^T; stop = ^S; susp = ^Z; time = 0; werase = ^W;

And:

% echo $TERM
cons25l1
% stty -a
speed 9600 baud; 25 rows; 80 columns;
lflags: icanon isig iexten echo echoe -echok echoke -echonl echoctl
        -echoprt -altwerase -noflsh -tostop -flusho -pendin -nokerninfo
        -extproc
iflags: -istrip icrnl -inlcr -igncr ixon -ixoff ixany imaxbel -ignbrk
        brkint -inpck -ignpar -parmrk
oflags: opost onlcr -ocrnl tab0 -onocr -onlret
cflags: cread cs8 -parenb -parodd hupcl -clocal -cstopb -crtscts -dsrflow
        -dtrflow -mdmbuf
cchars: discard = ^O; dsusp = ^Y; eof = ^D; eol = <undef>;
        eol2 = <undef>; erase = ^H; erase2 = ^H; intr = ^C; kill = ^U;
        lnext = ^V; min = 1; quit = ^\; reprint = ^R; start = ^Q;
        status = ^T; stop = ^S; susp = ^Z; time = 0; werase = ^W;

If you want the system's C shell to treat ^? (delete) as
it should be treated (perform delete instead of backspace
or "nothing"), add those to your .cshrc:

	bindkey ^? delete-char		# for console
	bindkey ^[[3~ delete-char	# for xterm

Note that this only affects the C shell.



-- 
Polytropon
Magdeburg, Germany
Happy FreeBSD user since 4.0
Andra moi ennepe, Mousa, ...


More information about the freebsd-questions mailing list