X-Git-Url: https://pere.pagekite.me/gitweb/homepage.git/blobdiff_plain/e33b64b3c7dc92f5352ae3d932b0a47f3a55557b..2184d10a49e945b52b9c64ed88d8ca46fa16c327:/blog/index.rss diff --git a/blog/index.rss b/blog/index.rss index 2ffa1fda26..1025ac9c73 100644 --- a/blog/index.rss +++ b/blog/index.rss @@ -6,6 +6,120 @@ http://people.skolelinux.org/pere/blog/ + + Using modalias info to find packages handling my hardware + http://people.skolelinux.org/pere/blog/Using_modalias_info_to_find_packages_handling_my_hardware.html + http://people.skolelinux.org/pere/blog/Using_modalias_info_to_find_packages_handling_my_hardware.html + Tue, 15 Jan 2013 08:00:00 +0100 + <p>Yesterday, I wrote about the +<a href="http://people.skolelinux.org/pere/blog/Modalias_strings___a_practical_way_to_map__stuff__to_hardware.html">modalias +values provided by the Linux kernel</a> following my hope for +<a href="http://people.skolelinux.org/pere/blog/Lets_make_hardware_dongles_easier_to_use_in_Debian.html">better +dongle support in Debian</a>. Using this knowledge, I have tested how +modalias values attached to package names can be used to map packages +to hardware. This allow the system to look up and suggest relevant +packages when I plug in some new hardware into my machine, and replace +discover and discover-data as the database used to map hardware to +packages.</p> + +<p>I create a modaliases file with entries like the following, +containing package name, kernel module name (if relevant, otherwise +the package name) and globs matching the relevant hardware +modalias.</p> + +<p><blockquote> +Package: package-name +<br>Modaliases: module(modaliasglob, modaliasglob, modaliasglob)</p> +</blockquote></p> + +<p>It is fairly trivial to write code to find the relevant packages +for a given modalias value using this file.</p> + +<p>An entry like this would suggest the video and picture application +cheese for many USB web cameras (interface bus class 0E01):</p> + +<p><blockquote> +Package: cheese +<br>Modaliases: cheese(usb:v*p*d*dc*dsc*dp*ic0Eisc01ip*)</p> +</blockquote></p> + +<p>An entry like this would suggest the pcmciautils package when a +CardBus bridge (bus class 0607) PCI device is present:</p> + +<p><blockquote> +Package: pcmciautils +<br>Modaliases: pcmciautils(pci:v*d*sv*sd*bc06sc07i*) +</blockquote></p> + +<p>An entry like this would suggest the package colorhug-client when +plugging in a ColorHug with USB IDs 04D8:F8DA:</p> + +<p><blockquote> +Package: colorhug-client +<br>Modaliases: colorhug-client(usb:v04D8pF8DAd*)</p> +</blockquote></p> + +<p>I believe the format is compatible with the format of the Packages +file in the Debian archive. Ubuntu already uses their Packages file +to store their mappings from packages to hardware.</p> + +<p>By adding a XB-Modaliases: header in debian/control, any .deb can +announce the hardware it support in a way my prototype understand. +This allow those publishing packages in an APT source outside the +Debian archive as well as those backporting packages to make sure the +hardware mapping are included in the package meta information. I've +tested such header in the pymissile package, and its modalias mapping +is working as it should with my prototype. It even made it to Ubuntu +Raring.</p> + +<p>To test if it was possible to look up supported hardware using only +the shell tools available in the Debian installer, I wrote a shell +implementation of the lookup code. The idea is to create files for +each modalias and let the shell do the matching. Please check out and +try the +<a href="http://anonscm.debian.org/viewvc/debian-edu/trunk/src/hw-support-handler/hw-support-lookup?view=co">hw-support-lookup</a> +shell script. It run without any extra dependencies and fetch the +hardware mappings from the Debian archive and the subversion +repository where I currently work on my prototype.</p> + +<p>When I use it on a machine with a yubikey inserted, it suggest to +install yubikey-personalization:</p> + +<p><blockquote> +% ./hw-support-lookup +<br>yubikey-personalization: +<br>% +</blockquote></p> + +<p>When I run it on my Thinkpad X40 with a PCMCIA/CardBus slot, it +propose to install the pcmciautils package:</p> + +<p><blockquote> +% ./hw-support-lookup +<br>pcmciautils +<br>% +</blockquote></p> + +<p>If you know of any hardware-package mapping that should be added to +<a href="http://anonscm.debian.org/viewvc/debian-edu/trunk/src/hw-support-handler/modaliases?view=co">my +database</a>, please tell me about it.</p> + +<p>It could be possible to generate several of the mappings between +packages and hardware. One source would be to look at packages with +kernel modules, ie packages with *.ko files in /lib/modules/, and +extract their modalias information. Another would be to look at +packages with udev rules, ie packages with files in +/lib/udev/rules.d/, and extract their vendor/model information to +generate a modalias matching rule. I have not tested any of these to +see if it work.</p> + +<p>If you want to help implementing a system to let us propose what +packages to install when new hardware is plugged into a Debian +machine, please send me an email or talk to me on +<a href="irc://irc.debian.org/%23debian-devel">#debian-devel</a>.</p> + + + Modalias strings - a practical way to map "stuff" to hardware http://people.skolelinux.org/pere/blog/Modalias_strings___a_practical_way_to_map__stuff__to_hardware.html @@ -727,64 +841,5 @@ misforståelse.</p> - - Ledger - double-entry accounting using text based storage format - http://people.skolelinux.org/pere/blog/Ledger___double_entry_accounting_using_text_based_storage_format.html - http://people.skolelinux.org/pere/blog/Ledger___double_entry_accounting_using_text_based_storage_format.html - Tue, 18 Dec 2012 23:30:00 +0100 - <p>A few days ago I came across -<a href="http://joeyh.name/blog/entry/hledger/">a blog post from Joey -Hess</a> describing <a href="http://ledger-cli.org/">ledger</a> and -hledger, a text based system for double-entry accounting. I found it -interesting, as I am involved with several organizations where -accounting is an issue, and I have not really become too friendly with -the different web based systems we use. I find it hard to find what I -look for in the menus and even harder try to get sensible data out of -the systems. Ledger seem different. The accounting data is kept in -text files that can be stored in a version control system, and there - -are at least <a href="https://github.com/ledger/ledger/wiki/Ports">five -different implementations</a> able to read the format. An example -entry look like this, and is simple enough that it will be trivial to -generate entries based on CVS files fetched from the bank:</p> - -<blockquote><pre> -2004-05-27 Book Store - Expenses:Books $20.00 - Liabilities:Visa -</pre></blockquote> - -<p>The concept seemed interesting enough for me to check it out and -look for others using it. I found blog posts from -<a href="http://blog.spang.cc/posts/hledger_rocks_my_world/">Christine -Spang</a>, -<a href="http://bugsplat.info/2010-05-23-keeping-finances-with-ledger.html">Pete -Keen</a>, -<a href="http://blog.andrewcantino.com/blog/2010/11/06/command-line-accounting-with-ledger-and-reckon/">Andrew -Cantino</a> and -<a href="http://blog.iphoting.com/blog/2012/11/29/command-line-double-entry-accounting/">Ronald -Ip</a> describing how they use it, as well as a post from -<a href="https://groups.google.com/forum/?fromgroups=#!topic/ledger-cli/r0oWjwbQ9Bo">Bradley -M. Kuhn</a> at the Software Freedom Conservancy. All seemed like good -recommendations fitting my need.</p> - -<p>The <a href="http://packages.qa.debian.org/l/ledger.html">ledger</a> -package is available in Debian Squeeze, while the -<a href="http://packages.qa.debian.org/h/haskell-hledger.html">hledger</a> -package only is available in Debian Sid. As I use Squeeze, ledger -seemed the best choice to get started.</p> - -<p>To get some real data to test on, I wrote a -<a href="http://www.nuug.no/tools/lodo2ledger">web scraper</a> for -<a href="http://www.lodo.no/">LODO</a>, the accounting system used by -the <a href="http://www.nuug.no/">NUUG</a> association, and started to -play with the data set. I'm not really deeply into accounting, but I -am able to get a simple balance and accounting status for example -using the "<tt>ledger balance</tt>" command. But I will have to -gather more experience before I know if the ledger way is a good fit -for the organisations I am involved in.</p> - - -