Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 6 Feb 2013 07:50:50 +0100
From:      Polytropon <freebsd@edvax.de>
To:        s m <sam.gh1986@gmail.com>
Cc:        freebsd-questions <freebsd-questions@freebsd.org>
Subject:   Re: backspace shows ^? in serial communications
Message-ID:  <20130206075050.b4e5b48e.freebsd@edvax.de>
In-Reply-To: <CAA_1SgEi27zfihTopo6BfQ2fr_sBUew4u3M0Y1oV67c=bDQ5Cw@mail.gmail.com>
References:  <CAA_1SgEi27zfihTopo6BfQ2fr_sBUew4u3M0Y1oV67c=bDQ5Cw@mail.gmail.com>

next in thread | previous in thread | raw e-mail | index | archive | help
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, ...



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20130206075050.b4e5b48e.freebsd>