Difference between revisions of "Hwdetect"

From ArchWiki
Jump to: navigation, search
m
m (Tips)
(19 intermediate revisions by 9 users not shown)
Line 1: Line 1:
[[Category:Hardware detection and troubleshooting (English)]]
+
[[Category:Hardware detection and troubleshooting]]
 +
[[tr:hwdetect]]
 +
[https://projects.archlinux.org/svntogit/packages.git/tree/hwdetect/trunk/hwdetect hwdetect] is a hardware detection script primarily used to load or list modules for use in [[rc.conf]] or [[mkinitcpio|mkinitcpio.conf]]. The script makes use of information exported by the [[Wikipedia:Sysfs|sysfs]] subsystem employed by the Linux kernel.
  
This is a tool that detects/lists modules that are exported by /sys
+
== Installation ==
+
 
  Options:
+
The {{Pkg|hwdetect}} package is available from the [[official repositories]].
    --kernel_version=     use kernel version (no autodetect)
+
 
    --ide-legacy          use old ide modules instead of pata
+
==Usage==
    --load-modules        load all detected modules
+
 
    --unload-modules      unload all detected modules
+
The latest usage information can be found [https://projects.archlinux.org/svntogit/packages.git/tree/hwdetect/trunk/hwdetect here] or by running {{ic|hwdetect --help}}.
    --show-modules        show all detected modules
+
 
    --show-modules-order  shows load order of detected modules
+
== Example ==
    --show-agp            show AGP modules
+
You can use the following method to disable {{Ic|MOD_AUTOLOAD}} in [[rc.conf]]. This should improve boot times, as time will not be spent discovering modules.
    --show-ide            show IDE modules
+
# hwdetect --modules
    --show-scsi            show SCSI modules
+
 
    --show-sata            show SATA modules
+
The command should output something similar to the following (of course, output depends on the system):
    --show-usb            show USB modules
+
MODULES=(ac battery button processor thermal video cdrom ....)
    --show-fw              show FIREWIRE modules
+
 
    --show-net            show NETWORK modules
+
Copy this output to replace the {{ic|MODULES}} section in {{ic|/etc/rc.conf}} and change {{Ic|MOD_AUTOLOAD}} from "yes" to "no". The system should now skip the auto-load and boot faster.
    --show-input          show INPUT modules
+
 
    --show-irda            show IRDA modules
+
{{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 {{ic|MODULES}}.}}
    --show-isdn            show ISDN modules
+
 
    --show-pcmcia          show PCMCIA modules
+
== Tips ==
    --show-sound          show SOUND modules
+
To generated a list of modules currently not used, run:
    --show-video           show VIDEO modules
+
# hwdetect --modules-not-loaded
    --show-other          show OTHER modules
+
 
+
or use the following script:
  For /etc/mkinitcpio.conf use:
+
{{hc|modules-not-loaded|<nowiki>
    --hostcontroller      show MODULES= for all hostcontrollers
+
eval $(hwdetect --modules)
    --vmware              add BusLogic to MODULES for vmware
+
for m in ${MODULES[*]}; do
+
     if ! grep -sq $(echo $m|tr - _) <(lsmod); then
    --hooks                show HOOKS=
+
        echo $m;
    --hooks-dir            use this directory for HOOKS check
+
     fi
    --dsdt                add dsdt to HOOKS=
+
done</nowiki>
    --raid                add raid to HOOKS=
+
}}
    --raid-partitions      add raid-partitions to HOOKS=
+
    --encrypt              add encrypt to HOOKS=
+
    --lvm2                add lvm2 to HOOKS=
+
    --keymap              add keymap to HOOKS=
+
    --usb                  add usb to HOOKS=
+
    --fw                  add fw to HOOKS=
+
     --pcmcia              add pcmcia to HOOKS=
+
     --nfs                  add net to HOOKS=
+
+
  For /etc/rc.conf use:
+
    --net                  show network MODULES
+
    --modules              show all detected MODULES
+

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