Mail Archives: djgpp/2002/10/17/01:55:52
On Thu, 17 Oct 2002, Hyeong-Tae Jou wrote:
> In Linux, I used C-functions like
> open(), tcsetattr(), and read()
> for opening, setting parameter, and reading data from
> serial port.
>
> I am trying to use the same C-code in Win2000.
Sorry, this won't work. The DJGPP emulation of termios functions works
only for terminals, it doesn't support COM1 serial port. This is
actually documented in the library docs of termios functions, which see.
> How can I read the actual bytes in serial port buffer ?
> Is there any functions to check the bytes in buffer of serial port.
> "ioctl(fd, FIONREAD, &nbyte)" doesn't work in DOS (Win2000).
You will need to use the DJGPP Filesystem Extension machinery to extend
ioctl and termios to support COM1. There are libraries out there that
support fast interrupt-driven serial I/O (one of them was mentioned in
this thread; see the DJGPP FAQ section 22.4 for more pointers), but you
will have to add wrappers to those libraries to use file I/O and termios
with them.
- Raw text -