backspace shows ^? in serial communications

s m sam.gh1986 at gmail.com
Wed Feb 6 08:11:06 UTC 2013


thanks for your answer.
you know, i have a freebsd box (something like router) which i connect to
it by putty or other terminal programs (cu,...). this router has a serial
card and i have a c program to open and manage serial ports. now when i run
this c program and connect to the third freebsd box, backspace shows ^?.
now i don't know where is problem and for which system terminal settings
should be checked.
from you explanation i think that i should check serial settings in c
program in the router box. am i right?
please let me know what should i do to this program (c program in router
box) show backspace correctly when i connect by different serial programs
to router box and run it.

thanks

On Wed, Feb 6, 2013 at 10:20 AM, Polytropon <freebsd at edvax.de> wrote:

> 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