LSPCI command use in BKWP64 script

interpretive language scripts


Moderator: Forum moderators

Post Reply
Clarity
Posts: 4233
Joined: Fri Jul 24, 2020 10:59 pm
Has thanked: 1814 times
Been thanked: 569 times

LSPCI command use in BKWP64 script

Post by Clarity »

I am having problem using the lspci command and am confused.

1st
I want to list all of its contents for the VGA adapter., but I am only getting its 1st line shown in pic below.

2nd
I want to ONLY list the 2 driver elements of the driver components on the lspci command for VGA section. I get nothing at all when I try to grep "driver"

Console results shown below

Thoughts

Code: Select all

# lspci -vnn | grep VGA
00:01.0 VGA compatible controller [0300]: Advanced Micro Devices, Inc. [AMD/ATI] Mullins [Radeon R4/R5 Graphics] [1002:9851] (rev 45) (prog-if 00 [VGA controller])
# lspci -vnn 
00:00.0 Host bridge [0600]: Advanced Micro Devices, Inc. [AMD] Family 16h (Models 30h-3fh) Processor Root Complex [1022:1566]
	Subsystem: Hewlett-Packard Company Family 16h (Models 30h-3fh) Processor Root Complex [103c:8245]
	Flags: bus master, fast devsel, latency 0

00:01.0 VGA compatible controller [0300]: Advanced Micro Devices, Inc. [AMD/ATI] Mullins [Radeon R4/R5 Graphics] [1002:9851] (rev 45) (prog-if 00 [VGA controller])
	Subsystem: Hewlett-Packard Company Mullins [Radeon R4/R5 Graphics] [103c:8245]
	Flags: bus master, fast devsel, latency 0, IRQ 41
	Memory at c0000000 (64-bit, prefetchable) [size=256M]
	Memory at d0000000 (64-bit, prefetchable) [size=8M]
	I/O ports at f000 [size=256]
	Memory at fea00000 (32-bit, non-prefetchable) [size=256K]
	Expansion ROM at 000c0000 [disabled] [size=128K]
	Capabilities: [48] Vendor Specific Information: Len=08 <?>
	Capabilities: [50] Power Management version 3
	Capabilities: [58] Express Root Complex Integrated Endpoint, MSI 00
	Capabilities: [a0] MSI: Enable+ Count=1/1 Maskable- 64bit+
	Capabilities: [100] Vendor Specific Information: ID=0001 Rev=1 Len=010 <?>
	Capabilities: [270] Secondary PCI Express
	Capabilities: [2b0] Address Translation Service (ATS)
	Capabilities: [2c0] Page Request Interface (PRI)
	Capabilities: [2d0] Process Address Space ID (PASID)
	Kernel driver in use: radeon
	Kernel modules: radeon, amdgpu
User avatar
fredx181
Posts: 3385
Joined: Tue Dec 03, 2019 1:49 pm
Location: holland
Has thanked: 437 times
Been thanked: 1484 times
Contact:

Re: LSPCI command use in BKWP64 script

Post by fredx181 »

Clarity wrote: Wed Feb 26, 2025 4:44 am

I am having problem using the lspci command and am confused.

1st
I want to list all of its contents for the VGA adapter., but I am only getting its 1st line shown in pic below.

I'd use sed rather than grep for that (grep VGA shows only the line that actually contains VGA):
lspci -vnn | sed -n '/VGA/,/^$/p'

2nd
I want to ONLY list the 2 driver elements of the driver components on the lspci command for VGA section. I get nothing at all when I try to grep "driver"

Not sure if I understand, if you mean the last two lines (containing "Kernel") then this should do.
lspci -vnn | sed -n '/VGA/,/^$/p' | grep Kernel

Clarity
Posts: 4233
Joined: Fri Jul 24, 2020 10:59 pm
Has thanked: 1814 times
Been thanked: 569 times

Re: LSPCI command use in BKWP64 script

Post by Clarity »

Thanks! for this guidance to use SED instead of GREP.

Code: Select all

root@live:~# lspci -vnn | sed -n '/VGA/,/^$/p'
03:00.0 VGA compatible controller [0300]: NVIDIA Corporation GT200GL [Quadro FX 4800] [10de:05fe] (rev a1) (prog-if 00 [VGA controller])
	Subsystem: NVIDIA Corporation GT200GL [Quadro FX 4800] [10de:0594]
	Flags: bus master, fast devsel, latency 0, IRQ 32
	Memory at f6000000 (32-bit, non-prefetchable) [size=16M]
	Memory at e0000000 (64-bit, prefetchable) [size=256M]
	Memory at f4000000 (64-bit, non-prefetchable) [size=32M]
	I/O ports at dc80 [size=128]
	Expansion ROM at 000c0000 [disabled] [size=128K]
	Capabilities: [60] Power Management version 3
	Capabilities: [68] MSI: Enable+ Count=1/1 Maskable- 64bit+
	Capabilities: [78] Express Endpoint, MSI 00
	Capabilities: [100] Virtual Channel
	Capabilities: [128] Power Budgeting <?>
	Capabilities: [600] Vendor Specific Information: ID=0001 Rev=1 Len=024 <?>
	Kernel driver in use: nouveau
	Kernel modules: nouveau

root@live:~# lspci -vnn | sed -n '/VGA/,/^$/p' | grep Kernel
	Kernel driver in use: nouveau
	Kernel modules: nouveau
Post Reply

Return to “Scripts”