Glib: Adding watch in the glib event poll
- From: Jacques Pelletier <jpelletier ieee org>
- To: gtk-app-devel-list gnome org
- Subject: Glib: Adding watch in the glib event poll
- Date: Fri, 25 Jan 2008 13:45:40 -0500
Hi,
I want to do a customized input routine for specialized hardware plugged into
a parallel port. I don't have any device driver yet for this hardware.
I have to poll bits; in my case, if the BUSY bit = 0, there's a character
available on the data lines.
I made my own version of add watch routines by copying the giounix.c code in
glib and modifiying to my needs.
Here are my questions:
In giounix.c there is this:
GSourceFuncs g_io_watch_funcs = {
g_io_unix_prepare,
g_io_unix_check,
g_io_unix_dispatch,
g_io_unix_finalize
};
Do I need to modify the g_io_unix_check routine for my needs also?
static gboolean
g_io_unix_check (GSource *source)
{
GIOUnixWatch *watch = (GIOUnixWatch *)source;
GIOCondition buffer_condition = g_io_channel_get_buffer_condition
(watch->channel);
GIOCondition poll_condition = watch->pollfd.revents;
return ((poll_condition | buffer_condition) & watch->condition);
}
If I use it as is, it doesn't call my read_function.
What is it supposed to check? While it's self documented, I don't get the
higher picture.
--
JP
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]