Monitoring IO



Hello,

        I'm working on some applications that need to monitor and interact
with arbitrary external IO (for now, the serial port).  For starters
(since I'm new to GTK development), I wrote a tiny app that instantiates a
GtkText widget, registers a GIO Channel via the gtk_input_add_full()
wrapper, and writes to the GtkText box from the input callback:

s_port = fopen( "/dev/ttyS0", "r" );

off = gtk_input_add_full( (gint) s_port, GDK_INPUT_READ,
                                (GdkInputFunction) input_callback,
                                NULL, data, NULL );


The input_callback function looks like this:

void input_callback( gpointer          data, gint              source, 
                     GdkInputCondition condition )
{
        gtk_text_insert( GTK_TEXT(textedit), NULL, NULL, NULL, "data
added\n", -1 );

}

        For some reason the input_callback function never gets called.
I suspect I'm not using the FILE pointer correctly, but I don't know how.
Can someone tell me what I'm missing here?

Thanks,
Chris





[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]