Oct 022010
 

linux hardwareOn linux there are some simple commands that allow you to see what the OS is seeing (that does not always correspond with the hardware in the machine). Today we will see some of these useful commands that allow you to check the proper recognition of all our devices.

lspci – lsusb – lshw

lspci

lspci is a utility for displaying information about PCI buses in the system and devices connected to them.

By default, it shows a brief list of devices. Use the options described below to request either a more verbose output or output intended for parsing by other programs.




Some parts of the output, especially in the highly verbose modes, are probably intelligible only to experienced PCI hackers. For exact definitions of the fields, please consult either the PCI specifications or the header.h and /usr/include/linux/pci.h include files.

Access to some parts of the PCI configuration space is restricted to root on many operating systems, so the features of lspci available to normal users are limited. However, lspci tries its best to display as much as available and mark all other information with text < access denied >.

Basic usage: lspci

Output

00:00.0 Host bridge: Intel Corporation 82855PM Processor to I/O Controller (rev 03)
00:01.0 PCI bridge: Intel Corporation 82855PM Processor to AGP Controller (rev 03)
00:1d.0 USB Controller: Intel Corporation 82801DB/DBL/DBM (ICH4/ICH4-L/ICH4-M) USB UHCI Controller #1 (rev 01)
00:1d.1 USB Controller: Intel Corporation 82801DB/DBL/DBM (ICH4/ICH4-L/ICH4-M) USB UHCI Controller #2 (rev 01)
00:1d.2 USB Controller: Intel Corporation 82801DB/DBL/DBM (ICH4/ICH4-L/ICH4-M) USB UHCI Controller #3 (rev 01)
00:1d.7 USB Controller: Intel Corporation 82801DB/DBM (ICH4/ICH4-M) USB2 EHCI Controller (rev 01)
00:1e.0 PCI bridge: Intel Corporation 82801 Mobile PCI Bridge (rev 81)
00:1f.0 ISA bridge: Intel Corporation 82801DBM (ICH4-M) LPC Interface Bridge (rev 01)
00:1f.1 IDE interface: Intel Corporation 82801DBM (ICH4-M) IDE Controller (rev 01)
00:1f.3 SMBus: Intel Corporation 82801DB/DBL/DBM (ICH4/ICH4-L/ICH4-M) SMBus Controller (rev 01)
00:1f.5 Multimedia audio controller: Intel Corporation 82801DB/DBL/DBM (ICH4/ICH4-L/ICH4-M) AC'97 Audio Controller (rev 01)
00:1f.6 Modem: Intel Corporation 82801DB/DBL/DBM (ICH4/ICH4-L/ICH4-M) AC'97 Modem Controller (rev 01)
01:00.0 VGA compatible controller: ATI Technologies Inc Radeon Mobility M7 LW [Radeon Mobility 7500]
02:00.0 CardBus bridge: Texas Instruments PCI1520 PC card Cardbus Controller (rev 01)
02:00.1 CardBus bridge: Texas Instruments PCI1520 PC card Cardbus Controller (rev 01)
02:01.0 Ethernet controller: Intel Corporation 82540EP Gigabit Ethernet Controller (Mobile) (rev 03)
02:02.0 Network controller: AIRONET Wireless Communications Cisco Aironet Wireless 802.11b

That’s the output on my Ibm T40 laptop.

lspci -v (or -vv, -vvv)

Get a verbose (the more v the more verbose) output of your PCI.

Example of output

------------------------------------------------------------
02:01.0 Ethernet controller: Intel Corporation 82540EP Gigabit Ethernet Controller (Mobile) (rev 03)
Subsystem: IBM Device 0549
Flags: bus master, 66MHz, medium devsel, latency 64, IRQ 4
Memory at c0220000 (32-bit, non-prefetchable) [size=128K]
Memory at c0200000 (32-bit, non-prefetchable) [size=64K]
I/O ports at 8400 [size=64]
[virtual] Expansion ROM at c0240000 [disabled] [size=64K]
Capabilities: [dc] Power Management version 2
Capabilities: [f0] Message Signalled Interrupts: Mask- 64bit+ Queue=0/0 Enable-
Kernel driver in use: e1000
Kernel modules: e1000
02:02.0 Network controller: AIRONET Wireless Communications Cisco Aironet Wireless 802.11b
Subsystem: AIRONET Wireless Communications Device 5000
Flags: bus master, fast devsel, latency 64, IRQ 6
I/O ports at 8000 [size=256]
Memory at c0210000 (32-bit, non-prefetchable) [size=16K]
Memory at c0400000 (32-bit, non-prefetchable) [size=4M]
[virtual] Expansion ROM at c0800000 [disabled] [size=2M]
Capabilities: [40] Power Management version 2
Capabilities: [48] Vital Product Data
Kernel driver in use: airo
Kernel modules: airo
------------------------------------------------------------

More Examples:

Video Adapter:

lspci -v | perl -ne '/VGA/../^$/ and /VGA|Kern/ and print'

Show display adapter, available drivers, and driver in use

root@laptop:/var/cache/apt/archives# lspci -v | perl -ne '/VGA/../^$/  and /VGA|Kern/ and print'
01:00.0 VGA compatible controller: ATI Technologies Inc Radeon Mobility M7 LW [Radeon Mobility 7500]
Kernel driver in use: radeon
Kernel modules: radeonfb, radeon

Network card

lspci | grep Ether | awk '{ VAR=$1; split(VAR,ARR,"."); count[ARR[1]]++; LINE=$0; split(LINE,LINEARR,":"); LINECOUNT[ARR[1]]=LINEARR[3]; } END { for(i in count) { printf("PCI address: %snPorts: %dnCard Type: %sn", i, count[i], LINECOUNT[i]) } }'

Show number of NIC’s, ports per nic and PCI address

