TrumanWong

setpci

Tools for querying and configuring PCI devices

Supplementary instructions

setpci command is a tool for querying and configuring PCI devices.

grammar

setpci(options)(parameters)

Options

-v: Display detailed information about command execution;
-f: When there is no operation to be completed, no information is displayed;
-D: Test mode, does not actually write configuration information to the register;
-d: Only display information for the given manufacturer and device;
-s: Display only the device on the specified bus, slot, or function block information on the device.

Parameters

  • PCI device: Specify the PCI device to be configured;
  • Operation: Specify the configuration operation to be completed.

Example

How to adjust laptop screen brightness under Linux:

First enter the terminal and enter the lspci command to list the addresses of various devices:

lspci
00:00.0 host bridge: Intel Corporation Mobile 945GM/PM/GMS, 943/940GML and 945GT Express Memory Controller Hub (rev 03)
00:02.0 VGA compatible controller: Intel Corporation Mobile 945GM/GMS, 943/940GML Express Integrated Graphics Controller (rev 03)
00:02.1 Display controller: Intel Corporation Mobile 945GM/GMS/GME, 943/940GML Express Integrated Graphics Controller (rev 03)
00:1b.0 Audio device: Intel Corporation N10/ICH 7 Family High Definition Audio Controller (rev 02)
00:1c.0 PCI bridge: Intel Corporation N10/ICH 7 Family PCI Express Port 1 (rev 02)
00:1c.1 PCI bridge: Intel Corporation N10/ICH 7 Family PCI Express Port 2 (rev 02)
...

We found that 00:02.0 is a VGA device, so we modified its properties:

sudo setpci -s 00:02.0 F4.B=FF

explain:

  • setpci is a command to modify device attributes.
  • -s means that the next input is the address of the device.
  • 00:02.0 VGA device address (:.).
  • F4 The address of the attribute to be modified, which should represent "brightness".
  • .B Modified length (B should be Byte, and w (should be Word, two bytes), L (should be Long, 4 bytes)).
  • =FF The value to be modified (can be changed).

Here 00 is the darkest and FF is the brightest. Different computers may be different. For example, if I think FF is too flashy, I can:

sudo setpci -s 00:02.0 F4.B=CC