Home » Questions » Computers [ Ask a new question ]

How to read a specific PCI device register in Linux from the CLI?

How to read a specific PCI device register in Linux from the CLI?

In order to control my backlight, I need to do the following:

Asked by: Guest | Views: 428
Total answers/comments: 1
bert [Entry]

"You want the program setpci. It looks like this format would do what you want:
setpci -s 00:02.1 F4.B

See man setpci: the only difference with your version is you're trying to set the register, so you name it and assign a value (""F4.B=x""). Here, just name it; don't assign a value.
From the manpage:

Operations
To query value of a configuration register, just name it (either by
typing its name or by typing register address with optional .B, .W or .L
suffix specifying register width as byte, word or longword).
To set a register, write reg=values where reg is the same as you would
use to query the register and values is a comma-separated list of values
you want to write starting with the given address. Each value to be written
can be specified either as a hexadecimal number or as a bits:mask pair
which causes the bits corresponding to binary ones in the mask to be changed
to values of the corresponding bits in the bits"