Re: rfkill rework in 2.6.31-rc, hal/dbus access changes?

From: Johannes Berg
Date: Mon Aug 10 2009 - 08:41:13 EST


On Mon, 2009-08-10 at 14:28 +0200, Norbert Preining wrote:

> And threads I need (AFAIU) because the read from the fd will blcok
> until there is an event, and in the mean time the user might
> do something with the applet (like disabling manually the rfkill,
> or configuration). So one thread is listening to user events (the
> normal pygtk loop) and one is reading from /dev/rfkill and
> in case something comes in it takes the respective actions.
>
> In python-speak I do:
>
> fd = os.open("/dev/rfkill", os.O_RDONLY)
> p = select.poll()
> p.register(fd, select.POLLIN | select.POLLHUP)
> n = p.poll()
> if (t == select.POLLIN)
> buf = os.read(fd, 8)
> ....
>
> Isn't that supposed to work like that?

Oh, that's what you mean by polling...

Well, you still don't need threads, since you can just add your fd to
the gtk event loop. You'd probably use
http://library.gnome.org/devel/glib/unstable/glib-IO-Channels.html#g-io-add-watch and http://library.gnome.org/devel/glib/unstable/glib-IO-Channels.html#g-io-channel-unix-new

johannes

Attachment: signature.asc
Description: This is a digitally signed message part