Hardware Lister (lshw)

lshw (Hardware Lister) is a small tool to provide detailed information on the hardware configuration of the machine. It can report exact memory configuration, firmware version, mainboard configuration, CPU version and speed, cache configuration, bus speed, etc. on DMI-capable x86 or EFI (IA-64) systems and on some PowerPC machines (​PowerMac G4 is known to work).

Requirements

Linux 2.4.x or 2.6.x (2.2.x might work, though)

a PA-RISC, Alpha, IA-64 (Itanium), PowerPC or x86 based machine

an ANSI (or close enough to ANSI compliance) C++ compiler (tested with GCC 2.95.4 and 3.2.2)

for the (optional) GTK+ graphical user interface, you will need a complete GTK+ 2.4 development environment ( gtk2-devel on RedHat/Fedora derivatives)

Information can be output in plain text, XML or HTML.

It currently supports DMI (x86 and EFI only), OpenFirmware device tree (PowerPC only), PCI/AGP, ISA PnP (x86), CPUID (x86), IDE/ATA/ATAPI, PCMCIA (only tested on x86), USB and SCSI.

Download

The latest version is B.02.19.2. You can download the source code.

Some statistics

The following figures have been gathered for lshw B.02.19 with David A. Wheeler's ​SLOCCount.

Totals grouped by language (dominant language first):

C++: 20824 (98.05%)

ANSI C: 414 (1.95%)

Total Physical Source Lines of Code (SLOC) 21,238 Development Effort Estimate, Person-Years (Person-Months)

Basic COCOMO model: person-months = 2.4 KSLOC1.05 4.95 (59.39) Schedule Estimate, Years (Months)

Basic COCOMO model: months = 2.5 person-months0.38 0.98 (11.80) Estimated Average Number of Developers (Effort/Schedule?) 5.03 Total Estimated Cost to Develop

(average salary = $56,286/year, overhead = 2.40) $ 668,515

Pre-compiled versions

​Mandriva Linux includes lshw as a standard package.

​Gentoo Linux ​bundles lshw , too.

​Debian packages are ​available for many platforms.

​Ubuntu packages are ​available.

​Fedora now includes lshw :

$ sudo yum install lshw lshw-gui

to install lshw and its GUI.

Applications

​ enterprise-inventory-system: a web-based inventory system

Example output

Desktop PC

GTK+ graphical user interface ( gtk-lshw )



Apple PowerMac dual G4 1.25GHz, 768MB memory

ioscan -like output ( lshw -short ) H/W path Device Class Description ============================================================== system Computer /0 bus /0/fff00000 memory BootROM /0/0 /proc/device-tree memory OpenFirmware 3 /0/1 memory System memory /0/1/0 memory Memory bank /0/1/1 memory Memory bank /0/1/2 memory Memory bank /0/1/3 memory Memory bank /0/2 processor CPU /0/2/0 memory L1 Cache /0/2/1 memory L2 Cache (unified) /0/3 processor CPU /0/3/0 memory L1 Cache /0/3/1 memory L2 Cache (unified) /0/100 bridge Host bridge /0/100/10 /dev/fb0 display VGA compatible controller (VGA) /0/101 bridge Host bridge /0/101/17 generic KeyLargo Mac I/O /0/101/17/1 ide1 bus Channel 0 /0/101/17/1/0 /dev/hdc disk IDE CD-ROM /0/101/17/1/0/0 scsi0 storage SCSI storage controller /0/101/17/1/0/0/0 bus Channel 0 /0/101/17/1/0/0/0/0 /dev/dvd disk DVD reader /0/101/18 bus USB Controller (OHCI) /0/101/19 bus USB Controller (OHCI) /0/101/1b bus USB Controller (OHCI) /0/101/1b.1 bus USB Controller (OHCI) /0/101/1b.2 bus USB Controller (EHCI) /0/102 bridge Host bridge /0/102/d generic UniNorth 2 ATA/100 /0/102/d/2 ide2 bus Channel 0 /0/102/d/2/0 /dev/hde disk ATA Disk /0/102/e bus FireWire (IEEE 1394) (OHCI) /0/102/f eth0 network Ethernet controller

Dell OptiPlex GXa Pentium II 266MHz 192MB memory dell product: OptiPlex GXa 266L EM+ vendor: Dell Computer Corporation serial: NL2SC capabilities: smbios-2.2 dmi-2.2 *-core *-firmware description: BIOS vendor: Dell Computer Corporation version: A10 (06/23/00) size: 64KB capacity: 192KB capabilities: isa pci pnp apm upgrade shadowing escd cdboot bootselect edd int13floppytoshiba int13floppy360 int13floppy1200 int13floppy720 int13floppy2880 int5printscreen int9keyboard int14serial int17printer int10video *-cpu product: Pentium II (Klamath) vendor: GenuineIntel slot: Microprocessor size: 266MHz capacity: 333MHz clock: 66MHz capabilities: fpu fpu_exception wp vme de pse tsc msr pae mce cx8 sep mtrr pge mca cmov mmx *-cache:0 description: Internal L1 Cache size: 32KB capacity: 32KB *-cache:1 description: Pipeline burst Synchronous External L2 write-back Cache size: 512KB capacity: 512KB *-memory description: System Memory slot: System board or motherboard size: 192MB capacity: 384MB *-bank:0 description: DIMM DRAM Synchronous 64 bits slot: DIMM_A size: 64MB *-bank:1 description: DIMM DRAM Synchronous 64 bits slot: DIMM_B size: 64MB *-bank:2 description: DIMM DRAM Synchronous 64 bits slot: DIMM_C size: 64MB

How to interpret lshw 's output

lshw displays nodes with attributes in a tree-like structure (that can be in indented plain text form, HTML, XML or graphically displayed in the GUI). Each node has its individual status: it be CLAIMED (potentially usable) or UNCLAIMED (no driver has been detected for this node), ENABLED (this device is supported and can be used) or DISABLED (this device is supported but has been disabled):

a node is marked as CLAIMED if a driver (usually a kernel module or a driver within the monolithic kernel) has been loaded for it

a node is marked as UNCLAIMED if no specific support for it has been loaded (or lshw has been unable to identify the driver)

has been unable to identify the driver) a node is marked as ENABLED if a driver has been loaded for it and is fully functional

a node is marked as DISABLED if the node has been disabled by a configuration, some hardware failure, etc.

Each node can contain sub-nodes and can have a number of attributes, capabilities, resources and configuration values.

Attributes

Attribute Meaning Example 1 Example 2 Example 3 Example 4 id internal identifier used by lshw cpu:2 network:1 cdrom:0 disk:2 class device's class (see below) processor network disk disk description human-readable description of the hardware node CPU Ethernet interface DVD reader SCSI disk vendor vendor/manufacturer of the device Intel Corp. Advanced Micro Devices [AMD] QUANTUM product product name of the device Intel(R) Pentium(R) 4 CPU 1.90GHz 79c970 [PCnet32 LANCE] Hewlett-Packard DVD Writer 100 ATLAS IV 9 WLS version version/release of the device 15.1.2 25 1.37 0707 serial serial number of the device 00:60:b0:87:86:22 CN1AA0786J 369914632368 capacity maximum capacity reported by the device 100000000 (100MB/s) 9167634432 (8742MB) size actual size of the device 1900000000 (1.9GHz) 10000000 (10MB/s) 9105018880 (8683MB) clock bus clock (in Hz) of the device 100000000 (100MHz) 33000000 (33MHz) width address width of the device (32 or 64 bits)

this has nothing to do with having 32bit or 64bit driver 32 32 slot where the device is connected (physical location/slot) Processor 1 logicalname logical name under which the node is known to the system eth0 /dev/hdc /dev/sdc dev device number (major.minor) 22d:0d 8d:32d businfo bus information cpu@0 pci@02:0a.0 ide@1.0 scsi@0:0.12.0 physid physical id 4 a 0 0.c.0

Remarks:

size and capacity can have various meanings depending on the device: for a processor, size is the processor's frequency in hertz; for a disc, it's its actual storage capacity in bytes (and capacity refers to its unformatted capacity, including bad sectors); for a network interface, size and capacity refer to bandwidth in bits per second

the size of a node is always inferior or equal to its capacity

serial refers to the device's serial number for discs, memory, processors, various boards, etc. but is used to report MAC address for network devices, GUID for disk partitions

Capabilities

Capabilities are used to report features of a given node. The exact meaning of each feature depends on the type of node, it can be the presence of an arithmetical co-processor for a CPU, the ability to run at 1GB/s for a network interface, etc. In most cases. capabilities reported by lshw are auto-documented (both XML and HTML versions report a comment about each feature and that comment is displayed in the GUI).

Node configuration values

Resources

Resource type Description Examples irq IRQ irq:16 ioport I/O ports ioport:1f0(size=8)

ioport:3f6

ioport:170(size=8)

ioport:376

ioport:50c0(size=16) iomem I/O window iomem:00006000-000060ff

iomem:00006400-000064ff memory memory window (prefetchable or not) memory:88000000-8bfff000(prefetchable)

memory:90000000-93fff000

Device classes

Class Description Examples system used to refer to the whole machine laptop, server, desktop computer bridge internal bus converter PCI-to-PCI brige, AGP bridge, PCMCIA controler, host bridge memory memory bank that can contain data, executable code, etc. RAM, BIOS, firmware, extension ROM processor execution processor CPUs, RAID controller on a SCSI bus address memory address range extension ROM, video memory storage storage controller SCSI controller, IDE controller disk random-access storage device discs, optical storage (CD-ROM, DVD±RW...) tape sequential-access storage device DAT, DDS bus device-connecting bus USB, SCSI, Firewire network network interface Ethernet, FDDI, WiFi, Bluetooth display display adapter EGA/VGA, UGA... input user input device keyboards, mice, joysticks... printer printing device printer, all-in-one multimedia audio/video device sound card, TV-output card, video acquisition card communication line communication device serial ports, modem power energy source power supply, internal battery volume disk volume filesystem, swap, etc. generic generic device (used when no pre-defined class is suitable)

Bus information and device numbering

The general form of bus information is bus_type @ dotted.hexadecimal.address

Bus Description Format Example cpu CPUs cpu@ id[ , logicalcpu] cpu@0

cpu@0,1 firewire FireWire (IEEE1394) firewire@ GUID firewire@0030e0f4e020ca8c ide ATA/ATAPI/IDE ide@ controler . id ide@0.0 (master)

ide@0.1 (slave) pci PCI (or AGP) bus pci@ bus : slot . function pci@02:0a.0 scsi SCSI bus scsi@ controler : target . id.lun scsi@0:0.12.0 usb Universal Serial Bus usb@ controler : slot . id usb@1:2.2

Bus information can also be extended to include "partitions" information: scsi@0:0.12.0,1 is used to refer to the first partition of LUN 0 of the SCSI disc with id 12.

Installation

unpack the source code:

tar xvfz lshw- release .tar.gz

compile it:

cd lshw- release

make

you can also build the optional GUI:

make gui

if you want to build an RPM package:

rpmbuild -ta lshw- release .tar.gz

or, to include the optional GUI:

rpmbuild -ta --with gui lshw- release .tar.gz

Usage

lshw [format] [options... ] where format can be

-X to launch the GUI (if available)

-html to activate HTML mode

-xml to activate XML mode

-short to print hardware paths

-businfo to print bus information

and options can be

-enable TEST to enable a test

-disable TEST to disable a test

-class CLASS to limit the output to a given class

-C CLASS alias for -class CLASS

NOTE: to use some features (like DMI on x86 platforms), you need to run lshw as root or it will only report partial information.

Known problems/limitations

on x86, lshw needs to be run as root to be able to access DMI information from the BIOS

needs to be run as to be able to access DMI information from the BIOS running lshw as a non-root user usually gives much less detailed information

as a non-root user usually gives much less detailed information lshw is sometimes confused about where to connect emulated SCSI devices (like USB storage devices, IEEE1394 disks and SCSI-over-IDE CD writers). This will hopefully be fixed on version 2.6 kernels by using sysfs .

is sometimes confused about where to connect emulated SCSI devices (like USB storage devices, IEEE1394 disks and SCSI-over-IDE CD writers). This will hopefully be fixed on version 2.6 kernels by using . Active tickets against lshw

If you want to ​ report a bug

Check that it affects the latest released version (many problems get fixed between versions). Please make sure you include the following information (even if you don't think it's relevant, it can matter):

the platform: are you using a PC, a Mac, a workstation?

the architecture: is it an x86 (AMD or Intel), x86-64, PA-RISC, Itanium, PowerPC, Sparc, MIPS, Alpha, etc. ?

the distribution: Fedora, Debian, Ubuntu, Redhat, Mandrake/Mandriva?, etc. (some distributions are known to ship broken kernel headers and other traps)

the version numbers of important components: lshw, kernel, GCC, libc (and the distribution itself)

the complete output of lshw -xml run as root

run as as much detail as possible about your problem (symptoms, how to reproduce, on which hardware, etc.)

This will greatly increase the chances of getting a quick and accurate answer. If you don't include that kind of information, I'll probably ask for it anyway...

Git code repository access

The repository can be accessed at ​https://ezix.org/src/pkg/lshw

Changes