This function gets additional details for a PCI device
(dev_id, probe_lspci)
| 169 | |
| 170 | |
| 171 | def 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 | |
| 198 | def clear_data(): |
no outgoing calls
no test coverage detected