]> pere.pagekite.me Git - homepage.git/blobdiff - blog/data/2013-01-14-hw-autoinstall-modalias.txt
Generated.
[homepage.git] / blog / data / 2013-01-14-hw-autoinstall-modalias.txt
index 240b21d52c60ed16108e2adbba4cb5c38216fb7c..4c8468f59fb3eeafe5b48c9515d3ceb53320d7ff 100644 (file)
@@ -1,6 +1,6 @@
 Title: Modalias strings - a practical way to map "stuff" to hardware
-Tags: english, debian
-Date: 2013-01-14 11:10
+Tags: english, debian, isenkram
+Date: 2013-01-14 11:20
 
 <p>While looking into how to look up Debian packages based on hardware
 information, to find the packages that support a given piece of
@@ -19,6 +19,23 @@ values stands for.  It is in part based on information from
 &lt;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> &gt; and
 &lt;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> &gt;.
 
+<p>The modalias entries for a given Linux machine can be found using
+this shell script:</p>
+
+<pre>
+find /sys -name modalias -print0 | xargs -0 cat | sort -u
+</pre>
+
+<p>The supported modalias globs for a given kernel module can be found
+using modinfo:</p>
+
+<pre>
+% /sbin/modinfo psmouse | grep alias:
+alias:          serio:ty05pr*id*ex*
+alias:          serio:ty01pr*id*ex*
+%
+</pre>
+
 <p><strong>PCI subtype</strong></p>
 
 <p>A typical PCI entry can look like this.  This is an Intel Host
@@ -198,7 +215,7 @@ hardware to packages when new stuff is inserted during run time.</p>
 one can use the following shell script:</p>
 
 <pre>
-  for id in $(cat $(find /sys -name modalias)|sort -u); do \
+  for id in $(find /sys -name modalias -print0 | xargs -0 cat | sort -u); do \
     echo "$id" ; \
     /sbin/modprobe --show-depends "$id"|sed 's/^/  /' ; \
   done
@@ -228,3 +245,7 @@ list is very long on my test machine):</p>
 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>
+
+<p><strong>Update 2013-01-15:</strong> Rewrite "cat $(find ...)" to
+"find ... -print0 | xargs -0 cat" to make sure it handle directories
+in /sys/ with space in them.</p>