PCI address: 02:01
Ports: 1
Card Type:  Intel Corporation 82540EP Gigabit Ethernet Controller (Mobile) (rev 03)

If many devices are “Unknown device”it’s useful to use the command ‘update-pciids’ that try to get the last info from the web regarding PCI..

it’s also possibile to use lspci -n and paste the result on this web page, you’ll see the harware recognized and if there is a Linux driver for it.

See also the wiki

lsusb

lsusb is a utility for displaying information about USB buses in the system and the devices connected to them.

 lsusb
Bus 004 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub
Bus 003 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub
Bus 002 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub
Bus 001 Device 009: ID 05e3:0702 Genesys Logic, Inc. USB 2.0 IDE Adapter
Bus 001 Device 008: ID 152d:2352 JMicron Technology Corp. / JMicron USA Technology Corp.
Bus 001 Device 006: ID 046d:c315 Logitech, Inc. Classic New Touch Keyboard
Bus 001 Device 005: ID 046d:c01d Logitech, Inc. MX510 Optical Mouse
Bus 001 Device 004: ID 050d:3201 Belkin Components F1DF102U/F1DG102U Flip KVM
Bus 001 Device 002: ID 0424:2524 Standard Microsystems Corp. USB MultiSwitch Hub
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub

Also with lsusb it’s possible to use the -v option to get a verbose output

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

The basic comand give a very long and detailed output, with the -short option there is a more compat output:

lshw -short

H/W path           Device      Class          Description
=========================================================
system         237475G
/0                             bus            237475G
/0/0                           memory         144KiB BIOS
/0/6                           processor      Intel(R) Pentium(R) M processor 1500MHz
/0/6/a                         memory         32KiB L1 cache
/0/6/b                         memory         1MiB L2 cache
/0/2c                          memory         1536MiB System Memory
/0/2c/0                        memory         512MiB SODIMM DDR Synchronous
/0/2c/1                        memory         1GiB SODIMM DDR Synchronous
/0/100                         bridge         82855PM Processor to I/O Controller
/0/100/1                       bridge         82855PM Processor to AGP Controller
/0/100/1/0                     display        Radeon Mobility M7 LW [Radeon Mobility 7500]
/0/100/1d                      bus            82801DB/DBL/DBM (ICH4/ICH4-L/ICH4-M) USB UHCI Controll
/0/100/1d.1                    bus            82801DB/DBL/DBM (ICH4/ICH4-L/ICH4-M) USB UHCI Controll
/0/100/1d.2                    bus            82801DB/DBL/DBM (ICH4/ICH4-L/ICH4-M) USB UHCI Controll
/0/100/1d.7                    bus            82801DB/DBM (ICH4/ICH4-M) USB2 EHCI Controller
/0/100/1e                      bridge         82801 Mobile PCI Bridge
/0/100/1e/0                    bridge         PCI1520 PC card Cardbus Controller
/0/100/1e/0.1                  bridge         PCI1520 PC card Cardbus Controller
/0/100/1e/1        eth0        network        82540EP Gigabit Ethernet Controller (Mobile)
/0/100/1e/2        eth1        network        Cisco Aironet Wireless 802.11b
/0/100/1f                      bridge         82801DBM (ICH4-M) LPC Interface Bridge
/0/100/1f.1        scsi0       storage        82801DBM (ICH4-M) IDE Controller
/0/100/1f.1/0      /dev/sda    disk           40GB HITACHI_DK23EB-4
/0/100/1f.1/0/1    /dev/sda1   volume         17GiB Windows NTFS volume
/0/100/1f.1/0/2    /dev/sda2   volume         2871MiB Windows FAT volume
/0/100/1f.1/0/3    /dev/sda3   volume         16GiB Extended partition
/0/100/1f.1/0/3/5  /dev/sda5   volume         66MiB Linux filesystem partition
/0/100/1f.1/0/3/6  /dev/sda6   volume         494MiB Linux swap / Solaris partition
/0/100/1f.1/0/3/7  /dev/sda7   volume         16GiB Linux filesystem partition
/0/100/1f.1/1      /dev/cdrom  disk           UJDA745 DVD/CDRW
/0/100/1f.3                    bus            82801DB/DBL/DBM (ICH4/ICH4-L/ICH4-M) SMBus Controller
/0/100/1f.5                    multimedia     82801DB/DBL/DBM (ICH4/ICH4-L/ICH4-M) AC'97 Audio Contr
/0/100/1f.6                    communication  82801DB/DBL/DBM (ICH4/ICH4-L/ICH4-M) AC'97 Modem Contr
/0/1               scsi5       storage
/0/1/0.0.0         /dev/sdb    disk           20GB ATCS04-0
/0/1/0.0.0/1       /dev/sdb1   volume         18GiB Windows FAT volume
/0/2               scsi4       storage
/0/2/0.0.0         /dev/sdc    disk           250GB SCSI Disk
/0/2/0.0.0/1       /dev/sdc1   volume         232GiB Windows NTFS volume

lshw has also a graphic frontend, you can call it with lshw -X , this is really useful to browse into your hardware components.

More example:

lshw -html > hardware.html

Create a nifty overview of the hardware in your computer

After the command is done, open the html file in a browser

sudo lshw -C cpu|grep width

In the output you can see if the CPU is 32 or 64 bit.

Popular Posts:

Flattr this!

  3 Responses to “Know your hardware on Linux”

  1. great information 😉

  2. Great
    I skimmed over it thinking I knew all that, then saw you pipe it to an html file.
    That was new, thanks

  3. I’ve used lspci and lsusb before. Then, as when looking through your outputs, I’m always confused by the multiple nearly identical “bus”, “bridge” and “controller” entries.

 Leave a Reply

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>

(required)

(required)

*