Returns a list containing either: * List of PCI B:D:F matching arg, using shell wildcards e.g. 80:04.* * Only the passed arg if matching list is empty
(arg)
| 627 | |
| 628 | |
| 629 | def pci_glob(arg): |
| 630 | '''Returns a list containing either: |
| 631 | * List of PCI B:D:F matching arg, using shell wildcards e.g. 80:04.* |
| 632 | * Only the passed arg if matching list is empty''' |
| 633 | sysfs_path = "/sys/bus/pci/devices" |
| 634 | for _glob in [arg, '0000:' + arg]: |
| 635 | paths = [basename(path) for path in glob(path_join(sysfs_path, _glob))] |
| 636 | if paths: |
| 637 | return paths |
| 638 | return [arg] |
| 639 | |
| 640 | |
| 641 | def parse_args(): |