X-Git-Url: https://git.proxmox.com/?p=pve-common.git;a=blobdiff_plain;f=src%2FPVE%2FSysFSTools.pm;h=e83d1630f3be9cef930b9013a2da73d76f381672;hp=c16e7d3720947c7b43684443c4c73650816fa9c2;hb=b5dacd1053b2a302c360ba6360c82ca8a60fc9cd;hpb=63075acb41af7f39293fdf03fe09ca9b2ba44596 diff --git a/src/PVE/SysFSTools.pm b/src/PVE/SysFSTools.pm index c16e7d3..e83d163 100644 --- a/src/PVE/SysFSTools.pm +++ b/src/PVE/SysFSTools.pm @@ -11,16 +11,17 @@ my $pcisysfs = "/sys/bus/pci"; my $pciregex = "([a-f0-9]{4}):([a-f0-9]{2}):([a-f0-9]{2})\.([a-f0-9])"; sub lspci { - my ($filter) = @_; + my ($id_filter) = @_; my $devices = {}; dir_glob_foreach("$pcisysfs/devices", $pciregex, sub { my (undef, undef, $bus, $slot, $function) = @_; + my $id = "$bus:$slot"; - return if defined($filter) && $id ne $filter; - my $res = { id => $id, function => $function}; - push @{$devices->{$id}}, $res; + return if defined($id_filter) && $id_filter ne $id; + + push @{$devices->{$id}}, { id => $id, function => $function }; }); # Entries should be sorted by functions.