Handling serial communication

Hi all,
I’m writing a C application for Linux OS.
The first main window opens a serial (virtual) port for receive the data from a bar-code reader.
I’m using standard open() function.
Then I call g_io_channel_new_file() and g_io_add_watch() to handle the rx signal.

Do I really need the standard open() call?

When I press a button I open a dialog child window: before that, I close the serial port by close() function and I disconnect the signal by g_io_channel_shutdown() function.
The returned status is 1 = G_IO_STATUS_NORMAL.

Starting the dialog window I open again the same port (it is a window for test) and I reconnect the rx signal in the same previous way.
Now if I read a bar-code the app crashes: if I check my debug output (printf) I see that the signal handler of the main window is called.

How can i disconnect the signal handler when I open the dialog box?


I need to call g_source_remove() with the returned value of the g_io_add_watch() call.

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.