From: Johannes Berg <johannes@sipsolutions.net>
To: Norbert Preining <preining@logic.at>
Cc: Marcel Holtmann <marcel@holtmann.org>, linux-kernel@vger.kernel.org
Subject: Re: rfkill rework in 2.6.31-rc, hal/dbus access changes?
Date: Mon, 10 Aug 2009 14:40:24 +0200 [thread overview]
Message-ID: <1249908024.32614.3.camel@johannes.local> (raw)
In-Reply-To: <20090810122813.GM844@gamma.logic.tuwien.ac.at>
[-- Attachment #1: Type: text/plain, Size: 1082 bytes --]
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 #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 801 bytes --]
prev parent reply other threads:[~2009-08-10 12:41 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-07-11 9:14 rfkill rework in 2.6.31-rc, hal/dbus access changes? Norbert Preining
2009-07-11 18:54 ` Marcel Holtmann
2009-07-11 19:59 ` Norbert Preining
2009-07-11 21:12 ` Marcel Holtmann
2009-08-10 10:43 ` Norbert Preining
2009-08-10 12:22 ` Johannes Berg
2009-08-10 12:28 ` Norbert Preining
2009-08-10 12:40 ` Johannes Berg [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1249908024.32614.3.camel@johannes.local \
--to=johannes@sipsolutions.net \
--cc=linux-kernel@vger.kernel.org \
--cc=marcel@holtmann.org \
--cc=preining@logic.at \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox