Difference between revisions of "Hwdetect"

From ArchWiki
Jump to: navigation, search
(removed the output from --help and linked to the actual script for an up to date version. some other small modifications)
m (Tips)
(One intermediate revision by the same user not shown)
Line 23: Line 23:
  
 
== Tips ==
 
== Tips ==
* To generated a list of modules currently not used, run:
+
To generated a list of modules currently not used, run:
 
  # hwdetect --modules-not-loaded
 
  # hwdetect --modules-not-loaded
  
 
or use the following script:
 
or use the following script:
{{hc|modules-not-loaded|
+
{{hc|modules-not-loaded|<nowiki>
 
eval $(hwdetect --modules)
 
eval $(hwdetect --modules)
 
for m in ${MODULES[*]}; do
 
for m in ${MODULES[*]}; do
Line 33: Line 33:
 
         echo $m;
 
         echo $m;
 
     fi
 
     fi
done
+
done</nowiki>
 
}}
 
}}

Revision as of 22:51, 10 November 2012

hwdetect is a hardware detection script primarily used to load or list modules for use in rc.conf or mkinitcpio.conf. The script makes use of information exported by the sysfs subsystem employed by the Linux kernel.

Installation

The hwdetect package is available from the official repositories.

Usage

The latest usage information can be found here or by running hwdetect --help.

Example

You can use the following method to disable MOD_AUTOLOAD in rc.conf. This should improve boot times, as time will not be spent discovering modules.

# hwdetect --modules

The command should output something similar to the following (of course, output depends on the system):

MODULES=(ac battery button processor thermal video cdrom ....) 

Copy this output to replace the MODULES section in /etc/rc.conf and change MOD_AUTOLOAD from "yes" to "no". The system should now skip the auto-load and boot faster.

Note: If any of the module names change (unlikely) or you install new hardware on your computer, you will need to generate the list of modules again and update MODULES.

Tips

To generated a list of modules currently not used, run:

# hwdetect --modules-not-loaded

or use the following script:

modules-not-loaded
eval $(hwdetect --modules)
for m in ${MODULES[*]}; do
    if ! grep -sq $(echo $m|tr - _) <(lsmod); then
        echo $m;
    fi
done