1 Title: Using modalias info to find packages handling my hardware
5 <p>Yesterday, I wrote about the
6 <a href="http://people.skolelinux.org/pere/blog/Modalias_strings___a_practical_way_to_map__stuff__to_hardware.html">modalias
7 values provided by the Linux kernel</a> following my hope for
8 <a href="http://people.skolelinux.org/pere/blog/Lets_make_hardware_dongles_easier_to_use_in_Debian.html">better
9 dongle support in Debian</a>. Using this knowledge, I have tested how
10 modalias values attached to package names can be used to map packages
11 to hardware. This allow the system to look up and suggest relevant
12 packages when I plug in some new hardware into my machine, and replace
13 discover and discover-data as the database used to map hardware to
16 <p>I create a modaliases file with entries like the following,
17 containing package name, kernel module name (if relevant, otherwise
18 the package name) and globs matching the relevant hardware
23 <br>Modaliases: module(modaliasglob, modaliasglob, modaliasglob)</p>
26 <p>It is fairly trivial to write code to find the relevant packages
27 for a given modalias value using this file.</p>
29 <p>An entry like this would suggest the video and picture application
30 cheese for many USB web cameras (interface bus class 0E01):</p>
34 <br>Modaliases: cheese(usb:v*p*d*dc*dsc*dp*ic0Eisc01ip*)</p>
37 <p>An entry like this would suggest the pcmciautils package when a
38 CardBus bridge (bus class 0607) PCI device is present:</p>
42 <br>Modaliases: pcmciautils(pci:v*d*sv*sd*bc06sc07i*)
45 <p>An entry like this would suggest the package colorhug-client when
46 plugging in a ColorHug with USB IDs 04D8:F8DA:</p>
49 Package: colorhug-client
50 <br>Modaliases: colorhug-client(usb:v04D8pF8DAd*)</p>
53 <p>I believe the format is compatible with the format of the Packages
54 file in the Debian archive. Ubuntu already uses their Packages file
55 to store their mappings from packages to hardware.</p>
57 <p>By adding a XB-Modaliases: header in debian/control, any .deb can
58 announce the hardware it support in a way my prototype understand.
59 This allow those publishing packages in an APT source outside the
60 Debian archive as well as those backporting packages to make sure the
61 hardware mapping are included in the package meta information. I've
62 tested such header in the pymissile package, and its modalias mapping
63 is working as it should with my prototype. It even made it to Ubuntu
66 <p>To test if it was possible to look up supported hardware using only
67 the shell tools available in the Debian installer, I wrote a shell
68 implementation of the lookup code. The idea is to create files for
69 each modalias and let the shell do the matching. Please check out and
71 <a href="http://anonscm.debian.org/viewvc/debian-edu/trunk/src/hw-support-handler/hw-support-lookup?view=co">hw-support-lookup</a>
72 shell script. It run without any extra dependencies and fetch the
73 hardware mappings from the Debian archive and the subversion
74 repository where I currently work on my prototype.</p>
76 <p>When I use it on a machine with a yubikey inserted, it suggest to
77 install yubikey-personalization:</p>
81 <br>yubikey-personalization
85 <p>When I run it on my Thinkpad X40 with a PCMCIA/CardBus slot, it
86 propose to install the pcmciautils package:</p>
94 <p>If you know of any hardware-package mapping that should be added to
95 <a href="http://anonscm.debian.org/viewvc/debian-edu/trunk/src/hw-support-handler/modaliases?view=co">my
96 database</a>, please tell me about it.</p>
98 <p>It could be possible to generate several of the mappings between
99 packages and hardware. One source would be to look at packages with
100 kernel modules, ie packages with *.ko files in /lib/modules/, and
101 extract their modalias information. Another would be to look at
102 packages with udev rules, ie packages with files in
103 /lib/udev/rules.d/, and extract their vendor/model information to
104 generate a modalias matching rule. I have not tested any of these to
107 <p>If you want to help implementing a system to let us propose what
108 packages to install when new hardware is plugged into a Debian
109 machine, please send me an email or talk to me on
110 <a href="irc://irc.debian.org/%23debian-devel">#debian-devel</a>.</p>