@@ -87,7 +87,7 @@ class PcieCollector(InBandDataCollector[PcieDataModel, None]):
8787 CMD_LSPCI_PATH = "lspci -PP"
8888 CMD_LSPCI_HEX_SUDO = "lspci -xxxx"
8989 CMD_LSPCI_HEX = "lspci -x"
90- CMD_LSPCI_AMD_DEVICES = "lspci -d 1002 : -nn"
90+ CMD_LSPCI_AMD_DEVICES = "lspci -d {vendor_id} : -nn"
9191 CMD_LSPCI_PATH_DEVICE = "lspci -PP -d {vendor_id}:{dev_id}"
9292
9393 def _detect_amd_device_ids (self ) -> dict [str , list [str ]]:
@@ -96,16 +96,21 @@ def _detect_amd_device_ids(self) -> dict[str, list[str]]:
9696 Returns:
9797 dict[str, list[str]]: Dictionary with 'vendor_id', 'device_ids', and 'vf_device_ids'
9898 """
99+ vendor_id_hex = format (self .system_info .vendorid_ep , "x" )
99100 result : dict [str , list [str ]] = {
100- "vendor_id" : ["1002" ],
101+ "vendor_id" : [vendor_id_hex ],
101102 "device_ids" : [],
102103 "vf_device_ids" : [],
103104 }
104105
105- res = self ._run_sut_cmd (self .CMD_LSPCI_AMD_DEVICES , sudo = False , log_artifact = False )
106+ res = self ._run_sut_cmd (
107+ self .CMD_LSPCI_AMD_DEVICES .format (vendor_id = vendor_id_hex ),
108+ sudo = False ,
109+ log_artifact = False ,
110+ )
106111 if res .exit_code == 0 and res .stdout :
107112 # Pattern: [vendor:device]
108- device_id_pattern = r "\[1002 :([0-9a-fA-F]{4 })\]"
113+ device_id_pattern = rf "\[{ vendor_id_hex } :([0-9a-fA-F]{{4} })\]"
109114 # Pattern to detect VF in description
110115 vf_pattern = r"Virtual Function"
111116
@@ -585,7 +590,9 @@ def _get_pcie_data(
585590 # Detect AMD device IDs dynamically from the system
586591 detected_devices = self ._detect_amd_device_ids ()
587592 vendor_id = (
588- detected_devices ["vendor_id" ][0 ] if detected_devices ["vendor_id" ] else "1002"
593+ detected_devices ["vendor_id" ][0 ]
594+ if detected_devices ["vendor_id" ]
595+ else format (self .system_info .vendorid_ep , "x" )
589596 )
590597 device_ids = detected_devices ["device_ids" ]
591598 vf_device_ids = detected_devices ["vf_device_ids" ]
0 commit comments