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

From: Norbert Preining
Date: Mon Aug 10 2009 - 08:28:23 EST


Hi Johannes,

thanks a lot for your remarks, and sorry, in fact I am a complete
ignorant wrt all these things, just programming what I need ;-)
Some questions:

On Mo, 10 Aug 2009, Johannes Berg wrote:
> Umm. That's wrong in multiple ways. You don't need threads, and you
> don't need to poll. Just open /dev/rfkill, add the fd to the event loop
> and read events.

Aehm, I am doing exactely what the user space
rfkill event
is doing. Isn't that supposed to be?

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?

At least that is what rfkill.c does in the event loop.

Best wishes

Norbert

-------------------------------------------------------------------------------
Dr. Norbert Preining <preining@xxxxxxxx> Vienna University of Technology
Debian Developer <preining@xxxxxxxxxx> Debian TeX Group
gpg DSA: 0x09C5B094 fp: 14DF 2E6C 0307 BE6D AD76 A9C0 D2BF 4AA3 09C5 B094
-------------------------------------------------------------------------------
TODBER (n.)
One whose idea of a good time is to stand behind his front hedge and
give surly nods to people he doesn't know.
--- Douglas Adams, The Meaning of Liff
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/