X-Git-Url: http://pere.pagekite.me/gitweb/homepage.git/blobdiff_plain/3d2773b1e178978a86bb37a4ec6733d6dc7039ca..cec140bdf2d777199acb4d7c14066d510ce3ff93:/blog/data/2013-01-14-hw-autoinstall-modalias.txt?ds=sidebyside diff --git a/blog/data/2013-01-14-hw-autoinstall-modalias.txt b/blog/data/2013-01-14-hw-autoinstall-modalias.txt index 240b21d52c..4c8468f59f 100644 --- a/blog/data/2013-01-14-hw-autoinstall-modalias.txt +++ b/blog/data/2013-01-14-hw-autoinstall-modalias.txt @@ -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
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 <URL: http://code.metager.de/source/history/linux/stable/scripts/mod/file2alias.c > and <URL: http://cvs.savannah.gnu.org/viewvc/dmidecode/dmidecode.c?root=dmidecode&view=markup >. +
The modalias entries for a given Linux machine can be found using +this shell script:
+ ++find /sys -name modalias -print0 | xargs -0 cat | sort -u ++ +
The supported modalias globs for a given kernel module can be found +using modinfo:
+ ++% /sbin/modinfo psmouse | grep alias: +alias: serio:ty05pr*id*ex* +alias: serio:ty01pr*id*ex* +% ++
PCI subtype
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.
one can use the following shell script:- 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): packages to install when new hardware is plugged into a Debian machine, please send me an email or talk to me on #debian-devel. + +Update 2013-01-15: Rewrite "cat $(find ...)" to +"find ... -print0 | xargs -0 cat" to make sure it handle directories +in /sys/ with space in them.