Date: Sun, 11 Feb 2001 17:06:30 +0200 (IST) From: Eli Zaretskii X-Sender: eliz AT is To: Dietmar Segbert cc: djgpp AT delorie DOT com Subject: Re: termios.h and DOS In-Reply-To: <7vfRrxyrJVB@0256597511.t-online.de> Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Reply-To: djgpp AT delorie DOT com Errors-To: nobody AT delorie DOT com X-Mailing-List: djgpp AT delorie DOT com X-Unsubscribes-To: listserv AT delorie DOT com Precedence: bulk On 11 Feb 2001, Dietmar Segbert wrote: > 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. That's because they are not supported by DJGPP. > 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? Unfortunately, your problem is much deeper than the lack of some manifest constants in termios.h. The program you are trying to compile wants to program the serial device via the termios interface. This doesn't work at all with DJGPP's emulation of termios, because the DJGPP emulation supports only the DOS terminal device. It does not support the serial communications device at all. If you want to compile this program with DJGPP, you will have to add the necessary functionality for that yourself. It shouldn't be too hard to do that: you need a good async communications library (the SimTel.NET site has a couple of such libraries suitable for use with DJGPP), and you should use the Filesystem Extensions feature provided by DJGPP to reedirect normal file I/O to the async library. Once you have this in place, implementing the missing termios functionality is easy.