diff --git a/Changes b/Changes index b9bac32763..7d71e4c3e1 100644 --- a/Changes +++ b/Changes @@ -19,6 +19,7 @@ inventory: * Fix #453: under MacOS, skip XML DTD validation for software inventory as parsing may fail if a proxy is enabled * Fix #473: fix arch detection under MacOS +* Fix #475: fix video cards support under MacOS deploy: * Bump Deploy task version to 2.7 diff --git a/lib/FusionInventory/Agent/Task/Inventory/MacOS/Videos.pm b/lib/FusionInventory/Agent/Task/Inventory/MacOS/Videos.pm index 0b6382f73f..68104c839e 100644 --- a/lib/FusionInventory/Agent/Task/Inventory/MacOS/Videos.pm +++ b/lib/FusionInventory/Agent/Task/Inventory/MacOS/Videos.pm @@ -51,6 +51,17 @@ sub _getDisplays { foreach my $videoName (keys %{$infos->{'Graphics/Displays'}}) { my $videoCardInfo = $infos->{'Graphics/Displays'}->{$videoName}; + + my $memory = $videoCardInfo->{'VRAM (Total)'} || + $videoCardInfo->{'VRAM (Dynamic, Max)'}; + $memory =~ s/\ .*//g if $memory; + + my $video = { + CHIPSET => $videoCardInfo->{'Chipset Model'}, + MEMORY => $memory, + NAME => $videoName + }; + foreach my $displayName (keys %{$videoCardInfo->{Displays}}) { next if $displayName eq 'Display Connector'; next if $displayName eq 'Display'; @@ -58,31 +69,33 @@ sub _getDisplays { my $resolution = $displayInfo->{Resolution}; if ($resolution) { - $resolution =~ s/\ //g; - $resolution =~ s/\@.*//g; + my ($x,$y) = $resolution =~ /(\d+) *x *(\d+)/; + $resolution = $x.'x'.$y if $x && $y; } - my $memory = $videoCardInfo->{'VRAM (Total)'}; - $memory =~ s/\ .*//g if $memory; - - push @videos, { - CHIPSET => $videoCardInfo->{'Chipset Model'}, - MEMORY => $memory, - NAME => $videoName, - RESOLUTION => $resolution, - PCISLOT => $videoCardInfo->{Slot} - }; - my $monitor = { - CAPTION => $displayName, - DESCRIPTION => $displayName, + CAPTION => $displayName }; my $serial = getSanitizedString($displayInfo->{'Display Serial Number'}); $monitor->{SERIAL} = $serial if $serial; + my $description = getSanitizedString($displayInfo->{'Display Type'}); + $monitor->{DESCRIPTION} = $description if $description; + push @monitors, $monitor; + + # Set first found resolution on associated video card + $video->{RESOLUTION} = $resolution + if $resolution && !$video->{RESOLUTION}; } + + $video->{PCISLOT} = $videoCardInfo->{Bus} + if defined($videoCardInfo->{Bus}); + $video->{PCISLOT} = $videoCardInfo->{Slot} + if defined($videoCardInfo->{Slot}); + + push @videos, $video; } return (