[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
ncurses, pthreads, and serial port
From: |
Troy Davis |
Subject: |
ncurses, pthreads, and serial port |
Date: |
Wed, 29 May 2002 17:15:59 -0500 |
Hello-
I have created a program that so far has successfully utilized ncurses.
However, I have recently run into a problem. I am trying to output some
serial input to a window. The serial input appears on the window briefly
(i.e. it flashes) and then disappears. I can see the cursor move, and it
flashes, but the input has disappeared. The program is fairly long, and I
am unsure of attachments to this list. I can send the code if someone would
like to see it.
I start by doing initscr(), init_colors(), noecho(), cbreak(), clear().
I
set up the main window (stdscr). I then create a new window as a menu. I
make simple list, put it on screen, with a very simple scroll handler to
arrow through the list. Then I create a 3rd window (upon the appropriate
menu choice) using newwin. I then call pthread_create. This creates a
thread that initializes a serial port, and then arrives at a while(1) loop.
The while loop does a read of the serial port (non-blocking) and upon a
return of 1 (a single character), does a waddch() to the appropriate window
followed by a wrefresh().
Does anyone know of any current bugs with serial ports? I am using the
O_NOCTTY flag when opening. I read something about problems with output
buffering and setvbuf.
http://dickey.his.com/ncurses/ncurses.faq.html#setvbuf_once I don't know if
this is my problem? If so, how and where exactly do I do this?
Troy Davis
Engineer
Airborne Data Systems, Inc.
- ncurses, pthreads, and serial port,
Troy Davis <=