Re: [Utopia] kernel -> dbus event delivery?



On Fri, Jul 09, 2004 at 08:44:56PM -0400, Robert Love wrote:
> On Fri, 2004-07-09 at 19:18 +0200, Kay Sievers wrote:
> 
> > Here is the next round. I've made a small bridge from the netlink socket
> > to the dbus-system-daemon. Everything needed, you can get from here:
> > 
> >   http://vrfy.org/projects/kdbusd/
> > 
> > Just patch your kernel, install the dbus-policy, compile and run './kdbusd' and
> > watch the emitted dbus-events with 'python kernel-listen.py', while mounting a
> > filesystem or putting a media in your CDROM. Easy, isnt't it :)
> 
> Awesome, Kay!

Yeah, it's fun, thanks. Here is the new version, with the usual screenshot,
cause it seems, that the people don't want to look at code :)

  http://vrfy.org/projects/kdbusd/kdbusd.png

The whole kernel part is renamed from 'dbus' to 'kmessage'.

  void kmessage_send(int type, const char *object, const char *signal, const char *fmt, ...)

A message requires now a object-path and a signal-name. Optional data can
be appended. Over the wire, the kernel sends (strace):

  recv(3, "From: /org/kernel/hotplug\nSignal: add\nDevpath: /class/input/mouse2\nSeqnum: 325\n\0", 4096, 0) = 80

Which reads in cleartext as:

  From: /org/kernel/hotplug
  Signal: add
  Devpath: /class/input/mouse2
  Seqnum: 325



Our favourite 'hot cpu message' is called like this:

  kmessage_send(KMSG_POWER, "/org/kernel/devices/system/cpu/temperature", "high", "Cpu: %d\n", cpu);

The kdbusd receives the message, and emits the signal on the given object.
Every key/value string apppended to the message is available to the dbus
client as a seperate string (look at the example in python).

Any comment about:
  the name for the kernel part,
  the separate signal parameter,
  the mail-header-style message format (spam from the kernel now?),
  the slashes in the object name :)
  ...

are more than welcome.

Thanks,
Kay



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