Skip to content

Commit

Permalink
use internal pci database whenever possible
Browse files Browse the repository at this point in the history
Windows-provided values will only be used as a fallback for NAME,
CAPTION and MANUFACTURER
  • Loading branch information
guillomovitch committed Nov 21, 2012
1 parent 270a543 commit 700536c
Showing 1 changed file with 20 additions and 0 deletions.
Expand Up @@ -3,6 +3,7 @@ package FusionInventory::Agent::Task::Inventory::Input::Win32::Controllers;
use strict;
use warnings;

use FusionInventory::Agent::Tools::Generic;
use FusionInventory::Agent::Tools::Win32;

sub isEnabled {
Expand Down Expand Up @@ -49,6 +50,25 @@ sub _getControllers {

delete $controller->{deviceid};

my ($vendor_id, $device_id) = split (/:/, $controller->{PCIID});
my $subdevice_id = $controller->{PCISUBSYSTEMID};

my $vendor = getPCIDeviceVendor(id => $vendor_id, %params);
if ($vendor) {
$controller->{MANUFACTURER} = $vendor->{name};

if ($vendor->{devices}->{$device_id}) {
my $entry = $vendor->{devices}->{$device_id};
$controller->{CAPTION} = $entry->{name};

$controller->{NAME} =
$subdevice_id && $entry->{subdevices}->{$subdevice_id} ?

$entry->{subdevices}->{$subdevice_id}->{name} :
$entry->{name};
}
}

push @controllers, $controller;
}

Expand Down

0 comments on commit 700536c

Please sign in to comment.