HWDETECT

The HWDETECT utility performs basic hardware detection functions that are typically performed by using SMBIOS and a PCI scan. This utility contains options that can be used to either dump all of the hardware information to an output file or to query hardware information and return values that set the errorlevel environment variable or the return code, for example $?.

HWDETECT includes basic hardware scan functions and more complex PCI device detection options. The basic hardware scan functions can be used one at a time only. The PCI device detection functions, however, can be combined or used more than once on the same command line to produce a query based on multiple restrictions.

Usage:
hwdetect [-s|-i|-p|--m=machinetype] -f=filename
Parameter Description Example
-s
Determines if the target server is an IBM System x, xSeries, or BladeCenter server. The return values are:
  • 0 for an IBM system
  • 1 for a non-IBM system
./hwdetect -s
if [ $? –eq 1 ]; then
  echo “Perform non-IBM equipment 
specific steps here.”

else
  echo “Perform IBM equipment specific 
steps here.”
fi
-i
Dumps all available information about the system hardware to the screen in a .ini file format. You can use the -f parameter to send this information to a file.

A return code of zero indicates success. All other return codes indicate an error.

./hwdetect -i
-f=filename
Directs the output to the indicated file. This parameter can be used in conjunction with the -i or -p parameters.

A return code of 254 indicates that HWDETECT was unable to open the specified file.

./hwdetect -i –-f=hwdetect.out
cat hwdetect.out | grep “Bus_Number.21 = 41”
--m=machinetype
Compares the machine type of the current system to the specified machine type.
Return codes:
  • 0 indicates that the machine types do not match.
  • 1 indicates a match.
./hwdetect –-m=8676
if [ $? –eq 8676 ]; then
  echo “It is an IBM system.”
else
  echo “It is not an IBM system.”

You can also use HWDETECT to inventory PCI devices on the target system.

Usage:
hwdetect [--vid=vendor_id|--did=device_id|--svid=sub-vendor_id|
--sdid=sub-device_id|--bn=bus_number|--dn=device_number|--add=number]
Parameter Description Example
--vid=vendor_id
Searches for PCI devices with the indicated hexadecimal vendor ID.
./hwdetect --vid=40
echo "Found $? matches..."
--did=device_id
Searches for PCI devices with the indicated hexadecimal device ID.
./hwdetect --did=41
echo "Found $? matches..."
--svid=sub-vendor_id
Searches for PCI devices with the indicated hexadecimal sub-vendor ID.
./hwdetect --svid=42
echo "Found $? matches..."
--sdid=sub-device_id
Searches for PCI devices with the indicated hexadecimal sub-device ID.
./hwdetect --sdid=43
echo "Found $? matches..."
--bn=bus_number
Starts the search at the indicated decimal bus number.
./hwdetect --bn=44
echo "Found $? matches..."
--dn=device_number
Starts the search at the indicated decimal device number.
./hwdetect --dn=45
echo "Found $? matches..."
--add=number
Adds the specified decimal value to the return value before exiting.
./hwdetect --vid=46 --add=1
echo "Found $? - 1 matches..."
The following example shows a hwdetect.out file created by the –i flag:
[System]
Machine_Type=8674
Model_Number=42X
Serial_Number=78Z9506
Product_Name=eserver xSeries 330
BIOS_version=1.04
BIOS_Build_Level=EME112A
BIOS_DATE=06/28/2002  
BIOS_Manufacturer=IBM
BIOS_Language=US
Number_Of_Enclosures=1
Enclosure_Type.0=23 
Processor_Slots=2
Active_Processors=1
Processor_Family.0=17    
Processor_Speed_MHz.0=1400 
Processor_X64 = TRUE
Total_Enabled_Memory_Mb=256
ROM_Diagnostics_Build_Level=EME112A
ISMP_Build_Level=BR8T30A
RSA_Build_Level=GEE834A
System_UUID = 8030E01060F010B010605090D0A020F0
Blade_Chassis_UUID = 0F020A0D0900F00F020A0D0900F00F02
Blade_Slot = 02

[PCI]                 
Total_Number_Devices=10
Bus_Number.0=0       
Device_Number.0=1
Function_Number.0=0
Class_Code.0=0000
Revision.0=0
Header_Type.0=0
Vendor_ID.0=5333     
Device_ID.0=8A22
Subvendor_ID.0=1014
Subdevice_ID.0=01C5
Bus_Number.1=0
Device_Number.1=2
Function_Number.1=0
Class_Code.1=0000
Revision.1=0
Header_Type.1=0
Vendor_ID.1=8086
Device_ID.1=1229
Subvendor_ID.1=1014
Subdevice_ID.1=105C
The –p flag produces the same output with the exception that the section names are tacked onto the beginning of each keyword, as shown in the following example:
System_Machine_Type = 8674
System_Model_Number = 42X
System_Serial_Number = 78Z9506
…
PCI_Bus_Number.0 = 0 
PCI_Device_Number.0 = 1   
...
Notes:
  1. The BIOS_DATE value is listed in the format mm/dd/yyyy.
  2. The Enclosure_Type.0=23 is based on SMBIOS 2.3 spec. 23 = Main chassis.
  3. There is an entry for Processor_Family and Processor_Speed_MHz for each microprocessor in the server.
  4. The ROM_Diagnostics_Build_Level is empty for servers that do not support ROM diagnostics.
  5. PCI devices are listed in the order that they are scanned.
  6. PCI devices are listed in the Value.n format, where Value is the variable name and n is the nth PCI device scanned.
  7. The header_type field is not available for versions of HWDETECT running on Windows 32- or 64-bit operating systems.
  8. The vendor, device, sub-vendor, and sub-device values are in hexadecimal notation.