tags:

views:

40

answers:

3

I am trying to set the special characters for a serial port in a C program. I am able to find all of the hex codes except the code for ^? (Control + Question Mark) used for erase.

Required settings:

intr = ^C; quit = ^\; erase = ^?; kill = ^X; eof = ^D; eol = <undef>; 
eol2 = <undef>; swtch = <undef>; start = ^Q; stop = ^S; susp = ^Z;
rprnt = ^R; werase = ^W; lnext = ^V; flush = ^O; min = 1; time = 5;

Setting special characters:

struct termios newtio;
newtio.c_cc[VMIN]=1;
newtio.c_cc[VTIME]=5;
newtio.c_cc[VINTR]= 0x03;
newtio.c_cc[VQUIT] = 0x1c;
newtio.c_cc[VKILL] = 0x18;
newtio.c_cc[VEOF] = 0x04;
newtio.c_cc[VEOL] = 0;
newtio.c_cc[VEOL2] = 0;
newtio.c_cc[VSWTC] = 0;
newtio.c_cc[VSTART] = 0x11;
newtio.c_cc[VSTOP] = 0x13;
newtio.c_cc[VSUSP] = 0x1A;
newtio.c_cc[VREPRINT] = 0x12;
newtio.c_cc[VWERASE] = 0x17;
newtio.c_cc[VLNEXT] = 0x16;
newtio.c_cc[VDISCARD] = 0x0f;
+3  A: 
$ od -c <<< ^?
0000000 177  \n
0000002
$

So, 0x7f.

Ignacio Vazquez-Abrams
+1  A: 

Looks like it's 127 decimal. See Wikipedia

dandan78
+1  A: 

It's typically either <- Backspace (0x08) or DEL (0x7f). Since backspace will almost always render as ^H (CTRLH), I would suggest 0x7f is the one to try.

paxdiablo