Hack 50 Test Hardware Compatibility 
Knoppix's hardware
detection has a reputation for being just about as good as Linux. Use
your Knoppix disc to test the Linux-hardware compatibility of
desktops, laptops, and peripherals.
Linux openly tells you what it knows about a system. From the moment
Linux boots, you are presented with information about what Linux is
doing and which hardware it is detecting. Through the
/proc interface, you can also ask the kernel to
display very detailed information about all of the hardware on the
system. This is particularly useful to test hardware that you want to
get working on another Linux distribution.
 |
You can also leverage this hardware detection when shopping for a new
computer or laptop. Simply bring a Knoppix disc with you and get the
clerk to agree to let you boot the CD-ROM for hardware compatibility
testing. This sort of test is quick and much less painful than
discovering that a major piece of hardware does not yet work under
Linux after you have bought it.
|
|
This hack covers the major commands that provide you with hardware
information under Linux. I can't possibly cover all
of the different hardware that Linux can support and where it is
configured, but after reading this hack, you should know where to
look and what to do to check whether Linux has detected your
hardware, and you should be able to check and copy the configuration
for the major hardware on your system.
5.15.1 General Hardware Probing
When booting Knoppix, you can't help but notice a
lot of information about your hardware scrolling by in the text
output. Once the desktop starts loading, however, you can no longer
see it (and what you could see might have scrolled by too fast for
you to really read it). This text output is actually rather useful,
because it shows which hardware the kernel has detected and gives you
a good sense of which hardware should be working. You
don't have to scribble down all of that information
as it scrolls by or sit in front of your monitor with a camera taking
snapshots, because Linux logs all of that information for you in
/var/log/dmesg. Knoppix doesn't
enable logging by default, so you might notice that
/var/log/dmesg is empty under Knoppix. You can
still access the same information through the
dmesg command. Dmesg
outputs what is in /var/log/dmesg to the screen,
so if you want to reference it, redirect it to another file or pipe
it to a pager such as less.
The first time you run dmesg, you might be
overwhelmed by the amount of information you are presented with,
because Knoppix probes for many different kinds of hardware that you
probably don't have, and displays a lot of
information about your motherboard and PCI devices. As you scroll
through the output, you should start to see useful information about
your hardware. For example, here's some sample
dmesg output that gives me information about my
IDE devices:
knoppix@ttyp0[knoppix]$
dmesg | less
. . .
AMD7411: 00:07.1 (rev 01) UDMA100 controller
ide0: BM-DMA at 0xf000-0xf007, BIOS settings: hda:DMA, hdb:DMA
ide1: BM-DMA at 0xf008-0xf00f, BIOS settings: hdc:pio, hdd:pio
hda: WDC WD1000BB-00CAA1, ATA DISK drive
hdb: WDC WD300BB-00AUA1, ATA DISK drive
hdc: SAMSUNG DVD-ROM SD-612, ATAPI CD/DVD-ROM drive
ide0 at 0x1f0-0x1f7,0x3f6 on irq 14
ide1 at 0x170-0x177,0x376 on irq 15
hda: attached ide-disk driver.
hda: host protected area => 1
hda: 195371568 sectors (100030 MB) w/2048KiB Cache, CHS=193821/16/63
hdb: attached ide-disk driver.
hdb: host protected area => 1
hdb: 58633344 sectors (30020 MB) w/2048KiB Cache, CHS=58168/16/63
Partition check:
hda: hda1 hda2 hda3
hdb: hdb1 hdb2 hdb3
. . .
usb.c: registered new driver hiddev
usb.c: registered new driver hid
input: USB HID v1.00 Mouse [Microsoft Microsoft IntelliMouse® Explorer] on usb1:2.0
. . .
Linux Tulip driver version 0.9.15-pre12 (Aug 9, 2002)
eth0: Lite-On PNIC-II rev 37 at 0x1000, 00:A0:CC:32:BF:88, IRQ 5.
. . .
This output shows which IDE devices Linux has detected, whether DMA
has been enabled in the BIOS, the size of any hard drives it has
found, and which partitions it has found on those drives. Further
down I can see that it has detected my USB mouse and my Ethernet
card.
While this output can be useful, you might want more in-depth
information about specific hardware on your system. In particular,
you might want to find out which PCI devices Knoppix has found on the
system. You could scan through the PCI bus by looking through the
files under /proc/bus/pci, but an easier way is
to use the lspci tool.
Lspci lists all of the PCI buses in a system
with any devices connected to them. The standard output should give
you some basic information about which devices Linux has detected on
the system:
knoppix@ttyp0[knoppix]$
lspci
0000:00:00.0 Host bridge: Advanced Micro Devices [AMD] AMD-760 MP [IGD4-2P]
System Controller (rev 11)
0000:00:01.0 PCI bridge: Advanced Micro Devices [AMD] AMD-760 MP [IGD4-2P]
AGP Bridge
0000:00:07.0 ISA bridge: Advanced Micro Devices [AMD] AMD-766 [ViperPlus]
ISA (rev 02)
0000:00:07.1 IDE interface: Advanced Micro Devices [AMD] AMD-766 [ViperPlus]
IDE (rev 01)
0000:00:07.3 Bridge: Advanced Micro Devices [AMD] AMD-766 [ViperPlus] ACPI
(rev 01)
0000:00:07.4 USB Controller: Advanced Micro Devices [AMD] AMD-766 [ViperPlus]
USB (rev 07)
0000:00:0c.0 Ethernet controller: Lite-On Communications Inc LNE100TX [Linksys
EtherFast 10/100] (rev 25)
0000:00:0d.0 Multimedia audio controller: Aureal Semiconductor Vortex 2
0000:01:05.0 VGA compatible controller: nVidia Corporation NV11 [GeForce2 MX/MX
400] (rev a1)
In this output, there are two basic columns. The first column lists
the bus, slot, and function for a device in hexadecimal. The next
column lists the type of device and any identification it can find
for the device. The first few lines of output simply list information
about different bridges on the motherboard, but the last few lines
list a number of devices that are connected to the PCI bus, including
an Ethernet card, a sound card, and a video card. If you want more
information, pass the -v or -vv
option to lspci to tell
lspci to give progressively more information
about the device. To see more information about the GeForce2 video
card, just run lspci -vv and browse through
the rather verbose output:
knoppix@ttyp0[knoppix]$
sudo lspci -vv
. . .
0000:01:05.0 VGA compatible controller: nVidia Corporation NV11 [GeForce2 MX/MX
400] (rev a1) (prog-if 00 [VGA])
Subsystem: LeadTek Research Inc.: Unknown device 2830
Control: I/O+ Mem+ BusMaster+ SpecCycle- MemWINV- VGASnoop- ParErr-
Stepping- SERR- FastB2B-
Status: Cap+ 66MHz+ UDF- FastB2B+ ParErr- DEVSEL=medium >TAbort- SERR-
[disabled] [size=64K]
Capabilities: [60] Power Management version 2
Flags: PMEClk- DSI- D1- D2- AuxCurrent=0mA PME(D0-,D1-,D2-,D3hot-,D3cold-)
Status: D0 PME-Enable- DSel=0 DScale=0 PME-
Capabilities: [44] AGP version 2.0
Status: RQ=32 Iso- ArqSz=0 Cal=0 SBA- ITACoh- GART64- HTrans- 64bit-
FW+ AGP3- Rate=x1,x2,x4
Command: RQ=1 ArqSz=0 Cal=0 SBA- AGP- GART64- 64bit- FW- Rate=
Notice that this time I ran lspci with
sudo. This is because lspci
won't tell a regular user all of the information
about a PCI device in the verbose output (most notably the
capabilities lines), so to get verbose output, run
lspci using sudo.
If you are new to Linux, reading through all this output to try to
find out whether Linux sees your sound card is probably intimidating.
Besides, just because lspci lists a device, it
doesn't necessarily mean that modules are loaded and
the device is up and running. If your desktop environment is running,
Knoppix provides a tool, Info Center, that collects all of the
hardware information for your system and displays it in a simple
interface. When you run Info Center by clicking K
Menu System Info Center, you are presented with a
window, as shown in Figure 5-7.

