MCPcopy Create free account
hub / github.com/F-Stack/f-stack / get_pci_device_details

Function get_pci_device_details

dpdk/usertools/dpdk-devbind.py:171–195  ·  view source on GitHub ↗

This function gets additional details for a PCI device

(dev_id, probe_lspci)

Source from the content-addressed store, hash-verified

169
170
171def get_pci_device_details(dev_id, probe_lspci):
172 '''This function gets additional details for a PCI device'''
173 device = {}
174
175 if probe_lspci:
176 extra_info = subprocess.check_output(["lspci", "-vmmks", dev_id]).splitlines()
177 # parse lspci details
178 for line in extra_info:
179 if not line:
180 continue
181 name, value = line.decode("utf8").split("\t", 1)
182 name = name.strip(":") + "_str"
183 device[name] = value
184 # check for a unix interface name
185 device["Interface"] = ""
186 for base, dirs, _ in os.walk("/sys/bus/pci/devices/%s/" % dev_id):
187 if "net" in dirs:
188 device["Interface"] = \
189 ",".join(os.listdir(os.path.join(base, "net")))
190 break
191 # check if a port is used for ssh connection
192 device["Ssh_if"] = False
193 device["Active"] = ""
194
195 return device
196
197
198def clear_data():

Callers 3

get_device_detailsFunction · 0.85
bind_oneFunction · 0.85
bind_allFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected