Mail Archives: djgpp/2001/02/11/09:11:40
Hello,
i have some questions to termios.h.
In a program, i will compile, i found some variables called IUCLC, XCASE,
IXANY, B57600, B115200.
In the headerfile of termios.h i did noht find some
definitions.
In the web i found some definitions for termios(4) for unix:
c_iflag Describes the basic terminal input control. The possible input
modes are:
...
IUCLC Maps uppercase to lowercase on input. If set, a
received uppercase, alphabetic character is translated
into the corresponding lowercase character.
...
IXANY Enables any character to restart output. If set, any
input character restarts output that was suspended.
c_lflag Controls various terminal functions. In addition to the basic
modes, this field uses the following mask name symbols:
...
XCASE Enables canonical uppercase and lowercase presentation.
If set along with the ICANON function, an uppercase
letter (or the uppercase letter translated to lowercase
by the IUCLC input mode) is accepted on input by
preceding it with a \ (backslash) character. The out-
put is then preceded by a backslash character.
...
The ICANON, XCASE, ECHO, ECHOE, ECHOK, ECHONL, and
NOFLSH special input functions are possible only if the
ISIG function is set. These functions can be disabled
individually by changing the value of the control char-
acter to an unlikely or impossible value (for example,
0377 octal or 0xFF)
c_ispeed Specifies the input baud rate.
The default input baud rate is 9600. However, the input baud
rate can be specified to be one of the following:
...
B57600 57600 baud.
B115200 115200 baud.
In another File i found this definitions:
#define IXANY 0x0800 /* allow any key to continue ouptut */
#define B57600 0x0100 /* 57600 baud */
#define B115200 0x0200 /* 115200 baud */
The procedure in my program looks like this:
* *
* open - prepare serial port for use, and send initialization *
* packets to camera. *
* *
*---------------------------------------------------------------------*/
int qm100_open(const char *devname)
{
int serialdev;
qm100_packet_block packet;
char cmd[]=QM100_INIT;
serialdev = open(devname, O_RDWR | O_NOCTTY);
if (serialdev <= 0)
{
char tmsg[100];
sprintf(tmsg, "Unable to open serial device %s", devname);
qm100_error(serialdev, tmsg, errno);
}
/* This does nicht do */
if (tcgetattr(serialdev, &oldt) < 0)
qm100_error(serialdev, "Unable to get serial device attributes", errno);
memcpy((char *)&newt,(char *)&oldt, sizeof(struct termios));
newt.c_cflag |= CS8 | HUPCL;
newt.c_iflag &= ~(IGNBRK|BRKINT|IGNPAR|PARMRK|INPCK|ISTRIP|INLCR);
/* next line ist original, second line from me */
/* newt.c_iflag &= ~(IGNCR|ICRNL|IXON|IXOFF|IXANY|IMAXBEL); */
newt.c_iflag &= ~(IGNCR|ICRNL|IXON|IXOFF|IMAXBEL);
newt.c_oflag &= ~(OPOST);
newt.c_lflag &= ~(ISIG|ICANON);
newt.c_cc[VMIN] = 1;
newt.c_cc[VTIME] = 0;
cfsetospeed(&newt, B9600);
cfsetispeed(&newt, B9600);
if (tcsetattr(serialdev, TCSANOW, &newt) < 0)
qm100_error(serialdev, "Unable to set serial device attributes", errno);
qm100_transmit(serialdev, cmd, sizeof(cmd), &packet, "Open");
qm100_setSpeed(serialdev, qm100_transmitSpeed);
return serialdev;
}
Does it give a termios.h / termios.c source, who includes the above
describet functions IXANY, IUCLC and so on?
Thanks
Dietmar
- Raw text -