{"id":362,"date":"2009-07-02T15:00:11","date_gmt":"2009-07-02T14:00:11","guid":{"rendered":"http:\/\/albertomilone.com\/wordpress\/?p=362"},"modified":"2009-07-02T15:00:11","modified_gmt":"2009-07-02T14:00:11","slug":"x-bus-a-daemon-for-input-devices","status":"publish","type":"post","link":"https:\/\/albertomilone.com\/blog\/x-bus-a-daemon-for-input-devices\/","title":{"rendered":"X-Bus &#8211; a daemon for input devices"},"content":{"rendered":"<p><strong>What is X-Bus?<\/strong><\/p>\n<p>It&#8217;s a personal project I&#8217;ve been working on (among other things) since I joined Canonical. It&#8217;s a daemon which handles input devices through the XInput protocol. In the future I hope to add support for outputs too.<\/p>\n<p><strong>What&#8217;s the purpose of X-Bus?<\/strong><\/p>\n<p>Its main purpose is to provide developers with a common (and simplified) way to access XInput from languages which have DBus bindings (Python, Ruby, C, C++, Java, Perl, etc.). It is not specific to any desktop environment, even though it uses C++ and QT4 (see below).<\/p>\n<p>Wouldn&#8217;t it be nice if we could have KDE, Gnome, Xfce, etc. applications which make use of the same backend with different frontends (as opposed to having different backends and frontends)?<\/p>\n<p><strong>Current features:<\/strong><\/p>\n<ul>\n<li>Exposes XInput (listing\/setting properties, catching signals, etc.) through Dbus with a simplified API.<\/li>\n<li>Stores the (per-user) current inputs configuration in an XML file and applies it at startup or when requested.<\/li>\n<li>Emits signals (through Dbus) when new devices are plugged in or unplugged (so that, for example your client application can refresh its UI to reflect the new situation).<\/li>\n<li>Tracks keyboard activity so as to disable your touchpad when you&#8217;re typing.<\/li>\n<\/ul>\n<p>It&#8217;s an attempt to combine the features in syndaemon and xinput (the command line tool), from both of which X-Bus borrows code.<\/p>\n<p><strong>3 examples of what X-Bus can be used for:<\/strong><\/p>\n<ul>\n<li>User interfaces to configure touchpads (which is the 1st thing I would like to work on).<\/li>\n<li>User interfaces to configure touchscreens whose drivers support XInput (I still need to expose the calibration functions provided by XInput though).<\/li>\n<li>Automatic rotation of your touchpad (figuratively speaking) when your screen is rotated (after <a href=\"http:\/\/bugs.freedesktop.org\/show_bug.cgi?id=21129\">this<\/a> is implemented).<\/li>\n<\/ul>\n<p><strong>Why QT?<\/strong><\/p>\n<p>Because of its DBus and XML modules and because it&#8217;s a pleasure to work with QT in general.<\/p>\n<p>Example: if you add the Q_SCRIPTABLE macro to the function in the header file, this function will be made available in your DBus interface. This applies to signals too. This makes maintenance a lot easier.<\/p>\n<p>In my opinion it would be overkill to use the DBus low-level API and I don&#8217;t think the glib (DBus) bindings can offer what I described in the example (feel free to prove me wrong on this). Furthermore I would have to use an external xml module to perform validation and the things that I currently do with the xml file.<\/p>\n<p><strong>Doesn&#8217;t it duplicate efforts? Why don&#8217;t you work on $INSERT_DAEMON_HERE instead?<\/strong><\/p>\n<p>Yes, <a href=\"http:\/\/git.gnome.org\/cgit\/gnome-settings-daemon\/commit\/?id=4eb9bd09219afbb56f114a2d10bc585e24db803e\">it does<\/a> (partially) but my point is: can we use $INSERT_DAEMON_HERE on KDE, Gnome, Xfce, etc. ?<\/p>\n<p>Furthermore, if you have a look at X-Bus&#8217; API you&#8217;ll see that (currently) there&#8217;s very little duplication.<\/p>\n<p><strong>Where&#8217;s the code?<\/strong><\/p>\n<p><a href=\"https:\/\/code.launchpad.net\/~albertomilone\/x-bus\/trunk\">Source code<\/a> (have a look at the examples which are written in Python)<br \/>\n<a href=\"https:\/\/launchpad.net\/~albertomilone\/+archive\/x-bus-ppa\">Packages<\/a><\/p>\n<p><strong>NOTE:<\/strong> this is just a first release and users won&#8217;t benefit from it without a user interface (unless they want to edit the xml file manually).<\/p>\n","protected":false},"excerpt":{"rendered":"<p>What is X-Bus? It&#8217;s a personal project I&#8217;ve been working on (among other things) since I joined Canonical. It&#8217;s a daemon which handles input devices through the XInput protocol. In the future I hope to add support for outputs too. What&#8217;s the purpose of X-Bus? Its main purpose is to provide developers with a common <a class=\"read-more\" href=\"https:\/\/albertomilone.com\/blog\/x-bus-a-daemon-for-input-devices\/\">[&hellip;]<\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[5,7,9],"tags":[],"class_list":["post-362","post","type-post","status-publish","format-standard","hentry","category-planet","category-qt","category-ubuntu"],"_links":{"self":[{"href":"https:\/\/albertomilone.com\/blog\/wp-json\/wp\/v2\/posts\/362","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/albertomilone.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/albertomilone.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/albertomilone.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/albertomilone.com\/blog\/wp-json\/wp\/v2\/comments?post=362"}],"version-history":[{"count":0,"href":"https:\/\/albertomilone.com\/blog\/wp-json\/wp\/v2\/posts\/362\/revisions"}],"wp:attachment":[{"href":"https:\/\/albertomilone.com\/blog\/wp-json\/wp\/v2\/media?parent=362"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/albertomilone.com\/blog\/wp-json\/wp\/v2\/categories?post=362"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/albertomilone.com\/blog\/wp-json\/wp\/v2\/tags?post=362"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}