1 Title: Modalias strings - a practical way to map "stuff" to hardware
5 <p>While looking into how to look up Debian packages based on hardware
6 information, to find the packages that support a given piece of
7 hardware, I refreshed my memory regarding modalias values, and decided
8 to document the details. Here are my findings so far, also available
10 <a href="http://anonscm.debian.org/viewvc/debian-edu/trunk/src/hw-support-handler/">the
11 Debian Edu subversion repository</a>:
13 <p><strong>Modalias decoded</strong></p>
15 <p>This document try to explain what the different types of modalias
16 values stands for. It is in part based on information from
17 <URL: <a href="https://wiki.archlinux.org/index.php/Modalias">https://wiki.archlinux.org/index.php/Modalias</a> >,
18 <URL: <a href="http://unix.stackexchange.com/questions/26132/how-to-assign-usb-driver-to-device">http://unix.stackexchange.com/questions/26132/how-to-assign-usb-driver-to-device</a> >,
19 <URL: <a href="http://code.metager.de/source/history/linux/stable/scripts/mod/file2alias.c">http://code.metager.de/source/history/linux/stable/scripts/mod/file2alias.c</a> > and
20 <URL: <a href="http://cvs.savannah.gnu.org/viewvc/dmidecode/dmidecode.c?root=dmidecode&view=markup">http://cvs.savannah.gnu.org/viewvc/dmidecode/dmidecode.c?root=dmidecode&view=markup</a> >.
22 <p><strong>PCI subtype</strong></p>
24 <p>A typical PCI entry can look like this. This is an Intel Host
25 Bridge memory controller:</p>
28 pci:v00008086d00002770sv00001028sd000001ADbc06sc00i00
31 <p>This represent these values:</p>
36 sv 00001028 (subvendor)
37 sd 000001AD (subdevice)
43 <p>The vendor/device values are the same values outputted from 'lspci
44 -n' as 8086:2770. The bus class/subclass is also shown by lspci as
45 0600. The 0600 class is a host bridge. Other useful bus values are
46 0300 (VGA compatible card) and 0200 (Ethernet controller).</p>
48 <p>Not sure how to figure out the interface value, nor what it
51 <p><strong>USB subtype</strong></p>
53 <p>Some typical USB entries can look like this. This is an internal
54 USB hub in a laptop:</p>
57 usb:v1D6Bp0001d0206dc09dsc00dp00ic09isc00ip00
60 <p>Here is the values included in this alias:</p>
63 v 1D6B (device vendor)
64 p 0001 (device product)
67 dsc 00 (device subclass)
68 dp 00 (device protocol)
69 ic 09 (interface class)
70 isc 00 (interface subclass)
71 ip 00 (interface protocol)
74 <p>The 0900 device class/subclass means hub. Some times the relevant
75 class is in the interface class section. For a simple USB web camera,
76 these alias entries show up:</p>
79 usb:v0AC8p3420d5000dcEFdsc02dp01ic01isc01ip00
80 <br>usb:v0AC8p3420d5000dcEFdsc02dp01ic01isc02ip00
81 <br>usb:v0AC8p3420d5000dcEFdsc02dp01ic0Eisc01ip00
82 <br>usb:v0AC8p3420d5000dcEFdsc02dp01ic0Eisc02ip00
85 <p>Interface class 0E01 is video control, 0E02 is video streaming (aka
86 camera), 0101 is audio control device and 0102 is audio streaming (aka
87 microphone). Thus this is a camera with microphone included.</p>
89 <p><strong>ACPI subtype</strong></p>
91 <p>The ACPI type is used for several non-PCI/USB stuff. This is an IR
92 receiver in a Thinkpad X40:</p>
98 <p>The values between the colons are IDs.</p>
100 <p><strong>DMI subtype</strong></p>
102 <p>The DMI table contain lots of information about the computer case
103 and model. This is an entry for a IBM Thinkpad X40, fetched from
104 /sys/devices/virtual/dmi/id/modalias:</p>
107 dmi:bvnIBM:bvr1UETB6WW(1.66):bd06/15/2005:svnIBM:pn2371H4G:pvrThinkPadX40:rvnIBM:rn2371H4G:rvrNotAvailable:cvnIBM:ct10:cvrNotAvailable:
110 <p>The values present are</p>
113 bvn IBM (BIOS vendor)
114 bvr 1UETB6WW(1.66) (BIOS version)
115 bd 06/15/2005 (BIOS date)
116 svn IBM (system vendor)
117 pn 2371H4G (product name)
118 pvr ThinkPadX40 (product version)
119 rvn IBM (board vendor)
120 rn 2371H4G (board name)
121 rvr NotAvailable (board version)
122 cvn IBM (chassis vendor)
124 cvr NotAvailable (chassis version)
127 <p>The chassis type 10 is Notebook. Other interesting values can be
128 found in the dmidecode source:</p>
132 4 Low Profile Desktop
145 17 Main Server Chassis
148 20 Bus Expansion Chassis
149 21 Peripheral Chassis
151 23 Rack Mount Chassis
160 <p>The chassis type values are not always accurately set in the DMI
161 table. For example my home server is a tower, but the DMI modalias
162 claim it is a desktop.</p>
164 <p><strong>SerIO subtype</strong></p>
166 <p>This type is used for PS/2 mouse plugs. One example is from my
170 serio:ty01pr00id00ex00
173 <p>The values present are</p>
182 <p>This type is supported by the psmouse driver. I am not sure what
183 the valid values are.</p>
185 <p><strong>Other subtypes</strong></p>
187 <p>There are heaps of other modalias subtypes according to
188 file2alias.c. There is the rest of the list from that source: amba,
189 ap, bcma, ccw, css, eisa, hid, i2c, ieee1394, input, ipack, isapnp,
190 mdio, of, parisc, pcmcia, platform, scsi, sdio, spi, ssb, vio, virtio,
191 vmbus, x86cpu and zorro. I did not spend time documenting all of
192 these, as they do not seem relevant for my intended use with mapping
193 hardware to packages when new stuff is inserted during run time.</p>
195 <p><strong>Looking up kernel modules using modalias values</strong></p>
197 <p>To check which kernel modules provide support for a given modalias,
198 one can use the following shell script:</p>
201 for id in $(cat $(find /sys -name modalias)|sort -u); do \
203 /sbin/modprobe --show-depends "$id"|sed 's/^/ /' ; \
207 <p>The output can look like this (only the first few entries as the
208 list is very long on my test machine):</p>
212 insmod /lib/modules/2.6.32-5-686/kernel/drivers/acpi/ac.ko
214 FATAL: Module acpi:device: not found.
216 insmod /lib/modules/2.6.32-5-686/kernel/drivers/char/nvram.ko
217 insmod /lib/modules/2.6.32-5-686/kernel/drivers/leds/led-class.ko
218 insmod /lib/modules/2.6.32-5-686/kernel/net/rfkill/rfkill.ko
219 insmod /lib/modules/2.6.32-5-686/kernel/drivers/platform/x86/thinkpad_acpi.ko
220 acpi:IBM0071:PNP0511:
221 insmod /lib/modules/2.6.32-5-686/kernel/lib/crc-ccitt.ko
222 insmod /lib/modules/2.6.32-5-686/kernel/net/irda/irda.ko
223 insmod /lib/modules/2.6.32-5-686/kernel/drivers/net/irda/nsc-ircc.ko
227 <p>If you want to help implementing a system to let us propose what
228 packages to install when new hardware is plugged into a Debian
229 machine, please send me an email or talk to me on
230 <a href="irc://irc.debian.org/%23debian-devel">#debian-devel</a>.</p>