<?xml version="1.0" encoding="UTF-8"?>
<!-- generator="FeedCreator 1.7.6(BH)" -->
<rss version="2.0">
    <channel xmlns:g="http://base.google.com/ns/1.0">
        <title>Planet Maemo: category &quot;feed:1ce491273e8f08b207014cd063a93e7f&quot;</title>
        <description>Blog entries from Maemo community</description>
        <link>http://maemo.org/news/planet-maemo/</link>
        <lastBuildDate>Sun, 24 May 2026 08:19:33 +0000</lastBuildDate>
        <generator>FeedCreator 1.7.6(BH)</generator>
        <language>en</language>
        <managingEditor>planet@maemo.org</managingEditor>
        <item>
            <title>Importance of the scheduling priority in D-Bus</title>
            <link>http://alban.apinc.org/blog/2011/02/25/importance-of-the-scheduling-priority-in-d-bus/</link>
            <description><![CDATA[
<p>Context switches are expensive. When do they happen in D-Bus communication?</p>
<p align="center"><img src="http://people.collabora.co.uk/~alban/d/2010/09/kdbus1.jpeg" alt="application1 sends a D-Bus message to application2 through dbus-daemon" height="129" width="320" /><br />
application1 sends a D-Bus message to application2 through dbus-daemon</p>
<p>The kernel may perform a context switch:</p>
<ul>
<li>During the sendmsg() system call, when application1 sends a D-Bus message to dbus-daemon</li>
<li>During the sendmsg() system call, when dbus-daemon sends a D-Bus message to application2</li>
<li>At the end of a time slice</li>
</ul>
<p>I instrumented libdbus in order to trace events such as message parsing, dispatching messages in dbus-daemon,  sendmsg(), recvmsg(). I took inspiration from <a href="http://people.gnome.org/~federico/hacks/index.html#performance-scripts">Federico&#8217;s performance scripts</a> but without using strace because straced processes have a big overhead compared to the duration of events I want to measure. <a href="http://people.collabora.co.uk/~alban/d/2011/02/0001-Add-profiling-instrumentation-in-libdbus-and-dbus-da.patch">My instrumentation</a> doesn&#8217;t save traced events in a file to avoid overhead as much as possible, but just keep them in memory and save them after the experiment is finished. This is triggered:</p>
<ol>
<li>when a process using libdbus exits. The save function is registered by atexit().</li>
<li>when a process using libdbus receives a SIGUSR2 signal. The save function is registered by sigaction().</li>
</ol>
<p>I collect logs generated by dbus-daemon and all D-Bus peers and feed them to <a href="http://git.collabora.co.uk/?p=user/alban/performance-scripts;a=shortlog;h=refs/heads/dbus">plot-timeline.py</a> to generate timelines. I estimate the overhead of logging between 3 microseconds and 5 microseconds by logging consecutively 2 events. All the experiments are run in a virtual machine with one processor.</p>
<p><strong>Experiment #1: a D-Bus signal delivered to 10 recipients</strong></p>
<p>I sent one D-Bus signal with dbus-send and received by 10 dbus-monitor. You can reuse <a href="http://people.collabora.co.uk/~alban/d/2011/02/dbus-send-signal-10-recipients.sh">this script</a>.</p>
<p align="center"><a href="http://people.collabora.co.uk/~alban/d/2011/02/signal-life1.png"><img src="http://people.collabora.co.uk/~alban/d/2011/02/signal-life1_small.png" height="520" width="200" /></a></p>
<p>In this experiment, dbus-send was context switched off during the send() system call and that system call returned after dbus-daemon received the message, sent it to the 10 recipients, and all of them received it.</p>
<p>We can see dbus-daemon iterating over every recipients and sending the message on each recipient&#8217;s socket.</p>
<p>There is 12 context switches in this experiment:</p>
<ul>
<li>1 context switch from the sender to dbus-daemon</li>
<li>10 context switches to each recipient</li>
<li>1 final context switch to the sender</li>
</ul>
<p><strong>E</strong><strong>xperiment #2: 10 D-Bus signal delivered to 10 recipients</strong></p>
<p>It is the same experiment as before but the sender emits 10 D-Bus signals (as fast as it could) instead of a single one. dbus-send cannot do that, so I used <a href="http://git.collabora.co.uk/?p=user/alban/dbus-ping-pong.git;a=summary">dbus-ping-pong</a>.</p>
<p style="text-align: center"><a href="http://people.collabora.co.uk/~alban/d/2011/02/signal-life2.png"><img src="http://people.collabora.co.uk/~alban/d/2011/02/signal-life2_small.png" height="600" width="200" /></a></p>
<p>The first three D-Bus signal are delivered in the same way; this timeline looks like the first timeline. There is also 12 context switches per D-Bus signal emitted.</p>
<p>But something different happen for the 7 next D-Bus signals: dbus-daemon is context switched off during the send() on every recipient.</p>
<p>The scheduler tries to maintain fairness along all the processes by giving them the same amount of CPU time. But dbus-daemon has about 10 times more work to do than every single recipient because it sends 10 messages and the recipients only receive 1 message. So when dbus-daemon writes on a recipient&#8217;s socket, there is two processes in the running state and the scheduler has to take a decision between a CPU hungry process (dbus-daemon) and a recipient. The recipient is chosen and it causes a context switches.</p>
<p>The context switches per D-Bus signal emitted are:</p>
<ul>
<li>1 context switch from the sender to dbus-daemon</li>
<li>1 context switch from dbus-daemon to the first recipient</li>
<li>1 context switch from the first recipient back to dbus-daemon</li>
<li>again 2 times 9 context switches between dbus-daemon and the remaining recipients</li>
<li>1 context switch from dbus-daemon to the sender</li>
</ul>
<p>That&#8217;s 22 context switches in total instead of 12 for the same amount of work and the same amount of messages delivered.</p>
<p>The experiment was run in 0.036121 seconds.</p>
<p><strong>E</strong><strong>xperiment #3: 10 D-Bus signal delivered to 10 recipients with a high priority dbus-daemon<br />
</strong></p>
<p>With the command renice, I change the priority of dbus-daemon to -15.</p>
<p align="center"><a href="http://people.collabora.co.uk/~alban/d/2011/02/signal-life3.png"><img src="http://people.collabora.co.uk/~alban/d/2011/02/signal-life3_small.png" height="600" width="200" /></a></p>
<p>In this case, the kernel chose the first scheduling strategy with 12 context switches per D-Bus signal emitted. The experiment was run in 0.019320 seconds. It is 1.8 times faster.</p>
<p>Most D-Bus messages don&#8217;t have so many recipients. But still, it is interesting to see how much the priority of dbus-daemon influences the performance.</p>
<p>On Debian, dbus-daemons (session and system bus) run with the default priority (nice level: 0). On the N900, they run with a higher priority (nice level: -5).</p>
<p><strong>E</strong><strong>xperiment #4: details of dispatching<br />
</strong></p>
<p align="left">Let&#8217;s zoom on dbus-daemon&#8217;s dispatching for two different sizes of D-Bus signals:277 bytes and 17kB.</p>
<p align="center"><a href="http://people.collabora.co.uk/~alban/d/2011/02/dbus-daemon-signal-168bytes-10recipients.png"><img src="http://people.collabora.co.uk/~alban/d/2011/02/dbus-daemon-signal-168bytes-10recipients.png" height="300" width="200" /></a> <a href="http://people.collabora.co.uk/~alban/d/2011/02/dbus-daemon-signal-16800bytes-10recipients.png"><img src="http://people.collabora.co.uk/~alban/d/2011/02/dbus-daemon-signal-16800bytes-10recipients.png" height="300" width="200" /></a></p>
<p>277 bytes D-Bus signal:</p>
<ul>
<li>Total: 524 microseconds</li>
<li>Receiving: 36 microseconds (7%)</li>
<li>Dispatch: 164 microseconds (31%)
<ul>
<li>79 microseconds in match rules</li>
</ul>
</li>
<li>Sending: 324 microseconds (62%)</li>
</ul>
<p>17kB D-Bus signal:</p>
<ul>
<li>Total: 1026 microseconds</li>
<li>Receiving: 413 microseconds (40%)</li>
<li>Dispatch: 230 microseconds (22%)
<ul>
<li>79 microseconds in match rules</li>
</ul>
</li>
<li>Sending: 383 microseconds (37%)</li>
</ul>
<span class="net_nemein_favourites">8 <a href="http://maemo.org/news/?net_nemein_favourites_execute=fav&net_nemein_favourites_execute_for=9928c4c840d411e088ba456bb60988678867&net_nemein_favourites_url=https://maemo.org/news/favorites//json/fav/midgard_article/9928c4c840d411e088ba456bb60988678867/" class="net_nemein_favourites_create"><img src="http://static.maemo.org:81/net.nemein.favourites/not-favorite.png" style="border: none;" alt="Add to favourites" title="Add to favourites" /></a>1 <a href="http://maemo.org/news/?net_nemein_favourites_execute=bury&net_nemein_favourites_execute_for=9928c4c840d411e088ba456bb60988678867&net_nemein_favourites_url=https://maemo.org/news/favorites//json/bury/midgard_article/9928c4c840d411e088ba456bb60988678867/" class="net_nemein_favourites_create"><img src="http://static.maemo.org:81/net.nemein.favourites/not-buried.png" style="border: none;" alt="Bury" title="Bury" /></a></span>]]></description>
            <author>Alban Crequy &lt;alban.crequy@collabora.co.uk&gt;</author>
            <category>feed:1ce491273e8f08b207014cd063a93e7f</category>
            <pubDate>Fri, 25 Feb 2011 11:29:34 +0000</pubDate>
            <guid>http://maemo.org/midcom-permalink-9928c4c840d411e088ba456bb60988678867</guid>
        </item>
        <item>
            <title>D-Bus traffic pattern with Telepathy</title>
            <link>http://alban.apinc.org/blog/2011/02/24/d-bus-traffic-pattern-with-telepathy/</link>
            <description><![CDATA[
<p><a href="http://telepathy.freedesktop.org/wiki/">Telepathy</a> is a big user of <a href="http://www.freedesktop.org/wiki/Software/dbus">D-Bus</a>, both on the <a href="http://www.gnome.org/">GNOME</a> desktop with <a href="http://live.gnome.org/Empathy">Empathy</a> and on the <a href="http://maemo.nokia.com/n900/">N900</a>. When I have a lot of Telepathy accounts and contacts, the start-up time could be about 10 seconds. How much is the D-Bus communication responsible for the start-up time? When I tried the <a href="http://alban.apinc.org/blog/2010/09/15/d-bus-in-the-kernel-faster/">D-Bus in the kernel</a> prototype on the N900, I win 1.3 seconds. It shows it is not negligible and there is room for improvements. But the slowness may not be due only to D-Bus itself but the way it is used. It is interesting to look at the D-Bus traffic pattern. This topic was already largely covered by <a href="http://willthompson.co.uk/">Will</a>&#8217;s  talk on <a href="http://willthompson.co.uk/talks/">Profiling and Optimizing D-Bus APIs</a> but I want to give a preview on future D-Bus analysis tools. The existing D-Bus tools dbus-monitor, <a href="http://live.gnome.org/DFeet/">D-Feet</a> and <a href="http://willthompson.co.uk/bustle/">Bustle</a> are still very useful of course.</p>
<p><strong>A glance at D-Bus messages</strong></p>
<p>The easiest to begin with is to record all the D-Bus traffic with dbus-monitor while I start Empathy, send a few messages, and quit. Let&#8217;s see if there is any surprise. dbus-monitor generated a 13MB text file containing 8313 D-Bus messages:</p>
<ul>
<li>2850 method calls</li>
<li>761 methods returns</li>
<li>4699 signals</li>
<li>3 errors</li>
</ul>
<p>The number of method calls and method returns are quite different! This is because dbus-monitor doesn&#8217;t record method returns from the bus driver (org.freedesktop.DBus, implemented by dbus-daemon). Indeed, my log file contains 2066 method calls to the bus driver:</p>
<ul>
<li>1291 <a href="http://dbus.freedesktop.org/doc/dbus-specification.html#bus-messages-add-match">AddMatch</a></li>
<li>683 <a href="http://dbus.freedesktop.org/doc/dbus-specification.html#bus-messages-remove-match">RemoveMatch</a></li>
<li>50 <a href="http://dbus.freedesktop.org/doc/dbus-specification.html#bus-messages-get-name-owner">GetNameOwner</a></li>
<li>others non significant calls</li>
</ul>
<p>Method calls for <a href="http://dbus.freedesktop.org/doc/dbus-specification.html#message-bus-routing-match-rules">D-Bus match rules</a> (AddMatch/RemoveMatch) generate a lot of traffic. The test was done with the upstream dbus-glib 0.88-2.1, without the patch on DBusGProxy (<a href="https://bugs.freedesktop.org/show_bug.cgi?id=23846">Bug #23846</a>) to have per-member match rules. If that patch was applied, the number of D-Bus match rules could be even bigger.</p>
<p>If the D-Bus match rules were implemented with <a href="http://alban.apinc.org/blog/2011/02/16/introducing-multicast-unix-sockets/">socket filters on multicast Unix sockets</a>, AddMatch and RemoveMatch messages would be completely replaced by the system call setsockopt(), reducing the number of context switches from D-Bus peers to dbus-daemon. But the situation could be improved with the current dbus-daemon implementation: 628 AddMatch are match rules on <a href="http://dbus.freedesktop.org/doc/dbus-specification.html#bus-messages-name-owner-changed">NameOwnerChanged</a> (48%), generated by dbus-glib, but there is actually only 25 unique match rules. The duplicate match rules are caused by <a href="https://bugs.freedesktop.org/show_bug.cgi?id=33646">Bug #33646</a> on DBusGProxy.</p>
<p><strong>Performance depends on the size of message</strong></p>
<p>Now, let&#8217;s have a look on the size of messages and the impact on performances. I can use <a href="http://git.collabora.co.uk/?p=user/alban/dbus-ping-pong.git;a=summary">dbus-ping-pong</a> to estimate how long it takes to send a D-Bus message with a specific size. The following script starts the ping-pong messages between two D-Bus peers, with several message sizes, and I gathered the results in the next graph:</p>
<pre>#!/bin/bash

./dbus-ping-pong server org.Echos &amp;
PID=$!
echo "Server is PID=$PID"
sleep 1

for i in 1 3 10 31 100 316 1000 3162 10000 31622 100000 316227 1000000 3162277 10000000 ; do
  echo $i
  ./dbus-ping-pong client org.Echos 100 $i
done

kill $PID</pre>
<p align="center"><img src="http://people.collabora.co.uk/~alban/d/2011/02/dbus-ping-pong-performance.png" alt="Performance of dbus-ping-pong with various message sizes" height="454" width="680" /><br />
Figure 1</p>
<p>I ran the test twice with different values of <a href="http://cgit.freedesktop.org/dbus/dbus/tree/dbus/dbus-transport-socket.c#n1274">max_bytes_read_per_iteration</a>, the size of the buffer used to read on the socket; the first time with 2048 bytes and the second time with 65536. When the read buffer is 32 times bigger, there is less recvmsg() system calls for big incoming D-Bus messages and it makes the test 28% faster.</p>
<p><strong>Usual message sizes in Telepathy</strong></p>
<p>Let&#8217;s see what are the usual sizes of messages in the context of Telepathy. I just run bustle-dbus-monitor with a patch to get the size of each message (<a href="https://bugs.freedesktop.org/show_bug.cgi?id=34067">Bug #34067</a>).</p>
<p style="text-align: center"><img src="http://people.collabora.co.uk/~alban/d/2011/02/dbus-message-sizes.png" height="454" width="680" /><br />
Figure 2</p>
<p>Most messages are between 101 bytes and 316 bytes (in orange on the graph).</p>
<p>With piecewise linear interpolation (<a href="http://people.collabora.co.uk/~alban/d/2011/02/message_size.ods">spreadsheet source</a>) based on the results of dbus-ping-pong, I can approximate how long takes the transmission of each individual message, and then what size of messages are the bottleneck and would be worth optimizing.</p>
<p>It may not be a good estimation because there is more computation in the real Telepathy scenario than in the synthetic dbus-ping-pong scenario: the number of match rules in dbus-daemon is different, there is more connections, and the Telepathy processes are not only sending D-Bus messages so the CPU caches are not behaving the same way. The real time spent in D-Bus communication should be larger than what is computed here with piecewise linear interpolation. But it can still give an idea.</p>
<p style="text-align: center"><img src="http://people.collabora.co.uk/~alban/d/2011/02/dbus-time-per-message-size.png" height="454" width="680" /><br />
Figure 3</p>
<p>For messages with a small size (under 3000 bytes), the two histograms (figure 2 and figure 3) have the same shape because the ping-pong time is almost constant for those messages. For the larger messages, they take a bit more time than their distribution because the ping-ping time is getting bigger on those messages.</p>
<p>Messages between 101 bytes and 316 bytes are the ones causing the most delay in Telepathy start-up.</p>
<p><strong>The Stats interface </strong></p>
<p>We can look at those messages in more details with the new <a href="https://bugs.freedesktop.org/show_bug.cgi?id=34040">Stats interface</a> in dbus-daemon. The script <a href="http://people.collabora.co.uk/~alban/d/2011/02/messages_stats.py">messages_stats.py</a> creates a <a href="http://people.collabora.co.uk/~alban/d/2011/02/gnome-telepathy.csv">csv file</a> from the Stats interface containing the peak size of messages, the peak number of recipients and number of each D-Bus method call and signal. With that data, I can check that no messages from Telepathy are received too broadly, and if they are, I could use the <a href="https://bugs.freedesktop.org/show_bug.cgi?id=24307"><span id="summary_alias_container"><span id="short_desc_nonedit_display">GetConnectionMatchRules </span></span>patch</a> to find the application which subscribes to a too broad match rule.</p>
<p>Most of the D-Bus messages generated by Telepathy have a reasonable number of recipients. Only 2 different D-Bus signals have more than 3 recipients, and it is only a few messages in total:</p>
<ul>
<li>org.freedesktop.Telepathy.Connection.Interface.Aliasing.AliasesChanged (4 recipients)</li>
<li>org.freedesktop.Telepathy.Connection.Interface.SimplePresence.PresencesChanged (4 recipients)</li>
</ul>
<p align="center"><img src="http://people.collabora.co.uk/~alban/d/2011/02/recipients_count_without_NameOwnerChanged.png" alt="Repartition of messages per number of recipients" height="265" width="378" /><br />
Figure 4</p>
<p>The most sent D-Bus messages by Telepathy are:</p>
<ul>
<li>org.freedesktop.Telepathy.Connection.Interface.Contacts.GetContactAttributes (17 calls)</li>
<li>org.freedesktop.Telepathy.Account.AccountPropertyChanged (11 signals)</li>
</ul>
<p>I don&#8217;t see anything obviously bad here. Telepathy is a good D-Bus citizen!</p>
<span class="net_nemein_favourites">7 <a href="http://maemo.org/news/?net_nemein_favourites_execute=fav&net_nemein_favourites_execute_for=6478a1a2403511e0b5a64ff8f0d84b754b75&net_nemein_favourites_url=https://maemo.org/news/favorites//json/fav/midgard_article/6478a1a2403511e0b5a64ff8f0d84b754b75/" class="net_nemein_favourites_create"><img src="http://static.maemo.org:81/net.nemein.favourites/not-favorite.png" style="border: none;" alt="Add to favourites" title="Add to favourites" /></a>0 <a href="http://maemo.org/news/?net_nemein_favourites_execute=bury&net_nemein_favourites_execute_for=6478a1a2403511e0b5a64ff8f0d84b754b75&net_nemein_favourites_url=https://maemo.org/news/favorites//json/bury/midgard_article/6478a1a2403511e0b5a64ff8f0d84b754b75/" class="net_nemein_favourites_create"><img src="http://static.maemo.org:81/net.nemein.favourites/not-buried.png" style="border: none;" alt="Bury" title="Bury" /></a></span>]]></description>
            <author>Alban Crequy &lt;alban.crequy@collabora.co.uk&gt;</author>
            <category>feed:1ce491273e8f08b207014cd063a93e7f</category>
            <pubDate>Thu, 24 Feb 2011 16:00:25 +0000</pubDate>
            <guid>http://maemo.org/midcom-permalink-6478a1a2403511e0b5a64ff8f0d84b754b75</guid>
        </item>
        <item>
            <title>Introducing multicast Unix sockets</title>
            <link>http://alban.apinc.org/blog/2011/02/16/introducing-multicast-unix-sockets/</link>
            <description><![CDATA[
<p>I have been working on implementing multicast Unix sockets in the Linux kernel. This allows a process to send a message on a socket to a multicast group with one system call sendmsg() and the message will be received by all sockets member of the multicast group.</p>
<p>This work has been sponsored by my employer <a href="http://www.collabora.co.uk/">Collabora</a>.</p>
<p>Several projects could benefit from this new IPC system:</p>
<ol>
<li><a href="http://www.freedesktop.org/wiki/Software/dbus">D-Bus</a><br />
D-Bus is a message bus system. Applications exchange D-Bus messages traditionally through a central process, dbus-daemon. When dbus-daemon receives the message, it determines the recipients and delivers the message to each recipient&#8217;s socket. This architecture causes dbus-daemon to wake up for every single message causing expensive context switches, memory copies and processing. If the D-Bus peers were part of a multicast group, the kernel could deliver D-Bus messages directly to the recipients. It could use <a href="http://git.kernel.org/?p=linux/kernel/git/davem/net-next-2.6.git;a=commitdiff;h=d6ae3bae3d1bf7a8bf367e29f2cac0788dcd0db5" title="socket filter implementation">socket filters</a> to deliver them only to the correct recipients, according to the D-Bus match rules.</li>
<li>The <a href="http://blog.mardy.it/2011/01/concepting-new-ipc-system.html">T IPC system</a><br />
In the same manner as D-Bus, multicast Unix sockets and socket filters could be used by the T IPC system.</li>
<li><a href="http://www.kernel.org/pub/linux/utils/kernel/hotplug/udev.html">Udev</a><br />
Udev uses Linux&#8217; netlink sockets to send multicast messages from udevd to libudev listeners. Netlink sockets are usually used for communication between the kernel and userspace, but can also be used for userspace-only communication. It has limitations though; <strike>there are only 32 multicast groups, system-wide</strike>, and only root can send multicast messages.<br />
Update: netlink does not have that limit anymore <a href="http://git.kernel.org/?p=linux/kernel/git/torvalds/linux-2.6.git;a=shortlog;h=9a4595bc7e67962f13232ee55a64e063062c3a99">since 2005</a>.</li>
</ol>
<p>My implementation aims to be a general purpose multicast IPC system, without the limitations of netlink multicast. The kernel patches and a test suite are available in git:</p>
<pre>git clone git://git.collabora.co.uk/git/user/alban/linux-2.6.35.y/.git unix-multicast18</pre>
<pre>git clone git://git.collabora.co.uk/git/user/alban/check-unix-multicast</pre>
<p>Multicast is implemented on datagram and seqpacket sockets, but not on stream sockets. It would not make sense on stream sockets because the messages are not delimited and there would be no guarantee that several senders&#8217; messages would not be mixed. The <a href="http://www.spinics.net/lists/netdev/msg153333.html">semantics</a> are different between datagram and seqpacket sockets.</p>
<p><strong>Multicast on datagram sockets </strong></p>
<p align="center"><img src="http://people.collabora.co.uk/~alban/d/2011/02/multicast-unix-sockets1.png" alt="Communication on datagram multicast Unix sockets" /></p>
<p align="left">The setsockopt() call which creates the multicast group binds the socket on the multicast address. Messages sent to the group are received by all members, including the sender, if it joined with the &#8220;loopback&#8221; feature. Socket filtering may be used by a recipient to avoid receiving messages, however this does not affect delivery of the message to other peers in the group.</p>
<p align="left">The daemon controlling the multicast group can receive the messages from the peers if the feature &#8220;send-to-peer&#8221; is enabled.</p>
<p align="left"><strong>Multicast on seqpacket sockets </strong></p>
<p align="center"> <img src="http://people.collabora.co.uk/~alban/d/2011/02/multicast-unix-sockets2.png" alt="Communication on seqpacket multicast Unix sockets" /></p>
<p>Seqpacket sockets are connection-based and the daemon can control who is able to join the group. The daemon can receive the messages from the peers on its accepted sockets (A1, A2, A3 on the diagram above) with the &#8220;send-to-peer&#8221; feature. It is useful for D-Bus: dbus-daemon can reply to the method calls on the bus driver.</p>
<p align="left"><strong>Socket filter for D-Bus</strong></p>
<p align="left">Each socket can upload a <a href="http://www.gsp.com/cgi-bin/man.cgi?section=4&amp;topic=bpf" title="Berkeley Packet Filter">socket filter (or Berkeley Packet Filter, BPF)</a> in the kernel. Socket filters are small programs, executed for every message sent to a socket. If the socket filter returns zero, the message is discarded and the process does not need to wake up.</p>
<p align="left">The socket filter could be modified and uploaded in the kernel every time the D-Bus peer wants to add or remove a D-Bus match rule and get or lose a unique or well-known name. So D-Bus messages are not delivered to every D-Bus peer but only the right recipients.</p>
<p align="left">Socket filters may be applied on SOCK_DGRAM and SOCK_SEQPACKET only. They make little sense on SOCK_STREAM because there are no message boundaries. This limits the size of D-Bus messages to about 110kB, although it can be changed with setsockopt(SO_SNDBUF) up to a maximum of 219kB (or more by tuning /proc/sys/net/core/rmem_max).</p>
<p align="left"><strong>Atomic delivery</strong></p>
<p align="left">Messages are delivered atomically to all recipients. This is true even when the sender is interrupted by a signal, killed, lacks memory or is blocked because of the flow control. I don&#8217;t want a message to be partially delivered to some recipients. When the system call sendmsg() returns an error (such as EAGAIN), it is guaranteed that nobody received the message.</p>
<p align="left"><strong>Ordering</strong></p>
<p align="left">When several senders are sending messages concurrently, the recipients need to receive messages in the same order. Here is a scenario I want to avoid:</p>
<p align="center"><img src="http://people.collabora.co.uk/~alban/d/2011/02/multicast-unix-sockets3.png" alt="Message ordering" height="378" width="294" /></p>
<p align="left">A and B are sending one message concurrently to recipients C and D. Without proper locking, the recipients could receive the messages A and B in a different order. My patches take care of this and the test suite checks that messages are received in the same order by all recipients.</p>
<p align="left"><strong>Flow control</strong></p>
<p align="left">When a reader is too slow to consume messages from its receiving queue, the receiving queue could be full. There is several ways to manage this situation:</p>
<ul>
<li>Have infinite sized receiving queues. This is not really an option, is it?</li>
<li>Drop messages, either silently or with a notification to the recipient (&#8221;you have lost some messages&#8221;). This is the correct semantic for udev. Netlink sockets notifies recipients about lost messages with ENOBUFS in recvmsg(2).</li>
<li>Block the sender. The sender will block or send() will return EAGAIN with non-blocking sockets. Poll() or select() will tell when a message can be delivered again.</li>
<li>Disconnect the slow recipient</li>
<li>Disconnect the spammy sender</li>
</ul>
<p>The correct solution for D-Bus is not trivial. This is not a new problem: even without multicast Unix sockets, dbus-daemon already has the same problem. Discussion in <a href="https://bugs.freedesktop.org/show_bug.cgi?id=33606" title="Bugzilla entry for the flow control bug">bug #33606</a>. The current implementation of multicast Unix sockets either drops messages silently or blocks the sender, depending on the setting of the multicast group.</p>
<span class="net_nemein_favourites">7 <a href="http://maemo.org/news/?net_nemein_favourites_execute=fav&net_nemein_favourites_execute_for=c0cbfe5a39f411e0a1b9c3241c819b6f9b6f&net_nemein_favourites_url=https://maemo.org/news/favorites//json/fav/midgard_article/c0cbfe5a39f411e0a1b9c3241c819b6f9b6f/" class="net_nemein_favourites_create"><img src="http://static.maemo.org:81/net.nemein.favourites/not-favorite.png" style="border: none;" alt="Add to favourites" title="Add to favourites" /></a>0 <a href="http://maemo.org/news/?net_nemein_favourites_execute=bury&net_nemein_favourites_execute_for=c0cbfe5a39f411e0a1b9c3241c819b6f9b6f&net_nemein_favourites_url=https://maemo.org/news/favorites//json/bury/midgard_article/c0cbfe5a39f411e0a1b9c3241c819b6f9b6f/" class="net_nemein_favourites_create"><img src="http://static.maemo.org:81/net.nemein.favourites/not-buried.png" style="border: none;" alt="Bury" title="Bury" /></a></span>]]></description>
            <author>Alban Crequy &lt;alban.crequy@collabora.co.uk&gt;</author>
            <category>feed:1ce491273e8f08b207014cd063a93e7f</category>
            <pubDate>Wed, 16 Feb 2011 16:20:05 +0000</pubDate>
            <guid>http://maemo.org/midcom-permalink-c0cbfe5a39f411e0a1b9c3241c819b6f9b6f</guid>
        </item>
        <item>
            <title>D-Bus in the kernel, faster!</title>
            <link>http://alban.apinc.org/blog/2010/09/15/d-bus-in-the-kernel-faster/</link>
            <description><![CDATA[
<p>In the last few weeks at <a href="http://www.collabora.co.uk/" title="Collabora">Collabora</a>, I worked on having D-Bus directly in the Linux kernel to improve its performances. I based my work on <a href="http://www.mnementh.co.uk/home/projects/collabora/kdbus">what Ian Molton did</a>. For now it&#8217;s just a prototype, but some benchmarks I did show a good performance improvement.</p>
<p><strong>The cost of context switches</strong></p>
<p>When an application sends a message on the bus to another application, the message is first sent to dbus-daemon through an Unix socket. The kernel copies the message to the receiving queue of dbus-daemon and dbus-daemon wakes up. Then dbus-daemon adds the <a href="http://dbus.freedesktop.org/doc/dbus-specification.html#message-protocol-header-fields">sender field in the header</a> of the message, and sends it to the recipients according to the <a href="http://dbus.freedesktop.org/doc/dbus-specification.html#message-protocol-header-fields">destination field</a> and the <a href="http://dbus.freedesktop.org/doc/dbus-specification.html#message-bus-routing-match-rules">match rules</a> (usually one recipient but there could be more for signals or in case of eavesdropping).</p>
<p align="center"><img src="http://people.collabora.co.uk/~alban/d/2010/09/kdbus1.jpeg" alt="D-Bus message transmission with dbus-daemon" height="129" width="320" /><br />
D-Bus message transmission with dbus-daemon</p>
<p>So dbus-daemon wakes up on every message, it costs a context switch and a memory copy.</p>
<p><strong>Don&#8217;t wake up, dbus-daemon!</strong></p>
<p>The idea of D-Bus in the kernel is to deliver the message directly to the right recipients without waking up any intermediary process. We added a new kind of socket, “AF_DBUS”, that behaves in a similar way to Unix sockets. Every application using DBus would need to use the new socket type, but that just means changing libdbus and the few other libraries for D-Bus.</p>
<p align="center"><img src="http://people.collabora.co.uk/~alban/d/2010/09/kdbus2.jpeg" alt="Introducing AF_DBUS" height="125" width="318" /><br />
Introducing AF_DBUS</p>
<p align="left">The kdbus kernel module reads all the messages and check for the messages &#8220;<a href="http://dbus.freedesktop.org/doc/dbus-specification.html#bus-messages-hello">Hello</a>&#8220;, &#8220;<a href="http://dbus.freedesktop.org/doc/dbus-specification.html#bus-messages-name-acquired">NameAcquired</a>&#8220;, &#8220;<a href="http://dbus.freedesktop.org/doc/dbus-specification.html#bus-messages-name-lost">NameLost</a>&#8221; and &#8220;<a href="http://dbus.freedesktop.org/doc/dbus-specification.html#bus-messages-add-match">AddMatch</a>&#8221; to get to know the <a href="http://dbus.freedesktop.org/doc/dbus-specification.html#message-bus-names">unique names</a>, the well-known names and the <a href="http://dbus.freedesktop.org/doc/dbus-specification.html#message-bus-routing-match-rules">match rules</a>. Then it is able to deliver the messages only to the right applications and shortcut dbus-daemon. If there are several recipients, the message is still memcpied only one time thanks to <a href="http://lxr.free-electrons.com/ident?i=skb_clone" title="skb_clone implementation">skb_clone()</a>.</p>
<p align="center"><img src="http://people.collabora.co.uk/~alban/d/2010/09/kdbus3.jpeg" alt="Introducing AF_DBUS" height="191" width="367" /><br />
AF_DBUS does not wake up dbus-daemon unnecessarily</p>
<p>The prototype still uses dbus-daemon for authentication and D-Bus activation. The bus driver org.freedesktop.DBus is still implemented in dbus-daemon.</p>
<p><strong>New performances</strong></p>
<p>The first benchmark is <a href="http://people.collabora.co.uk/~alban/d/2010/09/dbus-ping-pong.tar.gz" title="dbus-ping-pong sources">dbus-ping-pong</a>. It is a simple tool to call a D-Bus method and wait for the reply 10000 times. I tried it both on a KVM/i386 virtual machine and on a N900/arm.</p>
<ul>
<li>KVM/i386, without kdbus: 3.887s</li>
<li>KVM/i386, with kdbus: 2.085s (x1.8)</li>
<li>N900/arm, without kdbus: 28.00s</li>
<li>N900/arm, with kdbus: 9.23s (x3)</li>
</ul>
<p>I tried <a href="http://blogs.gnome.org/abustany/" title="Adrien's blog">Adrien Bustany</a>&#8217;s <a href="http://git.mymadcat.com/index.php/p/ipc-performance/source/tree/master/" title="IPC performance Git Source Tree">benchmark tool</a> designed with Tracker in mind. My test is on KVM/i386 with #define CHUNK_SIZE 8 in order to have D-Bus messages of 6905 bytes (the kdbus prototype has a limitation at the moment: messages bigger than <a href="http://lxr.free-electrons.com/ident?i=SKB_MAX_ALLOC">SKB_MAX_ALLOC</a> or 8kB are still delivered to dbus-daemon so it does not bring better performances).</p>
<ul>
<li>KVM/i386, without kdbus: Fetched 300000 rows in 32874ms</li>
<li>KVM/i386, with kdbus:Fetched 300000 rows in 24368ms (26% faster - x1.35)</li>
</ul>
<p>I also tested how long does a N900 take to connect to Jabber and show my contacts&#8217; presence on the desktop widgets. I measured the time manually but ran enough tests to be sure it is consistent.</p>
<ul>
<li>N900/arm, without kdbus:  avg 11.87s</li>
<li>N900/arm, with kdbus: avg 10.56s (x1.12)</li>
</ul>
<p><strong>Sources</strong></p>
<p>Keep in mind this is only a proof-of-concept. It is not ready for merging and has limitations, including security ones. However,  I managed to use kdbus for both the system and session bus on a N900 and, with just a few hacks, everything worked fine.</p>
<ul>
<li><a href="http://people.collabora.co.uk/~alban/d/2010/09/libdbus-AF_DBUS.patch">libdbus-AF_DBUS.patch</a> allow AF_DBUS sockets in libdbus</li>
<li><a href="http://people.collabora.co.uk/~alban/d/2010/09/libdbus-system-bus-address.patch">libdbus-system-bus-address.patch</a> if you want to try kdbus on the system bus</li>
<li><a href="http://git.collabora.co.uk/?p=user/alban/linux-2.6.35.y/.git;a=summary">linux-2.6.35.y git tree with the kdbus branch</a></li>
</ul>
<span class="net_nemein_favourites">17 <a href="http://maemo.org/news/?net_nemein_favourites_execute=fav&net_nemein_favourites_execute_for=08d9f99cc11c11df9845cd3def8dd136d136&net_nemein_favourites_url=https://maemo.org/news/favorites//json/fav/midgard_article/08d9f99cc11c11df9845cd3def8dd136d136/" class="net_nemein_favourites_create"><img src="http://static.maemo.org:81/net.nemein.favourites/not-favorite.png" style="border: none;" alt="Add to favourites" title="Add to favourites" /></a>1 <a href="http://maemo.org/news/?net_nemein_favourites_execute=bury&net_nemein_favourites_execute_for=08d9f99cc11c11df9845cd3def8dd136d136&net_nemein_favourites_url=https://maemo.org/news/favorites//json/bury/midgard_article/08d9f99cc11c11df9845cd3def8dd136d136/" class="net_nemein_favourites_create"><img src="http://static.maemo.org:81/net.nemein.favourites/not-buried.png" style="border: none;" alt="Bury" title="Bury" /></a></span>]]></description>
            <author>Alban Crequy &lt;alban.crequy@collabora.co.uk&gt;</author>
            <category>feed:1ce491273e8f08b207014cd063a93e7f</category>
            <pubDate>Wed, 15 Sep 2010 15:03:38 +0000</pubDate>
            <guid>http://maemo.org/midcom-permalink-08d9f99cc11c11df9845cd3def8dd136d136</guid>
        </item>
        <item>
            <title>Send files to your contacts on your N900</title>
            <link>http://alban.apinc.org/blog/2010/07/30/send-files-to-your-contacts-on-your-n900/</link>
            <description><![CDATA[
<p>You can share files on your N900 via Bluetooth, E-Mail and web services (Flickr and Facebook) thanks to libsharing-dialog. But there is no file transfers to a contact through instant messaging.</p>
<p align="center"><img src="http://people.collabora.co.uk/~jonny/libsharing-share.png" alt="libsharing-dialog" height="320" width="533" /><br />
The sharing dialog with Bluetooth, E-Mail and web services features</p>
<p>But look, the sharing dialog is obviously missing a fourth button named &#8220;Share via IM&#8221;!</p>
<p>Jonny Lamb wrote <a href="http://jonnylamb.com/2010/01/14/monorail/" title="Monorail announce on Jonny's blog">Monorail, a file transfer application for the N900</a>. Monorail is a standalone application using the <a href="http://telepathy.freedesktop.org/wiki/" title="Telepathy wiki page">Telepathy framework</a> but so far it does not integrate with libsharing-dialog. Libsharing-dialog is supposed to be extensible by plugins (see the <a href="http://wiki.maemo.org/Documentation/Maemo_5_Developer_Guide/Using_Data_Sharing/Sharing_Plug-in" title="Documentation/Maemo 5 Developer Guide/Using Data Sharing/Sharing Plug-in">Sharing Plug-in documentation</a>). Unfortunately the API is more suitable for web services than for file transfers through instant messenging so it makes the work more difficult.</p>
<p>So I implemented that fourth button with some hacks to workaround the limitations of the libsharing-dialog API:</p>
<ul>
<li>The Monorail package dpkg-diverts libsharingdialog.so into /var/lib/funsharing/</li>
<li>Monorail implements a new library (aka libfunsharing) replacing libsharingdialog.so with the same ABI</li>
<li>Libfunsharing calls dlopen() on the real libsharingdialog.so</li>
<li>It also patches the class GtkTable in memory (see <a href="http://library.gnome.org/devel/gobject/unstable/gobject-The-Base-Object-Type.html#GObjectClass" title="Documentation about struct GObjectClass">struct GObjectClass-&gt;constructed</a>) just before calling the real function from libsharingdialog.so, and restore it after the call. I use this hack to get a reference to the GtkDialog and the GtkTable containing the three buttons (the libsharing-dialog API does not give us any reference to these objects)</li>
<li>In the constructed function of GtkTable, it adds a 4th button &#8220;Share via IM&#8221; which sends the filenames to share via D-Bus to Monorail</li>
<li>Monorail receives the filenames from libfunsharing via D-Bus, shows the contact selector and send the files as usual.</li>
</ul>
<p align="center"><img src="http://people.collabora.co.uk/~alban/d/2010/07/Screenshot-Monorail.png" alt="Sharing dialog with the File Transfer feature" height="320" width="533" /><br />
The sharing dialog after installing Monorail 0.3</p>
<p align="left">It works fine in the file manager and the image viewer. Do you know any other application with a file sharing feature?</p>
<p align="left">The address book can share contact cards via SMS, Bluetooth and E-Mail but it does not use libsharing-dialog, so Monorail does not automatically add my &#8220;Share via IM&#8221; button.</p>
<p align="center"><img src="http://people.collabora.co.uk/~alban/d/2010/07/ABook-Share.png" height="320" width="533" /><br />
Send a contact card from the address book</p>
<p align="left">But since PR1.2, the address book has a <a href="http://blog.barisione.org/2010-05/plugins-for-the-n900-address-book/" title="Marco's blog post, Plugins for the N900 address book">new plugin API</a> and it automatically links to your plugins installed in /usr/lib/osso-addressbook/plugins.  The plugin API is designed for <a href="http://maemo.org/api_refs/5.0/5.0-final/libosso-abook/OssoABookMenuExtension.html" title="OssoABookMenuExtension documentation">menu extensions</a> and does not have helper functions for the sharing dialog. But with <a href="http://blog.barisione.org/" title="Marco's blog">Marco</a>&#8217;s help, I replaced <a href="http://maemo.org/api_refs/5.0/5.0-final/libosso-abook/OssoABookSendContactsDialog.html" title="OssoABookSendContactsDialog documentation">OssoABookSendContactsDialog</a>&#8217;s constructed function to add the fourth button:</p>
<p align="center"><img src="http://people.collabora.co.uk/~alban/d/2010/07/ABook-Share-with-IM.png" height="320" width="533" /><br />
Send a contact card from the address book after installing Monorail 0.3</p>
<p align="left"><a href="http://maemo.org/packages/view/monorail/" title="Monorail package">Monorail 0.3</a> is available in <a href="http://wiki.maemo.org/Extras-devel" title="Maemo Extras-devel">maemo extras-devel</a>.</p>
<span class="net_nemein_favourites">9 <a href="http://maemo.org/news/?net_nemein_favourites_execute=fav&net_nemein_favourites_execute_for=ac9333789bd811df9762cd00ecae607b607b&net_nemein_favourites_url=https://maemo.org/news/favorites//json/fav/midgard_article/ac9333789bd811df9762cd00ecae607b607b/" class="net_nemein_favourites_create"><img src="http://static.maemo.org:81/net.nemein.favourites/not-favorite.png" style="border: none;" alt="Add to favourites" title="Add to favourites" /></a>1 <a href="http://maemo.org/news/?net_nemein_favourites_execute=bury&net_nemein_favourites_execute_for=ac9333789bd811df9762cd00ecae607b607b&net_nemein_favourites_url=https://maemo.org/news/favorites//json/bury/midgard_article/ac9333789bd811df9762cd00ecae607b607b/" class="net_nemein_favourites_create"><img src="http://static.maemo.org:81/net.nemein.favourites/not-buried.png" style="border: none;" alt="Bury" title="Bury" /></a></span>]]></description>
            <author>Alban Crequy &lt;alban.crequy@collabora.co.uk&gt;</author>
            <category>feed:1ce491273e8f08b207014cd063a93e7f</category>
            <pubDate>Fri, 30 Jul 2010 12:47:28 +0000</pubDate>
            <guid>http://maemo.org/midcom-permalink-ac9333789bd811df9762cd00ecae607b607b</guid>
        </item>
        <item>
            <title>Play chess with your contacts on your N900</title>
            <link>http://alban.apinc.org/blog/2010/07/09/play-chess-with-your-contacts-on-your-n900/</link>
            <description><![CDATA[
<p><a href="http://taschenorakel.de/michael/2010/07/09/miniature-goes-telepathy/" title="Michael Hasselmann's blog">Michael</a> released <a href="http://maemo.org/packages/source/view/fremantle_extras-devel_free_source/miniature/0.1.9-3/">Miniature 0.1.9-3</a> to Maemo extras-devel yesterday. With this version, you can play chess with a contact on your N900 without configuring any server thanks to <a href="http://telepathy.freedesktop.org/wiki/" title="Telepathy homepage">Telepathy</a>. There are still crashes, bugs and UI to polish, but it is demoable and you can already enjoy playing chess with your friends!</p>
<p>The <a href="http://wiki.maemo.org/Miniature/Development/Phase_2.0:_Real-time_P2P_Miniature/P2P-Protocol" title="Miniature protocol">protocol used by Miniature</a> is based on the <a href="http://www.freechess.org/Help/HelpFiles/fen.html" title="Free Internet Chess Server, Forsyth-Edwards Notation">Forsyth-Edwards Notation</a>. At the moment it sends the whole state of the board to the remote player at each move. Miniature only sends valid moves, but does not have any protections about possible unfriendly other implementations yet.</p>
<p>Miniature implements the standard <a href="http://telepathy.freedesktop.org/spec/#Clients" title="Telepathy specification">Telepathy Client interface</a> with the <a href="http://telepathy.freedesktop.org/wiki/Telepathy-Qt4" title="Telepathy-Qt4 wiki page">Telepathy-Qt4</a> library. This enables Miniature to be automatically started by <a href="http://telepathy.freedesktop.org/wiki/Mission%20Control" title="Mission Control wiki page">Mission Control</a> on your N900 when a contact invites you to play. <a href="http://telepathy.freedesktop.org/wiki/Tubes" title="Telepathy wiki page">Telepathy stream tubes</a> care about the connectivity to the remote device. The <a href="http://wiki.maemo.org/Documentation/Maemo_5_Developer_Guide/Using_Generic_Platform_Components/Using_Address_Book_API" title="Maemo documentation: Using Address Book API">Address Book API</a> is used to to show your contacts in the same way as other applications on the platform (avatars, contacts are merged correctly, status).</p>
<p align="center"><a href="http://people.collabora.co.uk/~alban/d/2010/07/Miniature.odp"><img src="http://people.collabora.co.uk/~alban/d/2010/07/Miniature.png" alt="Miniature integration with Telepathy" height="202" width="449" /></a><br />
Quick overview of the integration with Telepathy</p>
<p>Here is how to play chess step by step:</p>
<p align="center"><img src="http://people.collabora.co.uk/~alban/d/2010/07/Miniature01.png" alt="Miniature snapshot: menu" height="320" width="533" /><br />
1. Choose &#8220;Join P2P Game&#8221; in the main menu</p>
<p align="center"><img src="http://people.collabora.co.uk/~alban/d/2010/07/Miniature02.png" alt="Miniature snapshot: select contact" height="320" width="533" /><br />
2. Select your contact in the contact selector</p>
<p align="center"><img src="http://people.collabora.co.uk/~alban/d/2010/07/Miniature03.png" alt="Miniature snapshot: waiting contact's answer" height="320" width="533" /><br />
3. Wait your contact&#8217;s answer</p>
<p align="center"><img src="http://people.collabora.co.uk/~alban/d/2010/07/Miniature04.png" alt="Miniature snapshot: game offer" height="320" width="533" /><br />
4. Your contact is asked whether they want to join the chess game</p>
<p align="center"><img src="http://people.collabora.co.uk/~alban/d/2010/07/Miniature05.png" alt="Miniature snapshot: chess board" height="320" width="533" /><br />
5. If your contact accepts, you are ready to play!</p>
<p align="left">Feel free to join the <a href="http://wiki.maemo.org/Miniature/Development" title="Miniature development page">Miniature mailing list and IRC channel</a>.</p>
<span class="net_nemein_favourites">13 <a href="http://maemo.org/news/?net_nemein_favourites_execute=fav&net_nemein_favourites_execute_for=5b5f4c248b6811dfb3126d91e1d238283828&net_nemein_favourites_url=https://maemo.org/news/favorites//json/fav/midgard_article/5b5f4c248b6811dfb3126d91e1d238283828/" class="net_nemein_favourites_create"><img src="http://static.maemo.org:81/net.nemein.favourites/not-favorite.png" style="border: none;" alt="Add to favourites" title="Add to favourites" /></a>0 <a href="http://maemo.org/news/?net_nemein_favourites_execute=bury&net_nemein_favourites_execute_for=5b5f4c248b6811dfb3126d91e1d238283828&net_nemein_favourites_url=https://maemo.org/news/favorites//json/bury/midgard_article/5b5f4c248b6811dfb3126d91e1d238283828/" class="net_nemein_favourites_create"><img src="http://static.maemo.org:81/net.nemein.favourites/not-buried.png" style="border: none;" alt="Bury" title="Bury" /></a></span>]]></description>
            <author>Alban Crequy &lt;alban.crequy@collabora.co.uk&gt;</author>
            <category>feed:1ce491273e8f08b207014cd063a93e7f</category>
            <pubDate>Fri, 09 Jul 2010 14:40:42 +0000</pubDate>
            <guid>http://maemo.org/midcom-permalink-5b5f4c248b6811dfb3126d91e1d238283828</guid>
        </item>
        <item>
            <title>Your contacts on a map with your N900</title>
            <link>http://alban.apinc.org/blog/2010/05/21/your-contacts-on-a-map-with-your-n900/</link>
            <description><![CDATA[
<p><a href="http://live.gnome.org/Empathy">Empathy, the GNOME Instant messaging program</a>, can publish your location to your contacts and show their location on a map as explained on <a href="http://blog.pierlux.com/2009/01/22/empathy-where-are-you/en/" title="Empathy: where are you?">Pierre-Luc&#8217;s blog</a>. Can you have the same on your N900? It should not be too much work since all the needed software is available on the platform: <a href="http://telepathy.freedesktop.org/wiki/">Telepathy</a> with <a href="http://xmpp.org/extensions/xep-0080.html" title="XEP-0080: User Location">XEP-0080</a> (it works well on most Jabber servers including Ovi, but not Google&#8217;s), <a href="http://projects.gnome.org/libchamplain/">libchamplain</a>, <a href="http://blog.desmottes.be/post/2010/05/20/Azimuth-02-released" title="Azimuth 0.2 released">Azimuth</a> and <a href="http://www.pierlux.com/map-buddy/" title="Map Buddy for Maemo 5">Map Buddy</a>. But it still needed some integration.</p>
<p>Here it is! You just need to install two packages from maemo extras-devel:</p>
<ul>
<li><a href="http://maemo.org/packages/view/azimuth/" title="Azimuth">Azimuth 0.2</a></li>
<li><a href="http://maemo.org/packages/view/mapbuddy/" title="Map Buddy">Map Buddy 0.3</a></li>
</ul>
<p>Some screenshots:</p>
<p style="text-align: center"><img src="http://people.collabora.co.uk/~alban/d/2010/05/Screenshot-Map-Buddy-With-Contacts.png" alt="Map Buddy with a few contacts" height="480" width="800" /><br />
Map Buddy with a few contacts</p>
<p align="center"><img src="http://people.collabora.co.uk/~alban/d/2010/05/Screenshot-Azimuth-Control-Panel.png" alt="Azimuth configuration, in the control panel" height="480" width="800" /><br />
Azimuth configuration in the control panel</p>
<p>Click on a contact and you will be able to start a phone call or an IM conversation.</p>
<p>To debug it, I used the <a href="http://git.collabora.co.uk/?p=user/alsuren/telepathy-ashes.git;a=summary">telepathy-ashes Jabber bot</a>. I added the two commands &#8220;!setlocation&#8221; and &#8220;!unsetlocation&#8221; so you can see the contact marker moving on the map. You can try it by adding <a href="http://alsuren.wordpress.com/2009/10/16/mind-control/">the bot echo@test.collabora.co.uk</a> in your contacts.</p>
<p>If you want to help, join #maemo on Freenode, I am albanc.</p>
<span class="net_nemein_favourites">21 <a href="http://maemo.org/news/?net_nemein_favourites_execute=fav&net_nemein_favourites_execute_for=4f9861ea64d611df859f6f207bfa47f047f0&net_nemein_favourites_url=https://maemo.org/news/favorites//json/fav/midgard_article/4f9861ea64d611df859f6f207bfa47f047f0/" class="net_nemein_favourites_create"><img src="http://static.maemo.org:81/net.nemein.favourites/not-favorite.png" style="border: none;" alt="Add to favourites" title="Add to favourites" /></a>0 <a href="http://maemo.org/news/?net_nemein_favourites_execute=bury&net_nemein_favourites_execute_for=4f9861ea64d611df859f6f207bfa47f047f0&net_nemein_favourites_url=https://maemo.org/news/favorites//json/bury/midgard_article/4f9861ea64d611df859f6f207bfa47f047f0/" class="net_nemein_favourites_create"><img src="http://static.maemo.org:81/net.nemein.favourites/not-buried.png" style="border: none;" alt="Bury" title="Bury" /></a></span>]]></description>
            <author>Alban Crequy &lt;alban.crequy@collabora.co.uk&gt;</author>
            <category>feed:1ce491273e8f08b207014cd063a93e7f</category>
            <pubDate>Fri, 21 May 2010 12:21:45 +0000</pubDate>
            <guid>http://maemo.org/midcom-permalink-4f9861ea64d611df859f6f207bfa47f047f0</guid>
        </item>
        <item>
            <title>D-Bus debugging: how to use D-Feet on N900</title>
            <link>http://alban.apinc.org/blog/2010/04/01/d-bus-debugging-how-to-use-d-feet-on-n900/</link>
            <description><![CDATA[
<p>To debug problems related to D-Bus, I like to use dbus-monitor and graphical tools <a href="https://fedorahosted.org/d-feet/" title="D-Feet">D-Feet</a> and <a href="http://willthompson.co.uk/bustle/" title="Bustle">Bustle</a>. But until now, I couldn&#8217;t use D-Feet on my computer and connect to the bus on my N900 because dbus-daemon only listen on UNIX socket and listening on TCP does not work. Bustle works around the problem by using two different tools: one on the N900 to save the D-Bus traffic in a file and another one on your computer to read the file and display diagrams.</p>
<p>I implemented <a href="http://git.collabora.co.uk/?p=user/alban/dbus-daemon-proxy;a=summary" title="dbus-daemon-proxy">dbus-daemon-proxy</a> which redirects all the traffic through TCP. There is no authentication, so use this tool only on network you trust! dbus-daemon-proxy is meant to run on your N900 and connects to the local bus (either session or system) and listen on a TCP port. Then you can run D-Feet or dbus-monitor on your computer and let them connect to dbus-daemon-proxy using TCP.</p>
<p>Step by step:</p>
<ul>
<li>Get the sources:</li>
</ul>
<pre>git clone git://git.collabora.co.uk/git/user/alban/dbus-daemon-proxy</pre>
<ul>
<li>Compile it in scratchbox and copy the binary to your N900</li>
<li>Run it on your N900:</li>
</ul>
<pre>./dbus-daemon-proxy --system</pre>
<ul>
<li>Start D-Feet on your computer, use the menu File-&gt;Connect to other bus and type something like &#8220;tcp:host=myphone,port=8080,family=ipv4&#8243;:</li>
</ul>
<p><a href="http://people.collabora.co.uk/~alban/d/2010/03/D-Feet_on_N900.png"></a></p>
<p style="text-align: center"><a href="http://people.collabora.co.uk/~alban/d/2010/03/D-Feet_on_N900.png"><img src="http://people.collabora.co.uk/~alban/d/2010/03/D-Feet_on_N900.png" alt="D-Feet on N900" height="181" width="285" /></a></p>
<ul>
<li>Enjoy D-Feet!</li>
</ul>
<span class="net_nemein_favourites">0 <a href="http://maemo.org/news/?net_nemein_favourites_execute=fav&net_nemein_favourites_execute_for=0f36cfa464d311df91a7f7f90cb9e927e927&net_nemein_favourites_url=https://maemo.org/news/favorites//json/fav/midgard_article/0f36cfa464d311df91a7f7f90cb9e927e927/" class="net_nemein_favourites_create"><img src="http://static.maemo.org:81/net.nemein.favourites/not-favorite.png" style="border: none;" alt="Add to favourites" title="Add to favourites" /></a>0 <a href="http://maemo.org/news/?net_nemein_favourites_execute=bury&net_nemein_favourites_execute_for=0f36cfa464d311df91a7f7f90cb9e927e927&net_nemein_favourites_url=https://maemo.org/news/favorites//json/bury/midgard_article/0f36cfa464d311df91a7f7f90cb9e927e927/" class="net_nemein_favourites_create"><img src="http://static.maemo.org:81/net.nemein.favourites/not-buried.png" style="border: none;" alt="Bury" title="Bury" /></a></span>]]></description>
            <author>Alban Crequy &lt;alban.crequy@collabora.co.uk&gt;</author>
            <category>feed:1ce491273e8f08b207014cd063a93e7f</category>
            <pubDate>Thu, 01 Apr 2010 12:47:31 +0000</pubDate>
            <guid>http://maemo.org/midcom-permalink-0f36cfa464d311df91a7f7f90cb9e927e927</guid>
        </item>
    </channel>
</rss>