On the lefthand side of the window are a number of hardware
categories, and clicking on any of the categories displays
information about that category on the righthand side of the window.
Info Center is useful in that it not only lists the information that
you might find by running lspci, but it also
scans through other parts of the system and lists whether modules
have been loaded for certain devices. To check whether your network
card is running and has received an IP address, click on Network
Interfaces in the sidebar to list all network devices, their IP
addresses, and whether they are up. To check that a sound card is
working, click on Sound in the sidebar to see which audio devices the
Info Center has detected as well as their capabilities.
5.15.2 Specific Hardware Testing
Dmesg, lspci, and the Info
Center provide you with a lot of information about hardware on your
system, but these commands mostly tell you about hardware that has
been detected, not necessarily hardware that is working. This section
covers some common hardware and specific tests to confirm that it is
working.
5.15.2.1 Sound card
[Hack #16] covers steps to test
and configure your sound card, but the first clue that Knoppix has
gotten your sound card to work is the "Initiating
startup sequence" sound you hear when KDE starts.
5.15.2.2 Video cards
If Knoppix brings up a desktop environment, then obviously the video
card and display work to some degree. Specific information about
which video card features X was able to load, and which resolutions
and color depths X accepted and rejected, can be found in
/var/log/XFree86.0.log. This file contains a lot
of detailed information, much like dmesg, and
like dmesg, much of it may not interest you. A
lot of the interesting information (e.g., which resolutions were
accepted and rejected, and which input devices were configured) can
be found near the bottom of the file:
. . .
(--) NV(0): VideoRAM: 32768 kBytes
(==) NV(0): Using gamma correction (1.0, 1.0, 1.0)
(II) NV(0): Monitor0: Using hsync range of 30.00-70.00 kHz
(II) NV(0): Monitor0: Using vrefresh range of 50.00-120.00 Hz
(II) NV(0): Clock range: 12.00 to 350.00 MHz
(II) NV(0): Not using mode "1280x1024" (hsync out of range)
(II) NV(0): Not using mode "1024x768" (hsync out of range)
(II) NV(0): Not using mode "1152x864" (hsync out of range)
. . .
(**) Option "Protocol" "IMPS/2"
(**) USB Mouse: Protocol: "IMPS/2"
(**) Option "SendCoreEvents" "true"
(**) USB Mouse: always reports core events
(**) Option "CorePointer"
(**) USB Mouse: Core Pointer
(**) Option "Device" "/dev/input/mice"
(**) Option "Buttons" "5"
(**) USB Mouse: Emulate3Buttons, Emulate3Timeout: 50
(**) Option "ZAxisMapping" "4 5"
(**) USB Mouse: ZAxisMapping: buttons 4 and 5
(**) USB Mouse: Buttons: 5
(II) XINPUT: Adding extended input device "USB Mouse" (type: MOUSE)
. . .
X outputs warnings and errors in the files starting with
(WW) and (EE), respectively. To
see warnings and errors, type the following command:
knoppix@ttyp0[knoppix]$
egrep "^(\(WW|EE\))" /var/log/XFree86.0.log
Knoppix also attempts to enable hardware 3D acceleration, if
possible, using Direct Rendering Interface (DRI). Knoppix falls back
to software 3D acceleration if hardware acceleration
isn't possible. Check the current status of DRI with
the glxinfo command. This command outputs a lot
of information about the GLX libraries on the system. You can use
grep to display just the line showing whether
DRI (and therefore 3D acceleration) is enabled:
knoppix@ttyp0[knoppix]$
glxinfo | grep "direct rendering"
direct rendering: No
Note that all recent Nvidia cards do not have 3D acceleration enabled
by default. To enable 3D acceleration for these cards, you must
install Nvidia's own kernel modules and X drivers
with the Knoppix live-software installer [Hack #28] .
Once the install finishes and X restarts, direct rendering is
enabled.
5.15.2.3 Network cards
Testing network cards on the system is pretty simple—just
browse the Web or the intranet. Obviously, if you can ping other
hosts on the network or browse an external web site, then your
network card works. However, view more detailed information about
your network card configuration by using the
ifconfig utility:
knoppix@ttyp0[knoppix]$
/sbin/ifconfig
eth0 Link encap:Ethernet HWaddr 00:A0:CC:32:BF:88
inet addr:192.168.0.2 Bcast:192.168.0.255 Mask:255.255.255.0
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:3927 errors:0 dropped:0 overruns:0 frame:0
TX packets:3240 errors:1 dropped:0 overruns:0 carrier:2
collisions:0 txqueuelen:1000
RX bytes:5278944 (5.0 MiB) TX bytes:1692461 (1.6 MiB)
Interrupt:5 Base address:0x1000
lo Link encap:Local Loopback
inet addr:127.0.0.1 Mask:255.0.0.0
UP LOOPBACK RUNNING MTU:16436 Metric:1
RX packets:16 errors:0 dropped:0 overruns:0 frame:0
TX packets:16 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:0
RX bytes:896 (896.0 b) TX bytes:896 (896.0 b)
This utility is standard on every major Linux distribution, and when
run without any arguments, it lists all network devices on the
system. In this example, it has found an Ethernet card,
eth0, and displays its MAC address, IP address,
broadcast, and other networking information. In addition, it displays
how many bytes have been received (RX bytes) and transmitted (TX
bytes) across the interface.
For probing all the hardware on your system, use these commands. If
you are probing the hardware to check for Linux compatibility but
aren't planning on installing Knoppix itself to your
hard drive, then check out the next hack for information on how to
copy Knoppix configurations to other distributions.
|