[Fusioninventory-commit] [fusinv/fusioninventory-agent] 51aa63: more EDID manifacturer code

Guillaume Rousse guillomovitch at gmail.com
Thu May 3 18:16:14 UTC 2012


  Branch: refs/heads/2.3.x
  Home:   https://github.com/fusinv/fusioninventory-agent
  Commit: 51aa63bc67107bf7980de187a8eba16e0f46adee
      https://github.com/fusinv/fusioninventory-agent/commit/51aa63bc67107bf7980de187a8eba16e0f46adee
  Author: Gonéri Le Bouder <goneri at rulezlan.org>
  Date:   2012-04-25 (Wed, 25 Apr 2012)

  Changed paths:
    M lib/FusionInventory/Agent/Tools/Screen.pm

  Log Message:
  -----------
  more EDID manifacturer code

add Princeton and Polaroid.

But reported by William Evens on OCS bug tracker:
https://bugs.launchpad.net/ocsinventory-windows-agent/+bug/911696/comments/6


diff --git a/lib/FusionInventory/Agent/Tools/Screen.pm b/lib/FusionInventory/Agent/Tools/Screen.pm
index 5cb71db..cd479fb 100644
--- a/lib/FusionInventory/Agent/Tools/Screen.pm
+++ b/lib/FusionInventory/Agent/Tools/Screen.pm
@@ -487,7 +487,9 @@ sub getManufacturerFromCode {
         "IFS" => "InFocus",
         "BOE" => "BOE Display Technology",
         "IQT" => "Hyundai",
-        "HSD" => "Hannspree Inc"
+        "HSD" => "Hannspree Inc",
+        "PRT" => "Princeton",
+        "PDC" => "Polaroid"
 
 
     };


================================================================
  Commit: d430eb224035bb7d486425a5e772149a601fdedb
      https://github.com/fusinv/fusioninventory-agent/commit/d430eb224035bb7d486425a5e772149a601fdedb
  Author: Alexander Evseev <PunchyBummer at mailinator.com>
  Date:   2012-04-26 (Thu, 26 Apr 2012)

  Changed paths:
    M lib/FusionInventory/Agent/Task/Inventory/Input/Linux/Storages/Lsilogic.pm

  Log Message:
  -----------
  Change in regexp for mpt-status output


diff --git a/lib/FusionInventory/Agent/Task/Inventory/Input/Linux/Storages/Lsilogic.pm b/lib/FusionInventory/Agent/Task/Inventory/Input/Linux/Storages/Lsilogic.pm
index 2b6a0ca..c8af20d 100644
--- a/lib/FusionInventory/Agent/Task/Inventory/Input/Linux/Storages/Lsilogic.pm
+++ b/lib/FusionInventory/Agent/Task/Inventory/Input/Linux/Storages/Lsilogic.pm
@@ -33,7 +33,7 @@ sub doInventory {
         );
         next unless $handle;
         while (my $line = <$handle>) {
-            next unless /phys_id:(\d+).*product_id:\s*(\S*)\s+revision:(\S+).*size\(GB\):(\d+)/;
+            next unless $line =~ /phys_id:(\d+).*product_id:\s*(\S*)\s+revision:(\S+).*size\(GB\):(\d+)/;
             my $id = $1;
 
             my $storage = {


================================================================
  Commit: f1d45d1c9416cde88cd2a6204c4a82cd737c1cf2
      https://github.com/fusinv/fusioninventory-agent/commit/f1d45d1c9416cde88cd2a6204c4a82cd737c1cf2
  Author: Alexander Evseev <PunchyBummer at mailinator.com>
  Date:   2012-04-26 (Thu, 26 Apr 2012)

  Changed paths:
    M lib/FusionInventory/Agent/Task/Inventory/Input/Linux/Storages/Adaptec.pm

  Log Message:
  -----------
  Alternative naming for adaptec controller


diff --git a/lib/FusionInventory/Agent/Task/Inventory/Input/Linux/Storages/Adaptec.pm b/lib/FusionInventory/Agent/Task/Inventory/Input/Linux/Storages/Adaptec.pm
index 4662f62..23bb8a3 100644
--- a/lib/FusionInventory/Agent/Task/Inventory/Input/Linux/Storages/Adaptec.pm
+++ b/lib/FusionInventory/Agent/Task/Inventory/Input/Linux/Storages/Adaptec.pm
@@ -28,7 +28,9 @@ sub doInventory {
 
     foreach my $device (@devices) {
         next unless $device->{MANUFACTURER};
-        next unless $device->{MANUFACTURER} eq 'Adaptec';
+        next unless
+            $device->{MANUFACTURER} eq 'Adaptec' ||
+            $device->{MANUFACTURER} eq 'ServeRA';
 
         foreach my $disk (_getDisksFromProc(
                 controller => 'scsi' . $device->{SCSI_COID},


================================================================
  Commit: a5214e3cbc2cdf19d57a79a3fd957a7b0efb1051
      https://github.com/fusinv/fusioninventory-agent/commit/a5214e3cbc2cdf19d57a79a3fd957a7b0efb1051
  Author: Alexander Evseev <PunchyBummer at mailinator.com>
  Date:   2012-04-26 (Thu, 26 Apr 2012)

  Changed paths:
    M lib/FusionInventory/Agent/Task/Inventory/Input/Linux/Storages/Adaptec.pm

  Log Message:
  -----------
  Alternative model for adaptec controller


diff --git a/lib/FusionInventory/Agent/Task/Inventory/Input/Linux/Storages/Adaptec.pm b/lib/FusionInventory/Agent/Task/Inventory/Input/Linux/Storages/Adaptec.pm
index 23bb8a3..9ddf21a 100644
--- a/lib/FusionInventory/Agent/Task/Inventory/Input/Linux/Storages/Adaptec.pm
+++ b/lib/FusionInventory/Agent/Task/Inventory/Input/Linux/Storages/Adaptec.pm
@@ -80,7 +80,7 @@ sub _getDisksFromProc {
             $disk->{FIRMWARE} = $2;
 
             # that's the controller itself, not a disk
-            next if $disk->{MODEL} =~ 'raid';
+            next if $disk->{MODEL} =~ /(raid|RAID)/;
 
             $disk->{MANUFACTURER} = getCanonicalManufacturer(
                 $disk->{MODEL}


================================================================
  Commit: 5856d94f43a6f5f9e1661c19c029c958f3b5809b
      https://github.com/fusinv/fusioninventory-agent/commit/5856d94f43a6f5f9e1661c19c029c958f3b5809b
  Author: Alexander Evseev <PunchyBummer at mailinator.com>
  Date:   2012-04-26 (Thu, 26 Apr 2012)

  Changed paths:
    M lib/FusionInventory/Agent/Task/Inventory/Input/Generic/Processes.pm

  Log Message:
  -----------
  Ability to disable processes inventory


diff --git a/lib/FusionInventory/Agent/Task/Inventory/Input/Generic/Processes.pm b/lib/FusionInventory/Agent/Task/Inventory/Input/Generic/Processes.pm
index e22c36c..ca95aaa 100644
--- a/lib/FusionInventory/Agent/Task/Inventory/Input/Generic/Processes.pm
+++ b/lib/FusionInventory/Agent/Task/Inventory/Input/Generic/Processes.pm
@@ -11,6 +11,7 @@ use FusionInventory::Agent::Tools::Unix;
 sub isEnabled {
     return 
         $OSNAME ne 'MSWin32' &&
+        !$params{no_category}->{process} &&
         canRun('ps');
 }
 


================================================================
  Commit: e9619578553af32e337c0798069e4ba178bc0e6a
      https://github.com/fusinv/fusioninventory-agent/commit/e9619578553af32e337c0798069e4ba178bc0e6a
  Author: Alexander Evseev <PunchyBummer at mailinator.com>
  Date:   2012-04-26 (Thu, 26 Apr 2012)

  Changed paths:
    M lib/FusionInventory/Agent/Task/Inventory/Input/Virtualization/Qemu.pm

  Log Message:
  -----------
  qemu and kvm may have virtio disks (vd?) and SCSI emulation (sd?)


diff --git a/lib/FusionInventory/Agent/Task/Inventory/Input/Virtualization/Qemu.pm b/lib/FusionInventory/Agent/Task/Inventory/Input/Virtualization/Qemu.pm
index 92a8d21..a4a68a4 100644
--- a/lib/FusionInventory/Agent/Task/Inventory/Input/Virtualization/Qemu.pm
+++ b/lib/FusionInventory/Agent/Task/Inventory/Input/Virtualization/Qemu.pm
@@ -27,7 +27,8 @@ sub doInventory {
         logger => $logger, command => 'ps -ef'
     )) {
         # match only if an qemu instance
-        next unless $process->{CMD} =~ /(qemu|kvm|(qemu-kvm)).*\-([fh]d[a-d]|cdrom).*/;
+        next unless 
+            $process->{CMD} =~ /(qemu|kvm|(qemu-kvm)).*\-([fhsv]d[a-d]|cdrom).*/;
             
         my $name;
         my $mem = 0;


================================================================
  Commit: 427efab9735765131b47d170c834ee33c66dfc43
      https://github.com/fusinv/fusioninventory-agent/commit/427efab9735765131b47d170c834ee33c66dfc43
  Author: Guillaume Rousse <guillomovitch at gmail.com>
  Date:   2012-04-26 (Thu, 26 Apr 2012)

  Changed paths:
    M lib/FusionInventory/Agent/Tools/Linux.pm

  Log Message:
  -----------
  get device name from file content, not file name

SUSE has names for block devices in /dev/.udev/db/ like b<major>:<minor>
(ex. b8:0)

Reported-by: Alexander Evseev <PunchyBummer at mailinator.com>


diff --git a/lib/FusionInventory/Agent/Tools/Linux.pm b/lib/FusionInventory/Agent/Tools/Linux.pm
index 94a38c8..983a329 100644
--- a/lib/FusionInventory/Agent/Tools/Linux.pm
+++ b/lib/FusionInventory/Agent/Tools/Linux.pm
@@ -29,8 +29,11 @@ sub getDevicesFromUdev {
     my @devices;
 
     foreach my $file (glob ("/dev/.udev/db/*")) {
-        next unless $file =~ /([sh]d[a-z])$/;
-        my $device = $1;
+        my $device = getFirstMatch(
+            file    => $file,
+            pattern => qr/^N:(\S+)/
+        );
+        next unless $device =~ /([hsv]d[a-z]|sr\d+)$/;
         push (@devices, _parseUdevEntry(
                 logger => $params{logger}, file => $file, device => $device
             ));


================================================================
  Commit: d147d57522cc5928966f8b73f83f364794e3037e
      https://github.com/fusinv/fusioninventory-agent/commit/d147d57522cc5928966f8b73f83f364794e3037e
  Author: Guillaume Rousse <guillomovitch at gmail.com>
  Date:   2012-04-26 (Thu, 26 Apr 2012)

  Changed paths:
    M lib/FusionInventory/Agent/Task/Inventory/Input/Virtualization/Qemu.pm

  Log Message:
  -----------
  more readable regexp


diff --git a/lib/FusionInventory/Agent/Task/Inventory/Input/Virtualization/Qemu.pm b/lib/FusionInventory/Agent/Task/Inventory/Input/Virtualization/Qemu.pm
index a4a68a4..ac8ef98 100644
--- a/lib/FusionInventory/Agent/Task/Inventory/Input/Virtualization/Qemu.pm
+++ b/lib/FusionInventory/Agent/Task/Inventory/Input/Virtualization/Qemu.pm
@@ -28,7 +28,7 @@ sub doInventory {
     )) {
         # match only if an qemu instance
         next unless 
-            $process->{CMD} =~ /(qemu|kvm|(qemu-kvm)).*\-([fhsv]d[a-d]|cdrom).*/;
+            $process->{CMD} =~ /(qemu|kvm|qemu-kvm) .* -([fhsv]d[a-d]|cdrom)/x;
             
         my $name;
         my $mem = 0;


================================================================
  Commit: 6f7adb43bfcd73e6ce15f42c465451f02d0b99f9
      https://github.com/fusinv/fusioninventory-agent/commit/6f7adb43bfcd73e6ce15f42c465451f02d0b99f9
  Author: Guillaume Rousse <guillomovitch at gmail.com>
  Date:   2012-04-26 (Thu, 26 Apr 2012)

  Changed paths:
    M lib/FusionInventory/Agent/Task/Inventory/Input/Virtualization/Qemu.pm

  Log Message:
  -----------
  - is not a metacharacter outside character class


diff --git a/lib/FusionInventory/Agent/Task/Inventory/Input/Virtualization/Qemu.pm b/lib/FusionInventory/Agent/Task/Inventory/Input/Virtualization/Qemu.pm
index ac8ef98..0212d78 100644
--- a/lib/FusionInventory/Agent/Task/Inventory/Input/Virtualization/Qemu.pm
+++ b/lib/FusionInventory/Agent/Task/Inventory/Input/Virtualization/Qemu.pm
@@ -35,7 +35,7 @@ sub doInventory {
         my $uuid;
         my $vmtype = $1;
                     
-        my @options = split (/\-/, $process->{CMD});
+        my @options = split (/-/, $process->{CMD});
         foreach my $option (@options) {
             if ($option =~ m/^([fh]d[a-d]|cdrom) (\S+)/) {
                 $name = $2 if !$name;


================================================================
  Commit: 131b4f2438007240999bfe9c8d69d12759502b06
      https://github.com/fusinv/fusioninventory-agent/commit/131b4f2438007240999bfe9c8d69d12759502b06
  Author: Guillaume Rousse <guillomovitch at gmail.com>
  Date:   2012-04-26 (Thu, 26 Apr 2012)

  Changed paths:
    M lib/FusionInventory/Agent/Task/Inventory/Input/Virtualization/Qemu.pm

  Log Message:
  -----------
  add other disk emulation types


diff --git a/lib/FusionInventory/Agent/Task/Inventory/Input/Virtualization/Qemu.pm b/lib/FusionInventory/Agent/Task/Inventory/Input/Virtualization/Qemu.pm
index 0212d78..fd2ed89 100644
--- a/lib/FusionInventory/Agent/Task/Inventory/Input/Virtualization/Qemu.pm
+++ b/lib/FusionInventory/Agent/Task/Inventory/Input/Virtualization/Qemu.pm
@@ -37,7 +37,7 @@ sub doInventory {
                     
         my @options = split (/-/, $process->{CMD});
         foreach my $option (@options) {
-            if ($option =~ m/^([fh]d[a-d]|cdrom) (\S+)/) {
+            if ($option =~ m/^([fhsv]d[a-d]|cdrom) (\S+)/) {
                 $name = $2 if !$name;
             } elsif ($option =~ m/^name (\S+)/) {
                 $name = $1;


================================================================
  Commit: 50a278d5e8a7b7409e2f86e743e0ee8a1cbe20f0
      https://github.com/fusinv/fusioninventory-agent/commit/50a278d5e8a7b7409e2f86e743e0ee8a1cbe20f0
  Author: Guillaume Rousse <guillomovitch at gmail.com>
  Date:   2012-04-26 (Thu, 26 Apr 2012)

  Changed paths:
    M lib/FusionInventory/Agent/Task/Inventory/Input/Virtualization/Qemu.pm

  Log Message:
  -----------
  don't capture uselessly


diff --git a/lib/FusionInventory/Agent/Task/Inventory/Input/Virtualization/Qemu.pm b/lib/FusionInventory/Agent/Task/Inventory/Input/Virtualization/Qemu.pm
index fd2ed89..979c2ed 100644
--- a/lib/FusionInventory/Agent/Task/Inventory/Input/Virtualization/Qemu.pm
+++ b/lib/FusionInventory/Agent/Task/Inventory/Input/Virtualization/Qemu.pm
@@ -37,8 +37,8 @@ sub doInventory {
                     
         my @options = split (/-/, $process->{CMD});
         foreach my $option (@options) {
-            if ($option =~ m/^([fhsv]d[a-d]|cdrom) (\S+)/) {
-                $name = $2 if !$name;
+            if ($option =~ m/^(?:[fhsv]d[a-d]|cdrom) (\S+)/) {
+                $name = $1 if !$name;
             } elsif ($option =~ m/^name (\S+)/) {
                 $name = $1;
             } elsif ($option =~ m/^m (\S+)/) {


================================================================
  Commit: 3323c148d5308c26f489af4374349e4cb6b37b86
      https://github.com/fusinv/fusioninventory-agent/commit/3323c148d5308c26f489af4374349e4cb6b37b86
  Author: Gonéri Le Bouder <goneri at rulezlan.org>
  Date:   2012-04-27 (Fri, 27 Apr 2012)

  Changed paths:
    M lib/FusionInventory/Agent/Tools/Generic.pm
    M t/tools/generic.t

  Log Message:
  -----------
  dmidecode: ignore CPU frequency if 10>GHz

Closes: #633


diff --git a/lib/FusionInventory/Agent/Tools/Generic.pm b/lib/FusionInventory/Agent/Tools/Generic.pm
index 25ac7ba..825b70a 100644
--- a/lib/FusionInventory/Agent/Tools/Generic.pm
+++ b/lib/FusionInventory/Agent/Tools/Generic.pm
@@ -99,13 +99,20 @@ sub getCpusFromDmidecode {
                 $cpu->{SPEED} = $1 * 1000;
             }
         }
-        if (!$cpu->{SPEED}) {
-            if ($info->{'Max Speed'}) {
-                if ($info->{'Max Speed'} =~ /^\s*(\d+)\s*Mhz/i) {
-                    $cpu->{SPEED} = $1;
-                } elsif ($info->{'Max Speed'} =~ /^\s*(\d+)\s*Ghz/i) {
-                    $cpu->{SPEED} = $1 * 1000;
-                }
+        if (!$cpu->{SPEED} && $info->{'Max Speed'}) {
+            # We only look for 3 digit Mhz frequency to avoid abvious bad
+            # value like 30000 (#633)
+            if ($info->{'Max Speed'} =~ /^\s*(\d{3,4})\s*Mhz/i) {
+                $cpu->{SPEED} = $1;
+            } elsif ($info->{'Max Speed'} =~ /^\s*(\d+)\s*Ghz/i) {
+                $cpu->{SPEED} = $1 * 1000;
+            }
+        }
+        if (!$cpu->{SPEED} && $info->{'Current Speed'}) {
+            if ($info->{'Current Speed'} =~ /^\s*(\d{3,4})\s*Mhz/i) {
+                $cpu->{SPEED} = $1;
+            } elsif ($info->{'Current Speed'} =~ /^\s*(\d+)\s*Ghz/i) {
+                $cpu->{SPEED} = $1 * 1000;
             }
         }
 
diff --git a/t/tools/generic.t b/t/tools/generic.t
index 42f4c6d..16f053e 100755
--- a/t/tools/generic.t
+++ b/t/tools/generic.t
@@ -5894,7 +5894,7 @@ my %cpu_tests = (
         {
             ID             => '42 0F 10 00 FF FB 8B 07',
             NAME           => undef,
-            SPEED          => '30000',
+            SPEED          => '2300',
             THREAD         => undef,
             SERIAL         => undef,
             MANUFACTURER   => 'AuthenticAMD',


================================================================
  Commit: 2fb62fbbb3ef73f3593b8bc7b8d797b890dc7014
      https://github.com/fusinv/fusioninventory-agent/commit/2fb62fbbb3ef73f3593b8bc7b8d797b890dc7014
  Author: Guillaume Rousse <guillomovitch at gmail.com>
  Date:   2012-05-02 (Wed, 02 May 2012)

  Changed paths:
    M lib/FusionInventory/Agent/Tools/Generic.pm
    M lib/FusionInventory/Agent/Tools/Screen.pm
    M t/tools/generic.t

  Log Message:
  -----------
  Merge remote-tracking branch 'forge/2.2.x' into 2.2.x


diff --git a/lib/FusionInventory/Agent/Tools/Generic.pm b/lib/FusionInventory/Agent/Tools/Generic.pm
index 25ac7ba..825b70a 100644
--- a/lib/FusionInventory/Agent/Tools/Generic.pm
+++ b/lib/FusionInventory/Agent/Tools/Generic.pm
@@ -99,13 +99,20 @@ sub getCpusFromDmidecode {
                 $cpu->{SPEED} = $1 * 1000;
             }
         }
-        if (!$cpu->{SPEED}) {
-            if ($info->{'Max Speed'}) {
-                if ($info->{'Max Speed'} =~ /^\s*(\d+)\s*Mhz/i) {
-                    $cpu->{SPEED} = $1;
-                } elsif ($info->{'Max Speed'} =~ /^\s*(\d+)\s*Ghz/i) {
-                    $cpu->{SPEED} = $1 * 1000;
-                }
+        if (!$cpu->{SPEED} && $info->{'Max Speed'}) {
+            # We only look for 3 digit Mhz frequency to avoid abvious bad
+            # value like 30000 (#633)
+            if ($info->{'Max Speed'} =~ /^\s*(\d{3,4})\s*Mhz/i) {
+                $cpu->{SPEED} = $1;
+            } elsif ($info->{'Max Speed'} =~ /^\s*(\d+)\s*Ghz/i) {
+                $cpu->{SPEED} = $1 * 1000;
+            }
+        }
+        if (!$cpu->{SPEED} && $info->{'Current Speed'}) {
+            if ($info->{'Current Speed'} =~ /^\s*(\d{3,4})\s*Mhz/i) {
+                $cpu->{SPEED} = $1;
+            } elsif ($info->{'Current Speed'} =~ /^\s*(\d+)\s*Ghz/i) {
+                $cpu->{SPEED} = $1 * 1000;
             }
         }
 
diff --git a/lib/FusionInventory/Agent/Tools/Screen.pm b/lib/FusionInventory/Agent/Tools/Screen.pm
index 5cb71db..cd479fb 100644
--- a/lib/FusionInventory/Agent/Tools/Screen.pm
+++ b/lib/FusionInventory/Agent/Tools/Screen.pm
@@ -487,7 +487,9 @@ sub getManufacturerFromCode {
         "IFS" => "InFocus",
         "BOE" => "BOE Display Technology",
         "IQT" => "Hyundai",
-        "HSD" => "Hannspree Inc"
+        "HSD" => "Hannspree Inc",
+        "PRT" => "Princeton",
+        "PDC" => "Polaroid"
 
 
     };
diff --git a/t/tools/generic.t b/t/tools/generic.t
index 42f4c6d..16f053e 100755
--- a/t/tools/generic.t
+++ b/t/tools/generic.t
@@ -5894,7 +5894,7 @@ my %cpu_tests = (
         {
             ID             => '42 0F 10 00 FF FB 8B 07',
             NAME           => undef,
-            SPEED          => '30000',
+            SPEED          => '2300',
             THREAD         => undef,
             SERIAL         => undef,
             MANUFACTURER   => 'AuthenticAMD',


================================================================
  Commit: c6eb0313fa092e9fec3d5bdb5a08666ef4aa8fa9
      https://github.com/fusinv/fusioninventory-agent/commit/c6eb0313fa092e9fec3d5bdb5a08666ef4aa8fa9
  Author: Guillaume Rousse <guillomovitch at gmail.com>
  Date:   2012-05-02 (Wed, 02 May 2012)

  Changed paths:
    M lib/FusionInventory/Agent/Task/Inventory/Input/Linux/Storages/Lsilogic.pm

  Log Message:
  -----------
  isolate parsing into a function


diff --git a/lib/FusionInventory/Agent/Task/Inventory/Input/Linux/Storages/Lsilogic.pm b/lib/FusionInventory/Agent/Task/Inventory/Input/Linux/Storages/Lsilogic.pm
index c8af20d..b57b28d 100644
--- a/lib/FusionInventory/Agent/Task/Inventory/Input/Linux/Storages/Lsilogic.pm
+++ b/lib/FusionInventory/Agent/Task/Inventory/Input/Linux/Storages/Lsilogic.pm
@@ -26,37 +26,48 @@ sub doInventory {
 
     my @devices = getDevicesFromUdev(logger => $logger);
 
-    foreach my $hd (@devices) {
-        my $handle = getFileHandle(
-            logger => $logger,
-            command => "mpt-status -n -i $hd->{SCSI_UNID}"
-        );
-        next unless $handle;
-        while (my $line = <$handle>) {
-            next unless $line =~ /phys_id:(\d+).*product_id:\s*(\S*)\s+revision:(\S+).*size\(GB\):(\d+)/;
-            my $id = $1;
-
-            my $storage = {
-                NAME => $hd->{NAME},
-                DESCRIPTION => 'SATA',
-                TYPE        => 'disk',
-                MODEL       => $2,
-                FIRMWARE    => $3,
-                SIZE        => $4 * 1024
-            };
-
-            $storage->{SERIALNUMBER} = getSerialnumber(
-                device => "/dev/sg$id"
+    foreach my $device (@devices) {
+        foreach my $disk (_getDiskFromMptStatus(
+            name    => $device->{NAME},
+            logger  => $logger,
+            command => "mpt-status -n -i $device->{SCSI_UNID}"
+        )) {
+            $disk->{SERIALNUMBER} = getSerialnumber(
+                device => "/dev/sg$disk->{id}"
             );
-            $storage->{MANUFACTURER} = getCanonicalManufacturer(
-                $storage->{MODEL}
-            );
-
-            $inventory->addEntry(section => 'STORAGES', entry => $storage);
+            delete $disk->{id};
+            $inventory->addEntry(section => 'STORAGES', entry => $disk);
         }
-        close $handle;
     }
 
 }
 
+sub _getDiskFromMptStatus {
+    my (%params) = @_;
+
+    my $handle = getFileHandle(%params);
+    next unless $handle;
+
+    my @disks;
+    while (my $line = <$handle>) {
+        next unless $line =~ /phys_id:(\d+).*product_id:\s*(\S*)\s+revision:(\S+).*size\(GB\):(\d+)/;
+
+        my $disk = {
+            NAME         => $params{name},
+            DESCRIPTION  => 'SATA',
+            TYPE         => 'disk',
+            id           => $1,
+            MODEL        => $2,
+            MANUFACTURER => getCanonicalManufacturer($2),
+            FIRMWARE     => $3,
+            SIZE         => $4 * 1024
+        };
+
+        push @disks, $disk;
+    }
+    close $handle;
+
+    return @disks;
+}
+
 1;


================================================================
  Commit: 606558078b7de5dcff50add5582775531295cd7e
      https://github.com/fusinv/fusioninventory-agent/commit/606558078b7de5dcff50add5582775531295cd7e
  Author: Guillaume Rousse <guillomovitch at gmail.com>
  Date:   2012-05-02 (Wed, 02 May 2012)

  Changed paths:
    M lib/FusionInventory/Agent/Task/Inventory/Input/Linux/Storages/Lsilogic.pm

  Log Message:
  -----------
  more understandable regexp


diff --git a/lib/FusionInventory/Agent/Task/Inventory/Input/Linux/Storages/Lsilogic.pm b/lib/FusionInventory/Agent/Task/Inventory/Input/Linux/Storages/Lsilogic.pm
index b57b28d..ce0b463 100644
--- a/lib/FusionInventory/Agent/Task/Inventory/Input/Linux/Storages/Lsilogic.pm
+++ b/lib/FusionInventory/Agent/Task/Inventory/Input/Linux/Storages/Lsilogic.pm
@@ -50,7 +50,14 @@ sub _getDiskFromMptStatus {
 
     my @disks;
     while (my $line = <$handle>) {
-        next unless $line =~ /phys_id:(\d+).*product_id:\s*(\S*)\s+revision:(\S+).*size\(GB\):(\d+)/;
+        next unless $line =~ /
+            phys_id:(\d+) \s
+            scsi_id:\d+ \s
+            vendor:\S+ \s+
+            product_id:(\S+) \s+
+            revision:(\S+) \s+
+            size\(GB\):(\d+)
+        /x;
 
         my $disk = {
             NAME         => $params{name},


================================================================
  Commit: 9ed21970f05e17312158b370f534cc6598b82545
      https://github.com/fusinv/fusioninventory-agent/commit/9ed21970f05e17312158b370f534cc6598b82545
  Author: Guillaume Rousse <guillomovitch at gmail.com>
  Date:   2012-05-02 (Wed, 02 May 2012)

  Changed paths:
    M lib/FusionInventory/Agent/Task/Inventory/Input/Linux/Storages/Lsilogic.pm

  Log Message:
  -----------
  fix product_id parsing


diff --git a/lib/FusionInventory/Agent/Task/Inventory/Input/Linux/Storages/Lsilogic.pm b/lib/FusionInventory/Agent/Task/Inventory/Input/Linux/Storages/Lsilogic.pm
index ce0b463..4404d02 100644
--- a/lib/FusionInventory/Agent/Task/Inventory/Input/Linux/Storages/Lsilogic.pm
+++ b/lib/FusionInventory/Agent/Task/Inventory/Input/Linux/Storages/Lsilogic.pm
@@ -54,7 +54,7 @@ sub _getDiskFromMptStatus {
             phys_id:(\d+) \s
             scsi_id:\d+ \s
             vendor:\S+ \s+
-            product_id:(\S+) \s+
+            product_id:(\S.+\S) \s+
             revision:(\S+) \s+
             size\(GB\):(\d+)
         /x;


================================================================
  Commit: 1eabd29364a18a5c0ef324ac95f6d35be38f93ad
      https://github.com/fusinv/fusioninventory-agent/commit/1eabd29364a18a5c0ef324ac95f6d35be38f93ad
  Author: Guillaume Rousse <guillomovitch at gmail.com>
  Date:   2012-05-02 (Wed, 02 May 2012)

  Changed paths:
    A resources/linux/mpt-status/sample1
    A resources/linux/mpt-status/sample2
    A t/inventory/linux/storages/lsilogic.t

  Log Message:
  -----------
  initial import


diff --git a/resources/linux/mpt-status/sample1 b/resources/linux/mpt-status/sample1
new file mode 100644
index 0000000..bd2e0b2
--- /dev/null
+++ b/resources/linux/mpt-status/sample1
@@ -0,0 +1,5 @@
+ioc:0 vol_id:0 type:IM raidlevel:RAID-1 num_disks:2 size(GB):148 state: OPTIMAL flags: ENABLED
+ioc:0 phys_id:1 scsi_id:2 vendor:ATA      product_id:ST3160815AS      revision:D    size(GB):149 state: ONLINE flags: NONE sync_state: 100 ASC/ASCQ:0xff/0xff SMART ASC/ASCQ:0xff/0xff
+ioc:0 phys_id:0 scsi_id:1 vendor:ATA      product_id:ST3160815AS      revision:D    size(GB):149 state: ONLINE flags: NONE sync_state: 100 ASC/ASCQ:0xff/0xff SMART ASC/ASCQ:0xff/0xff
+scsi_id:1 100%
+scsi_id:0 100%
diff --git a/resources/linux/mpt-status/sample2 b/resources/linux/mpt-status/sample2
new file mode 100644
index 0000000..4e12a3d
--- /dev/null
+++ b/resources/linux/mpt-status/sample2
@@ -0,0 +1,13 @@
+ioc:0 vol_id:1 type:IME raidlevel:RAID-1E num_disks:6 size(GB):407 state: OPTIMAL flags: ENABLED
+ioc:0 phys_id:5 scsi_id:7 vendor:IBM-ESXS product_id:CBRCA146C3ETS0 N revision:C610 size(GB):136 state: ONLINE flags: NONE sync_state: 100 ASC/ASCQ:0xff/0xff SMART ASC/ASCQ:0xff/0xff
+ioc:0 phys_id:4 scsi_id:2 vendor:IBM-ESXS product_id:CBRCA146C3ETS0 N revision:C610 size(GB):136 state: ONLINE flags: NONE sync_state: 100 ASC/ASCQ:0xff/0xff SMART ASC/ASCQ:0xff/0xff
+ioc:0 phys_id:3 scsi_id:3 vendor:IBM-ESXS product_id:ST9146803SS      revision:B53C size(GB):136 state: ONLINE flags: NONE sync_state: 100 ASC/ASCQ:0xff/0xff SMART ASC/ASCQ:0xff/0xff
+ioc:0 phys_id:2 scsi_id:4 vendor:IBM-ESXS product_id:CBRCA146C3ETS0 N revision:C610 size(GB):136 state: ONLINE flags: NONE sync_state: 100 ASC/ASCQ:0xff/0xff SMART ASC/ASCQ:0xff/0xff
+ioc:0 phys_id:1 scsi_id:5 vendor:IBM-ESXS product_id:CBRCA146C3ETS0 N revision:C610 size(GB):136 state: ONLINE flags: NONE sync_state: 100 ASC/ASCQ:0xff/0xff SMART ASC/ASCQ:0xff/0xff
+ioc:0 phys_id:0 scsi_id:6 vendor:IBM-ESXS product_id:CBRCA146C3ETS0 N revision:C610 size(GB):136 state: ONLINE flags: NONE sync_state: 100 ASC/ASCQ:0xff/0xff SMART ASC/ASCQ:0xff/0xff
+scsi_id:5 100%
+scsi_id:4 100%
+scsi_id:3 100%
+scsi_id:2 100%
+scsi_id:1 100%
+scsi_id:0 100%
diff --git a/t/inventory/linux/storages/lsilogic.t b/t/inventory/linux/storages/lsilogic.t
new file mode 100755
index 0000000..2cf3531
--- /dev/null
+++ b/t/inventory/linux/storages/lsilogic.t
@@ -0,0 +1,110 @@
+#!/usr/bin/perl
+
+use strict;
+use warnings;
+use FusionInventory::Agent::Task::Inventory::Input::Linux::Storages::Lsilogic;
+use Test::More;
+
+plan tests => 2;
+
+my %tests = (
+    sample1 => {
+        name       => 'foo',
+        disks   => [
+             {
+                SIZE         => '152576',
+                NAME         => 'foo',
+                FIRMWARE     => 'D',
+                MANUFACTURER => 'Seagate',
+                MODEL        => 'ST3160815AS',
+                DESCRIPTION  => 'SATA',
+                id           => '1',
+                TYPE         => 'disk'
+            },
+            {
+                SIZE         => '152576',
+                NAME         => 'foo',
+                FIRMWARE     => 'D',
+                MANUFACTURER => 'Seagate',
+                MODEL        => 'ST3160815AS',
+                DESCRIPTION  => 'SATA',
+                id           => '0',
+                TYPE         => 'disk'
+          }
+        ]
+    },
+    sample2 => {
+        name       => 'foo',
+        disks      => [
+            {
+                SIZE         => '139264',
+                NAME         => 'foo',
+                FIRMWARE     => 'C610',
+                MANUFACTURER => 'CBRCA146C3ETS0 N',
+                MODEL        => 'CBRCA146C3ETS0 N',
+                DESCRIPTION  => 'SATA',
+                id           => '5',
+                TYPE         => 'disk'
+            },
+            {
+                SIZE         => '139264',
+                NAME         => 'foo',
+                FIRMWARE     => 'C610',
+                MANUFACTURER => 'CBRCA146C3ETS0 N',
+                MODEL        => 'CBRCA146C3ETS0 N',
+                DESCRIPTION  => 'SATA',
+                id           => '4',
+                TYPE         => 'disk'
+            },
+            {
+                SIZE         => '139264',
+                NAME         => 'foo',
+                FIRMWARE     => 'B53C',
+                MANUFACTURER => 'Seagate',
+                MODEL        => 'ST9146803SS',
+                DESCRIPTION  => 'SATA',
+                id           => '3',
+                TYPE         => 'disk'
+            },
+            {
+                SIZE         => '139264',
+                NAME         => 'foo',
+                FIRMWARE     => 'C610',
+                MANUFACTURER => 'CBRCA146C3ETS0 N',
+                MODEL        => 'CBRCA146C3ETS0 N',
+                DESCRIPTION  => 'SATA',
+                id           => '2',
+                TYPE         => 'disk'
+            },
+            {
+                SIZE         => '139264',
+                NAME         => 'foo',
+                FIRMWARE     => 'C610',
+                MANUFACTURER => 'CBRCA146C3ETS0 N',
+                MODEL        => 'CBRCA146C3ETS0 N',
+                DESCRIPTION  => 'SATA',
+                id           => '1',
+                TYPE         => 'disk'
+            },
+            {
+                SIZE         => '139264',
+                NAME         => 'foo',
+                FIRMWARE     => 'C610',
+                MANUFACTURER => 'CBRCA146C3ETS0 N',
+                MODEL        => 'CBRCA146C3ETS0 N',
+                DESCRIPTION  => 'SATA',
+                id           => '0',
+                TYPE         => 'disk'
+            }
+        ]
+    }
+);
+
+foreach my $test (keys %tests) {
+    my $file = "resources/linux/mpt-status/$test";
+    my @disks = FusionInventory::Agent::Task::Inventory::Input::Linux::Storages::Lsilogic::_getDiskFromMptStatus(
+        file       => $file,
+        name       => $tests{$test}->{name},
+    );
+    is_deeply(\@disks, $tests{$test}->{disks}, $test);
+}


================================================================
  Commit: 82bf95dd7d0002c0a0e5764e890744cd12025a50
      https://github.com/fusinv/fusioninventory-agent/commit/82bf95dd7d0002c0a0e5764e890744cd12025a50
  Author: Guillaume Rousse <guillomovitch at gmail.com>
  Date:   2012-05-02 (Wed, 02 May 2012)

  Changed paths:
    A resources/linux/proc/scsi/linux3
    A resources/linux/proc/scsi/linux4

  Log Message:
  -----------
  initial import


diff --git a/resources/linux/proc/scsi/linux3 b/resources/linux/proc/scsi/linux3
new file mode 100644
index 0000000..04587af
--- /dev/null
+++ b/resources/linux/proc/scsi/linux3
@@ -0,0 +1,25 @@
+Attached devices:
+Host: scsi0 Channel: 00 Id: 00 Lun: 00
+  Vendor: MATSHITA Model: UJDA782 DVD/CDRW Rev: VA13
+  Type:   CD-ROM                           ANSI  SCSI revision: 05
+Host: scsi4 Channel: 00 Id: 00 Lun: 00
+  Vendor: IBM-ESXS Model: CBRCA146C3ETS0 N Rev: C610
+  Type:   Direct-Access                    ANSI  SCSI revision: 06
+Host: scsi4 Channel: 00 Id: 01 Lun: 00
+  Vendor: IBM-ESXS Model: CBRCA146C3ETS0 N Rev: C610
+  Type:   Direct-Access                    ANSI  SCSI revision: 06
+Host: scsi4 Channel: 00 Id: 02 Lun: 00
+  Vendor: IBM-ESXS Model: ST9146803SS      Rev: B53C
+  Type:   Direct-Access                    ANSI  SCSI revision: 05
+Host: scsi4 Channel: 00 Id: 03 Lun: 00
+  Vendor: IBM-ESXS Model: CBRCA146C3ETS0 N Rev: C610
+  Type:   Direct-Access                    ANSI  SCSI revision: 06
+Host: scsi4 Channel: 00 Id: 04 Lun: 00
+  Vendor: IBM-ESXS Model: CBRCA146C3ETS0 N Rev: C610
+  Type:   Direct-Access                    ANSI  SCSI revision: 06
+Host: scsi4 Channel: 00 Id: 05 Lun: 00
+  Vendor: IBM-ESXS Model: CBRCA146C3ETS0 N Rev: C610
+  Type:   Direct-Access                    ANSI  SCSI revision: 06
+Host: scsi4 Channel: 01 Id: 01 Lun: 00
+  Vendor: LSILOGIC Model: Logical Volume   Rev: 3000
+  Type:   Direct-Access                    ANSI  SCSI revision: 02
diff --git a/resources/linux/proc/scsi/linux4 b/resources/linux/proc/scsi/linux4
new file mode 100644
index 0000000..f63873e
--- /dev/null
+++ b/resources/linux/proc/scsi/linux4
@@ -0,0 +1,28 @@
+Attached devices:
+Host: scsi0 Channel: 00 Id: 00 Lun: 00
+  Vendor: ServeRA  Model: Drive 1          Rev: V1.0
+  Type:   Direct-Access                    ANSI SCSI revision: 02
+Host: scsi0 Channel: 00 Id: 01 Lun: 00
+  Vendor: ServeRA  Model: Drive 2          Rev: V1.0
+  Type:   Direct-Access                    ANSI SCSI revision: 02
+Host: scsi0 Channel: 01 Id: 00 Lun: 00
+  Vendor: IBM-ESXS Model: ST3300655SS      Rev: BA23
+  Type:   Direct-Access                    ANSI SCSI revision: 05
+Host: scsi0 Channel: 01 Id: 01 Lun: 00
+  Vendor: IBM-ESXS Model: ST3300655SS      Rev: BA23
+  Type:   Direct-Access                    ANSI SCSI revision: 05
+Host: scsi0 Channel: 01 Id: 02 Lun: 00
+  Vendor: IBM-ESXS Model: ST3300655SS      Rev: BA23
+  Type:   Direct-Access                    ANSI SCSI revision: 05
+Host: scsi0 Channel: 01 Id: 03 Lun: 00
+  Vendor: IBM-ESXS Model: ST3300655SS      Rev: BA23
+  Type:   Direct-Access                    ANSI SCSI revision: 05
+Host: scsi0 Channel: 01 Id: 04 Lun: 00
+  Vendor: IBM-ESXS Model: ST3300655SS      Rev: BA23
+  Type:   Direct-Access                    ANSI SCSI revision: 05
+Host: scsi0 Channel: 01 Id: 05 Lun: 00
+  Vendor: IBM-ESXS Model: ST3300655SS      Rev: BA23
+  Type:   Direct-Access                    ANSI SCSI revision: 05
+Host: scsi0 Channel: 03 Id: 00 Lun: 00
+  Vendor: IBM-ESXS Model: VSC7160          Rev: 1.06
+  Type:   Enclosure                        ANSI SCSI revision: 03


================================================================
  Commit: 9e328f37e482ed211ac5ccfbb79fd2283d9c4317
      https://github.com/fusinv/fusioninventory-agent/commit/9e328f37e482ed211ac5ccfbb79fd2283d9c4317
  Author: Guillaume Rousse <guillomovitch at gmail.com>
  Date:   2012-05-02 (Wed, 02 May 2012)

  Changed paths:
    M t/inventory/linux/storages/adaptec.t

  Log Message:
  -----------
  new samples


diff --git a/t/inventory/linux/storages/adaptec.t b/t/inventory/linux/storages/adaptec.t
index 0ce27a0..dca9809 100644
--- a/t/inventory/linux/storages/adaptec.t
+++ b/t/inventory/linux/storages/adaptec.t
@@ -2,10 +2,9 @@
 
 use strict;
 use warnings;
-use FusionInventory::Agent::Task::Inventory::Input::Linux::Storages::Adaptec;
-use Test::More;
 
-plan tests => 2;
+use Test::More;
+use FusionInventory::Agent::Task::Inventory::Input::Linux::Storages::Adaptec;
 
 my %tests = (
     linux1 => {
@@ -46,9 +45,113 @@ my %tests = (
                 DEVICE       => '/dev/sg2'
             }
         ]
+    },
+    linux3 => {
+        controller => 'scsi0',
+        name       => 'foo',
+        disks      => [
+            {
+                NAME         => 'foo',
+                DESCRIPTION  => 'SATA',
+                TYPE         => 'disk',
+                MODEL        => 'UJDA782',
+                MANUFACTURER => 'UJDA782',
+                FIRMWARE     => 'VA13',
+                DEVICE       => '/dev/sg0'
+            },
+        ]
+    },
+    linux4 => {
+        controller => 'scsi0',
+        name       => 'foo',
+        disks      => [
+            {
+                NAME         => 'foo',
+                FIRMWARE     => 'V1.0',
+                MANUFACTURER => 'Drive',
+                MODEL        => 'Drive',
+                DESCRIPTION  => 'SATA',
+                TYPE         => 'disk',
+                DEVICE       => '/dev/sg0'
+            },
+            {
+                NAME         => 'foo',
+                FIRMWARE     => 'V1.0',
+                MANUFACTURER => 'Drive',
+                MODEL        => 'Drive',
+                DESCRIPTION  => 'SATA',
+                TYPE         => 'disk',
+                DEVICE       => '/dev/sg1'
+            },
+            {
+                NAME         => 'foo',
+                FIRMWARE     => 'BA23',
+                MANUFACTURER => 'Seagate',
+                MODEL        => 'ST3300655SS',
+                DESCRIPTION  => 'SATA',
+                TYPE         => 'disk',
+                DEVICE       => '/dev/sg2'
+                },
+                {
+                NAME         => 'foo',
+                FIRMWARE     => 'BA23',
+                MANUFACTURER => 'Seagate',
+                MODEL        => 'ST3300655SS',
+                DESCRIPTION  => 'SATA',
+                TYPE         => 'disk',
+                DEVICE       => '/dev/sg3'
+            },
+            {
+                NAME         => 'foo',
+                FIRMWARE     => 'BA23',
+                MANUFACTURER => 'Seagate',
+                MODEL        => 'ST3300655SS',
+                DESCRIPTION  => 'SATA',
+                TYPE         => 'disk',
+                DEVICE       => '/dev/sg4'
+            },
+            {
+                NAME         => 'foo',
+                FIRMWARE     => 'BA23',
+                MANUFACTURER => 'Seagate',
+                MODEL        => 'ST3300655SS',
+                DESCRIPTION  => 'SATA',
+                TYPE         => 'disk',
+                DEVICE       => '/dev/sg5'
+            },
+            {
+                NAME         => 'foo',
+                FIRMWARE     => 'BA23',
+                MANUFACTURER => 'Seagate',
+                MODEL        => 'ST3300655SS',
+                DESCRIPTION  => 'SATA',
+                TYPE         => 'disk',
+                DEVICE       => '/dev/sg6'
+            },
+            {
+                NAME         => 'foo',
+                FIRMWARE     => 'BA23',
+                MANUFACTURER => 'Seagate',
+                MODEL        => 'ST3300655SS',
+                DESCRIPTION  => 'SATA',
+                TYPE         => 'disk',
+                DEVICE       => '/dev/sg7'
+            },
+            {
+                NAME         => 'foo',
+                FIRMWARE     => '1.06',
+                MANUFACTURER => 'VSC7160',
+                MODEL        => 'VSC7160',
+                DESCRIPTION  => 'SATA',
+                TYPE         => 'disk',
+                DEVICE       => '/dev/sg8'
+            }
+        ]
     }
 );
 
+plan tests => scalar keys %tests;
+
 foreach my $test (keys %tests) {
     my $file = "resources/linux/proc/scsi/$test";
     my @disks = FusionInventory::Agent::Task::Inventory::Input::Linux::Storages::Adaptec::_getDisksFromProc(


================================================================
  Commit: a6e6a80040a27c307e3f4e0aba91ecb82a23f4d7
      https://github.com/fusinv/fusioninventory-agent/commit/a6e6a80040a27c307e3f4e0aba91ecb82a23f4d7
  Author: Guillaume Rousse <guillomovitch at gmail.com>
  Date:   2012-05-02 (Wed, 02 May 2012)

  Changed paths:
    M t/inventory/linux/storages/lsilogic.t

  Log Message:
  -----------
  compute tests count


diff --git a/t/inventory/linux/storages/lsilogic.t b/t/inventory/linux/storages/lsilogic.t
index 2cf3531..70a9dea 100755
--- a/t/inventory/linux/storages/lsilogic.t
+++ b/t/inventory/linux/storages/lsilogic.t
@@ -5,8 +5,6 @@ use warnings;
 use FusionInventory::Agent::Task::Inventory::Input::Linux::Storages::Lsilogic;
 use Test::More;
 
-plan tests => 2;
-
 my %tests = (
     sample1 => {
         name       => 'foo',
@@ -100,6 +98,8 @@ my %tests = (
     }
 );
 
+plan tests => scalar keys %tests;
+
 foreach my $test (keys %tests) {
     my $file = "resources/linux/mpt-status/$test";
     my @disks = FusionInventory::Agent::Task::Inventory::Input::Linux::Storages::Lsilogic::_getDiskFromMptStatus(


================================================================
  Commit: 779eea8dbbacbc9682058d338745dfdfb6f727d8
      https://github.com/fusinv/fusioninventory-agent/commit/779eea8dbbacbc9682058d338745dfdfb6f727d8
  Author: Guillaume Rousse <guillomovitch at gmail.com>
  Date:   2012-05-02 (Wed, 02 May 2012)

  Changed paths:
    M lib/FusionInventory/Agent/Task/Inventory/Input/Linux/Storages/Adaptec.pm
    M lib/FusionInventory/Agent/Task/Inventory/Input/Linux/Storages/Lsilogic.pm

  Log Message:
  -----------
  useless comments


diff --git a/lib/FusionInventory/Agent/Task/Inventory/Input/Linux/Storages/Adaptec.pm b/lib/FusionInventory/Agent/Task/Inventory/Input/Linux/Storages/Adaptec.pm
index 9ddf21a..ee6a135 100644
--- a/lib/FusionInventory/Agent/Task/Inventory/Input/Linux/Storages/Adaptec.pm
+++ b/lib/FusionInventory/Agent/Task/Inventory/Input/Linux/Storages/Adaptec.pm
@@ -8,12 +8,6 @@ use English qw(-no_match_vars);
 use FusionInventory::Agent::Tools;
 use FusionInventory::Agent::Tools::Linux;
 
-# Tested on 2.6.* kernels
-#
-# Cards tested :
-#
-# Adaptec AAC-RAID
-
 sub isEnabled {
     return -r '/proc/scsi/scsi';
 }
diff --git a/lib/FusionInventory/Agent/Task/Inventory/Input/Linux/Storages/Lsilogic.pm b/lib/FusionInventory/Agent/Task/Inventory/Input/Linux/Storages/Lsilogic.pm
index 4404d02..3159d3f 100644
--- a/lib/FusionInventory/Agent/Task/Inventory/Input/Linux/Storages/Lsilogic.pm
+++ b/lib/FusionInventory/Agent/Task/Inventory/Input/Linux/Storages/Lsilogic.pm
@@ -6,14 +6,6 @@ use warnings;
 use FusionInventory::Agent::Tools;
 use FusionInventory::Agent::Tools::Linux;
 
-# Tested on 2.6.* kernels
-#
-# Cards tested :
-#
-# LSI Logic / Symbios Logic SAS1064E PCI-Express Fusion-MPT SAS
-#
-# mpt-status version : 1.2.0
-
 sub isEnabled {
     return canRun('mpt-status');
 }


================================================================
  Commit: 2a20f8caee3af4c37859a2d47765bef00320cc42
      https://github.com/fusinv/fusioninventory-agent/commit/2a20f8caee3af4c37859a2d47765bef00320cc42
  Author: Guillaume Rousse <guillomovitch at gmail.com>
  Date:   2012-05-03 (Thu, 03 May 2012)

  Changed paths:
    M lib/FusionInventory/Agent/Task/Inventory/Input/Linux/Storages/Adaptec.pm
    M lib/FusionInventory/Agent/Task/Inventory/Input/Linux/Storages/Lsilogic.pm
    M t/inventory/linux/storages/adaptec.t
    M t/inventory/linux/storages/lsilogic.t

  Log Message:
  -----------
  fix serial number computation


diff --git a/lib/FusionInventory/Agent/Task/Inventory/Input/Linux/Storages/Adaptec.pm b/lib/FusionInventory/Agent/Task/Inventory/Input/Linux/Storages/Adaptec.pm
index ee6a135..ab8198a 100644
--- a/lib/FusionInventory/Agent/Task/Inventory/Input/Linux/Storages/Adaptec.pm
+++ b/lib/FusionInventory/Agent/Task/Inventory/Input/Linux/Storages/Adaptec.pm
@@ -31,7 +31,8 @@ sub doInventory {
                 name       => $device->{NAME},
                 logger     => $logger
             )) {
-            $disk->{SERIALNUMBER} = getSerialnumber($disk->{device});
+            $disk->{SERIALNUMBER} = getSerialnumber(device => $disk->{device});
+            delete $disk->{device};
             $inventory->addEntry(section => 'STORAGES', entry => $disk);
         }
     }
@@ -79,7 +80,7 @@ sub _getDisksFromProc {
             $disk->{MANUFACTURER} = getCanonicalManufacturer(
                 $disk->{MODEL}
             );
-            $disk->{DEVICE} = "/dev/sg$count";
+            $disk->{device} = "/dev/sg$count";
 
             push @disks, $disk;
         }
diff --git a/lib/FusionInventory/Agent/Task/Inventory/Input/Linux/Storages/Lsilogic.pm b/lib/FusionInventory/Agent/Task/Inventory/Input/Linux/Storages/Lsilogic.pm
index 3159d3f..73b4c49 100644
--- a/lib/FusionInventory/Agent/Task/Inventory/Input/Linux/Storages/Lsilogic.pm
+++ b/lib/FusionInventory/Agent/Task/Inventory/Input/Linux/Storages/Lsilogic.pm
@@ -24,10 +24,8 @@ sub doInventory {
             logger  => $logger,
             command => "mpt-status -n -i $device->{SCSI_UNID}"
         )) {
-            $disk->{SERIALNUMBER} = getSerialnumber(
-                device => "/dev/sg$disk->{id}"
-            );
-            delete $disk->{id};
+            $disk->{SERIALNUMBER} = getSerialnumber(device => $disk->{device});
+            delete $disk->{device};
             $inventory->addEntry(section => 'STORAGES', entry => $disk);
         }
     }
@@ -55,7 +53,7 @@ sub _getDiskFromMptStatus {
             NAME         => $params{name},
             DESCRIPTION  => 'SATA',
             TYPE         => 'disk',
-            id           => $1,
+            device       => "/dev/sg$1",
             MODEL        => $2,
             MANUFACTURER => getCanonicalManufacturer($2),
             FIRMWARE     => $3,
diff --git a/t/inventory/linux/storages/adaptec.t b/t/inventory/linux/storages/adaptec.t
index dca9809..40be5bd 100644
--- a/t/inventory/linux/storages/adaptec.t
+++ b/t/inventory/linux/storages/adaptec.t
@@ -18,7 +18,7 @@ my %tests = (
                 MODEL        => 'SAMSUNG',
                 MANUFACTURER => 'Samsung',
                 FIRMWARE     => 'VBM2',
-                DEVICE       => '/dev/sg0'
+                device       => '/dev/sg0'
             }
         ]
     },
@@ -33,7 +33,7 @@ my %tests = (
                 MODEL        => 'HUS151436VL3800',
                 MANUFACTURER => 'Hitachi',
                 FIRMWARE     => 'S3C0',
-                DEVICE       => '/dev/sg1'
+                device       => '/dev/sg1'
             },
             {
                 NAME         => 'foo',
@@ -42,7 +42,7 @@ my %tests = (
                 MODEL        => 'HUS151436VL3800',
                 MANUFACTURER => 'Hitachi',
                 FIRMWARE     => 'S3C0',
-                DEVICE       => '/dev/sg2'
+                device       => '/dev/sg2'
             }
         ]
     },
@@ -57,7 +57,7 @@ my %tests = (
                 MODEL        => 'UJDA782',
                 MANUFACTURER => 'UJDA782',
                 FIRMWARE     => 'VA13',
-                DEVICE       => '/dev/sg0'
+                device       => '/dev/sg0'
             },
         ]
     },
@@ -72,7 +72,7 @@ my %tests = (
                 MODEL        => 'Drive',
                 DESCRIPTION  => 'SATA',
                 TYPE         => 'disk',
-                DEVICE       => '/dev/sg0'
+                device       => '/dev/sg0'
             },
             {
                 NAME         => 'foo',
@@ -81,7 +81,7 @@ my %tests = (
                 MODEL        => 'Drive',
                 DESCRIPTION  => 'SATA',
                 TYPE         => 'disk',
-                DEVICE       => '/dev/sg1'
+                device       => '/dev/sg1'
             },
             {
                 NAME         => 'foo',
@@ -90,7 +90,7 @@ my %tests = (
                 MODEL        => 'ST3300655SS',
                 DESCRIPTION  => 'SATA',
                 TYPE         => 'disk',
-                DEVICE       => '/dev/sg2'
+                device       => '/dev/sg2'
                 },
                 {
                 NAME         => 'foo',
@@ -99,7 +99,7 @@ my %tests = (
                 MODEL        => 'ST3300655SS',
                 DESCRIPTION  => 'SATA',
                 TYPE         => 'disk',
-                DEVICE       => '/dev/sg3'
+                device       => '/dev/sg3'
             },
             {
                 NAME         => 'foo',
@@ -108,7 +108,7 @@ my %tests = (
                 MODEL        => 'ST3300655SS',
                 DESCRIPTION  => 'SATA',
                 TYPE         => 'disk',
-                DEVICE       => '/dev/sg4'
+                device       => '/dev/sg4'
             },
             {
                 NAME         => 'foo',
@@ -117,7 +117,7 @@ my %tests = (
                 MODEL        => 'ST3300655SS',
                 DESCRIPTION  => 'SATA',
                 TYPE         => 'disk',
-                DEVICE       => '/dev/sg5'
+                device       => '/dev/sg5'
             },
             {
                 NAME         => 'foo',
@@ -126,7 +126,7 @@ my %tests = (
                 MODEL        => 'ST3300655SS',
                 DESCRIPTION  => 'SATA',
                 TYPE         => 'disk',
-                DEVICE       => '/dev/sg6'
+                device       => '/dev/sg6'
             },
             {
                 NAME         => 'foo',
@@ -135,7 +135,7 @@ my %tests = (
                 MODEL        => 'ST3300655SS',
                 DESCRIPTION  => 'SATA',
                 TYPE         => 'disk',
-                DEVICE       => '/dev/sg7'
+                device       => '/dev/sg7'
             },
             {
                 NAME         => 'foo',
@@ -144,7 +144,7 @@ my %tests = (
                 MODEL        => 'VSC7160',
                 DESCRIPTION  => 'SATA',
                 TYPE         => 'disk',
-                DEVICE       => '/dev/sg8'
+                device       => '/dev/sg8'
             }
         ]
     }
diff --git a/t/inventory/linux/storages/lsilogic.t b/t/inventory/linux/storages/lsilogic.t
index 70a9dea..fefa13a 100755
--- a/t/inventory/linux/storages/lsilogic.t
+++ b/t/inventory/linux/storages/lsilogic.t
@@ -16,7 +16,7 @@ my %tests = (
                 MANUFACTURER => 'Seagate',
                 MODEL        => 'ST3160815AS',
                 DESCRIPTION  => 'SATA',
-                id           => '1',
+                device       => '/dev/sg1',
                 TYPE         => 'disk'
             },
             {
@@ -26,7 +26,7 @@ my %tests = (
                 MANUFACTURER => 'Seagate',
                 MODEL        => 'ST3160815AS',
                 DESCRIPTION  => 'SATA',
-                id           => '0',
+                device       => '/dev/sg0',
                 TYPE         => 'disk'
           }
         ]
@@ -41,7 +41,7 @@ my %tests = (
                 MANUFACTURER => 'CBRCA146C3ETS0 N',
                 MODEL        => 'CBRCA146C3ETS0 N',
                 DESCRIPTION  => 'SATA',
-                id           => '5',
+                device       => '/dev/sg5',
                 TYPE         => 'disk'
             },
             {
@@ -51,7 +51,7 @@ my %tests = (
                 MANUFACTURER => 'CBRCA146C3ETS0 N',
                 MODEL        => 'CBRCA146C3ETS0 N',
                 DESCRIPTION  => 'SATA',
-                id           => '4',
+                device       => '/dev/sg4',
                 TYPE         => 'disk'
             },
             {
@@ -61,7 +61,7 @@ my %tests = (
                 MANUFACTURER => 'Seagate',
                 MODEL        => 'ST9146803SS',
                 DESCRIPTION  => 'SATA',
-                id           => '3',
+                device       => '/dev/sg3',
                 TYPE         => 'disk'
             },
             {
@@ -71,7 +71,7 @@ my %tests = (
                 MANUFACTURER => 'CBRCA146C3ETS0 N',
                 MODEL        => 'CBRCA146C3ETS0 N',
                 DESCRIPTION  => 'SATA',
-                id           => '2',
+                device       => '/dev/sg2',
                 TYPE         => 'disk'
             },
             {
@@ -81,7 +81,7 @@ my %tests = (
                 MANUFACTURER => 'CBRCA146C3ETS0 N',
                 MODEL        => 'CBRCA146C3ETS0 N',
                 DESCRIPTION  => 'SATA',
-                id           => '1',
+                device       => '/dev/sg1',
                 TYPE         => 'disk'
             },
             {
@@ -91,7 +91,7 @@ my %tests = (
                 MANUFACTURER => 'CBRCA146C3ETS0 N',
                 MODEL        => 'CBRCA146C3ETS0 N',
                 DESCRIPTION  => 'SATA',
-                id           => '0',
+                device       => '/dev/sg0',
                 TYPE         => 'disk'
             }
         ]


================================================================
  Commit: 161a58e789308927a54ec6d80617fee2da52c6f3
      https://github.com/fusinv/fusioninventory-agent/commit/161a58e789308927a54ec6d80617fee2da52c6f3
  Author: Guillaume Rousse <guillomovitch at gmail.com>
  Date:   2012-05-03 (Thu, 03 May 2012)

  Changed paths:
    M lib/FusionInventory/Agent/Task/Inventory/Input/Linux/Storages/Adaptec.pm
    M t/inventory/linux/storages/adaptec.t

  Log Message:
  -----------
  fix model parsing


diff --git a/lib/FusionInventory/Agent/Task/Inventory/Input/Linux/Storages/Adaptec.pm b/lib/FusionInventory/Agent/Task/Inventory/Input/Linux/Storages/Adaptec.pm
index ab8198a..b036683 100644
--- a/lib/FusionInventory/Agent/Task/Inventory/Input/Linux/Storages/Adaptec.pm
+++ b/lib/FusionInventory/Agent/Task/Inventory/Input/Linux/Storages/Adaptec.pm
@@ -69,7 +69,7 @@ sub _getDisksFromProc {
             }
         }
 
-        if ($line =~ /Model:\s(\S+).*Rev:\s(\S+)/) {
+        if ($line =~ /Model: \s (\S.+\S) \s+ Rev: \s (\S+)/x) {
             next unless $disk;
             $disk->{MODEL}    = $1;
             $disk->{FIRMWARE} = $2;
diff --git a/t/inventory/linux/storages/adaptec.t b/t/inventory/linux/storages/adaptec.t
index 40be5bd..790c99e 100644
--- a/t/inventory/linux/storages/adaptec.t
+++ b/t/inventory/linux/storages/adaptec.t
@@ -15,7 +15,7 @@ my %tests = (
                 NAME         => 'foo',
                 DESCRIPTION  => 'SATA',
                 TYPE         => 'disk',
-                MODEL        => 'SAMSUNG',
+                MODEL        => 'SAMSUNG SSD PM80',
                 MANUFACTURER => 'Samsung',
                 FIRMWARE     => 'VBM2',
                 device       => '/dev/sg0'
@@ -54,8 +54,8 @@ my %tests = (
                 NAME         => 'foo',
                 DESCRIPTION  => 'SATA',
                 TYPE         => 'disk',
-                MODEL        => 'UJDA782',
-                MANUFACTURER => 'UJDA782',
+                MODEL        => 'UJDA782 DVD/CDRW',
+                MANUFACTURER => 'UJDA782 DVD/CDRW',
                 FIRMWARE     => 'VA13',
                 device       => '/dev/sg0'
             },
@@ -68,8 +68,8 @@ my %tests = (
             {
                 NAME         => 'foo',
                 FIRMWARE     => 'V1.0',
-                MANUFACTURER => 'Drive',
-                MODEL        => 'Drive',
+                MANUFACTURER => 'Drive 1',
+                MODEL        => 'Drive 1',
                 DESCRIPTION  => 'SATA',
                 TYPE         => 'disk',
                 device       => '/dev/sg0'
@@ -77,8 +77,8 @@ my %tests = (
             {
                 NAME         => 'foo',
                 FIRMWARE     => 'V1.0',
-                MANUFACTURER => 'Drive',
-                MODEL        => 'Drive',
+                MANUFACTURER => 'Drive 2',
+                MODEL        => 'Drive 2',
                 DESCRIPTION  => 'SATA',
                 TYPE         => 'disk',
                 device       => '/dev/sg1'


================================================================
  Commit: 409c0577b7242493dcc8ec5860e6a792e01eac2f
      https://github.com/fusinv/fusioninventory-agent/commit/409c0577b7242493dcc8ec5860e6a792e01eac2f
  Author: Guillaume Rousse <guillomovitch at gmail.com>
  Date:   2012-05-03 (Thu, 03 May 2012)

  Changed paths:
    M lib/FusionInventory/Agent/Tools/Linux.pm

  Log Message:
  -----------
  turn getSerialNumber into a generic function

smartctl is able to return far more information than just the serial
number


diff --git a/lib/FusionInventory/Agent/Tools/Linux.pm b/lib/FusionInventory/Agent/Tools/Linux.pm
index 983a329..6e8f5bc 100644
--- a/lib/FusionInventory/Agent/Tools/Linux.pm
+++ b/lib/FusionInventory/Agent/Tools/Linux.pm
@@ -16,7 +16,7 @@ our @EXPORT = qw(
     getDevicesFromHal
     getDevicesFromProc
     getCPUsFromProc
-    getSerialnumber
+    getInfoFromSmartctl
     getInterfacesFromIfconfig
     getInterfacesFromIp
 );
@@ -243,17 +243,39 @@ sub _getValueFromSysProc {
     return $value;
 }
 
-sub getSerialnumber {
+sub getInfoFromSmartctl {
     my (%params) = @_;
 
-    my ($serial) = getFirstMatch(
+    my $handle = getFileHandle(
+        %params,
         command => $params{device} ? "smartctl -i $params{device}" : undef,
-        file    => $params{file},
-        logger  => $params{logger},
-        pattern => qr/^Serial Number:\s+(\S*)/
     );
+    return unless $handle;
+
+    my $info = {
+        TYPE        => 'disk',
+        DESCRIPTION => 'SATA',
+    };
+
+    while (my $line = <$handle>) {
+        if ($line =~ /^Transport protocol: +(\S+)/i) {
+            $info->{DESCRIPTION} = $1;
+            next;
+        }
+
+        if ($line =~ /^Device type: +(\S+)/i) {
+            $info->{TYPE} = $1;
+            next;
+        }
+
+        if ($line =~ /^Serial number: +(\S+)/i) {
+            $info->{SERIALNUMBER} = $1;
+            next;
+        }
+    }
+    close $handle;
 
-    return $serial;
+    return $info;
 }
 
 sub getInterfacesFromIfconfig {
@@ -440,9 +462,9 @@ Availables parameters:
 
 =back
 
-=head2 getSerialnumber(%params)
+=head2 getInfoFromSmartctl(%params)
 
-Returns the serial number of a drive, using smartctl.
+Returns some informations about a drive, using smartctl.
 
 Availables parameters:
 


================================================================
  Commit: 6bf7ffca419910da3db2ba206c7fe3f59b7403b7
      https://github.com/fusinv/fusioninventory-agent/commit/6bf7ffca419910da3db2ba206c7fe3f59b7403b7
  Author: Guillaume Rousse <guillomovitch at gmail.com>
  Date:   2012-05-03 (Thu, 03 May 2012)

  Changed paths:
    A resources/linux/smartctl/sample2
    A resources/linux/smartctl/sample3
    A resources/linux/smartctl/sample4

  Log Message:
  -----------
  new samples


diff --git a/resources/linux/smartctl/sample2 b/resources/linux/smartctl/sample2
new file mode 100644
index 0000000..0ad69b3
--- /dev/null
+++ b/resources/linux/smartctl/sample2
@@ -0,0 +1,7 @@
+smartctl version 5.38 [x86_64-redhat-linux-gnu] Copyright (C) 2002-8 Bruce Allen
+Home page is http://smartmontools.sourceforge.net/
+
+Device: ServeRA  Drive 1          Version: V1.0
+scsiModePageOffset: response length too short, resp_len=4 offset=4 bd_len=0
+>> Terminate command early due to bad response to IEC mode page
+A mandatory SMART command failed: exiting. To continue, add one or more '-T permissive' options.
diff --git a/resources/linux/smartctl/sample3 b/resources/linux/smartctl/sample3
new file mode 100644
index 0000000..b23d4a4
--- /dev/null
+++ b/resources/linux/smartctl/sample3
@@ -0,0 +1,10 @@
+smartctl version 5.38 [x86_64-redhat-linux-gnu] Copyright (C) 2002-8 Bruce Allen
+Home page is http://smartmontools.sourceforge.net/
+
+Device: IBM-ESXS ST3300655SS      Version: BA23
+Serial number: 3LM0L0FJ00009733Y46W
+Device type: disk
+Transport protocol: SAS
+Local Time is: Sat Apr 28 12:03:55 2012 MSK
+Device supports SMART and is Enabled
+Temperature Warning Enabled
diff --git a/resources/linux/smartctl/sample4 b/resources/linux/smartctl/sample4
new file mode 100644
index 0000000..6b3db52
--- /dev/null
+++ b/resources/linux/smartctl/sample4
@@ -0,0 +1,7 @@
+smartctl version 5.38 [x86_64-redhat-linux-gnu] Copyright (C) 2002-8 Bruce Allen
+Home page is http://smartmontools.sourceforge.net/
+
+Device: IBM-ESXS VSC7160          Version: 1.06
+Device type: enclosure
+Local Time is: Sat Apr 28 12:03:57 2012 MSK
+Device does not support SMART


================================================================
  Commit: bfbe965ceb26a0d8acd258227c5ce1e01290ce7f
      https://github.com/fusinv/fusioninventory-agent/commit/bfbe965ceb26a0d8acd258227c5ce1e01290ce7f
  Author: Guillaume Rousse <guillomovitch at gmail.com>
  Date:   2012-05-03 (Thu, 03 May 2012)

  Changed paths:
    R resources/linux/smartctl/dell-xt2
    A resources/linux/smartctl/sample1

  Log Message:
  -----------
  rename existing sample


diff --git a/resources/linux/smartctl/dell-xt2 b/resources/linux/smartctl/dell-xt2
deleted file mode 100644
index ba063ab..0000000
--- a/resources/linux/smartctl/dell-xt2
+++ /dev/null
@@ -1,15 +0,0 @@
-smartctl 5.40 2010-10-16 r3189 [x86_64-mandriva-linux-gnu] (local build)
-Copyright (C) 2002-10 by Bruce Allen, http://smartmontools.sourceforge.net
-
-=== START OF INFORMATION SECTION ===
-Device Model:     SAMSUNG SSD PM800 TM 128GB
-Serial Number:    DFW1W11002SE002B3117
-Firmware Version: VBM24D1Q
-User Capacity:    128 035 676 160 bytes
-Device is:        Not in smartctl database [for details use: -P showall]
-ATA Version is:   7
-ATA Standard is:  ATA/ATAPI-7 T13 1532D revision 1
-Local Time is:    Thu Dec 23 15:15:06 2010 CET
-SMART support is: Available - device has SMART capability.
-SMART support is: Enabled
-
diff --git a/resources/linux/smartctl/sample1 b/resources/linux/smartctl/sample1
new file mode 100644
index 0000000..ba063ab
--- /dev/null
+++ b/resources/linux/smartctl/sample1
@@ -0,0 +1,15 @@
+smartctl 5.40 2010-10-16 r3189 [x86_64-mandriva-linux-gnu] (local build)
+Copyright (C) 2002-10 by Bruce Allen, http://smartmontools.sourceforge.net
+
+=== START OF INFORMATION SECTION ===
+Device Model:     SAMSUNG SSD PM800 TM 128GB
+Serial Number:    DFW1W11002SE002B3117
+Firmware Version: VBM24D1Q
+User Capacity:    128 035 676 160 bytes
+Device is:        Not in smartctl database [for details use: -P showall]
+ATA Version is:   7
+ATA Standard is:  ATA/ATAPI-7 T13 1532D revision 1
+Local Time is:    Thu Dec 23 15:15:06 2010 CET
+SMART support is: Available - device has SMART capability.
+SMART support is: Enabled
+


================================================================
  Commit: 8ab7f8a825b742e90a259f397d32e47af2f9d3be
      https://github.com/fusinv/fusioninventory-agent/commit/8ab7f8a825b742e90a259f397d32e47af2f9d3be
  Author: Guillaume Rousse <guillomovitch at gmail.com>
  Date:   2012-05-03 (Thu, 03 May 2012)

  Changed paths:
    M t/tools/linux.t

  Log Message:
  -----------
  test new function


diff --git a/t/tools/linux.t b/t/tools/linux.t
index 9ca970d..94276cc 100755
--- a/t/tools/linux.t
+++ b/t/tools/linux.t
@@ -533,7 +533,24 @@ my %hal_tests = (
 );
 
 my %smartctl_tests = (
-    'dell-xt2' => 'DFW1W11002SE002B3117'
+    sample1 => {
+        TYPE         => 'disk',
+        DESCRIPTION  => 'SATA',
+        SERIALNUMBER => 'DFW1W11002SE002B3117'
+    },
+    sample2 => {
+        TYPE         => 'disk',
+        DESCRIPTION  => 'SATA'
+    },
+    sample3 => {
+        TYPE         => 'disk',
+        DESCRIPTION  => 'SAS',
+        SERIALNUMBER => '3LM0L0FJ00009733Y46W',
+    },
+    sample4 => {
+        TYPE         => 'enclosure',
+        DESCRIPTION  => 'SATA'
+    },
 );
 
 my %ifconfig_tests = (
@@ -879,8 +896,8 @@ foreach my $test (keys %hal_tests) {
 
 foreach my $test (keys %smartctl_tests) {
     my $file = "resources/linux/smartctl/$test";
-    my $result = getSerialnumber(file => $file);
-    is($result, $smartctl_tests{$test}, "$test smartctl parsing");
+    my $result = getInfoFromSmartctl(file => $file);
+    is_deeply($result, $smartctl_tests{$test}, "$test smartctl parsing");
 }
 
 foreach my $test (keys %ifconfig_tests) {


================================================================
  Commit: b00187101465b6a9733f20e1f77283e818b567f0
      https://github.com/fusinv/fusioninventory-agent/commit/b00187101465b6a9733f20e1f77283e818b567f0
  Author: Guillaume Rousse <guillomovitch at gmail.com>
  Date:   2012-05-03 (Thu, 03 May 2012)

  Changed paths:
    M lib/FusionInventory/Agent/Task/Inventory/Input/Linux/Storages/Adaptec.pm
    M lib/FusionInventory/Agent/Task/Inventory/Input/Linux/Storages/Lsilogic.pm
    M t/inventory/linux/storages/adaptec.t
    M t/inventory/linux/storages/lsilogic.t

  Log Message:
  -----------
  replace getSerialNumber with getInfoFromSmartctl

This allow to get more than serial number.


diff --git a/lib/FusionInventory/Agent/Task/Inventory/Input/Linux/Storages/Adaptec.pm b/lib/FusionInventory/Agent/Task/Inventory/Input/Linux/Storages/Adaptec.pm
index b036683..8976d61 100644
--- a/lib/FusionInventory/Agent/Task/Inventory/Input/Linux/Storages/Adaptec.pm
+++ b/lib/FusionInventory/Agent/Task/Inventory/Input/Linux/Storages/Adaptec.pm
@@ -30,8 +30,12 @@ sub doInventory {
                 controller => 'scsi' . $device->{SCSI_COID},
                 name       => $device->{NAME},
                 logger     => $logger
-            )) {
-            $disk->{SERIALNUMBER} = getSerialnumber(device => $disk->{device});
+        )) {
+            # merge with smartctl info
+            my $info = getInfoFromSmartctl(device => $disk->{device});
+            foreach my $key (qw/SERIALNUMBER DESCRIPTION TYPE/) {
+                $disk->{$key} = $info->{$key};
+            }
             delete $disk->{device};
             $inventory->addEntry(section => 'STORAGES', entry => $disk);
         }
@@ -60,8 +64,6 @@ sub _getDisksFromProc {
                 # that's the controller we're looking for
                 $disk = {
                     NAME        => $params{name},
-                    DESCRIPTION => 'SATA',
-                    TYPE        => 'disk',
                 };
             } else {
                 # that's another controller
diff --git a/lib/FusionInventory/Agent/Task/Inventory/Input/Linux/Storages/Lsilogic.pm b/lib/FusionInventory/Agent/Task/Inventory/Input/Linux/Storages/Lsilogic.pm
index 73b4c49..bb42ae2 100644
--- a/lib/FusionInventory/Agent/Task/Inventory/Input/Linux/Storages/Lsilogic.pm
+++ b/lib/FusionInventory/Agent/Task/Inventory/Input/Linux/Storages/Lsilogic.pm
@@ -24,7 +24,11 @@ sub doInventory {
             logger  => $logger,
             command => "mpt-status -n -i $device->{SCSI_UNID}"
         )) {
-            $disk->{SERIALNUMBER} = getSerialnumber(device => $disk->{device});
+            # merge with smartctl info
+            my $info = getInfoFromSmartctl(device => $disk->{device});
+            foreach my $key (qw/SERIALNUMBER DESCRIPTION TYPE/) {
+                $disk->{$key} = $info->{$key};
+            }
             delete $disk->{device};
             $inventory->addEntry(section => 'STORAGES', entry => $disk);
         }
@@ -51,8 +55,6 @@ sub _getDiskFromMptStatus {
 
         my $disk = {
             NAME         => $params{name},
-            DESCRIPTION  => 'SATA',
-            TYPE         => 'disk',
             device       => "/dev/sg$1",
             MODEL        => $2,
             MANUFACTURER => getCanonicalManufacturer($2),
diff --git a/t/inventory/linux/storages/adaptec.t b/t/inventory/linux/storages/adaptec.t
index 790c99e..ca154da 100644
--- a/t/inventory/linux/storages/adaptec.t
+++ b/t/inventory/linux/storages/adaptec.t
@@ -13,8 +13,6 @@ my %tests = (
         disks   => [
             {
                 NAME         => 'foo',
-                DESCRIPTION  => 'SATA',
-                TYPE         => 'disk',
                 MODEL        => 'SAMSUNG SSD PM80',
                 MANUFACTURER => 'Samsung',
                 FIRMWARE     => 'VBM2',
@@ -28,8 +26,6 @@ my %tests = (
         disks      => [
             {
                 NAME         => 'foo',
-                DESCRIPTION  => 'SATA',
-                TYPE         => 'disk',
                 MODEL        => 'HUS151436VL3800',
                 MANUFACTURER => 'Hitachi',
                 FIRMWARE     => 'S3C0',
@@ -37,8 +33,6 @@ my %tests = (
             },
             {
                 NAME         => 'foo',
-                DESCRIPTION  => 'SATA',
-                TYPE         => 'disk',
                 MODEL        => 'HUS151436VL3800',
                 MANUFACTURER => 'Hitachi',
                 FIRMWARE     => 'S3C0',
@@ -52,8 +46,6 @@ my %tests = (
         disks      => [
             {
                 NAME         => 'foo',
-                DESCRIPTION  => 'SATA',
-                TYPE         => 'disk',
                 MODEL        => 'UJDA782 DVD/CDRW',
                 MANUFACTURER => 'UJDA782 DVD/CDRW',
                 FIRMWARE     => 'VA13',
@@ -70,8 +62,6 @@ my %tests = (
                 FIRMWARE     => 'V1.0',
                 MANUFACTURER => 'Drive 1',
                 MODEL        => 'Drive 1',
-                DESCRIPTION  => 'SATA',
-                TYPE         => 'disk',
                 device       => '/dev/sg0'
             },
             {
@@ -79,8 +69,6 @@ my %tests = (
                 FIRMWARE     => 'V1.0',
                 MANUFACTURER => 'Drive 2',
                 MODEL        => 'Drive 2',
-                DESCRIPTION  => 'SATA',
-                TYPE         => 'disk',
                 device       => '/dev/sg1'
             },
             {
@@ -88,8 +76,6 @@ my %tests = (
                 FIRMWARE     => 'BA23',
                 MANUFACTURER => 'Seagate',
                 MODEL        => 'ST3300655SS',
-                DESCRIPTION  => 'SATA',
-                TYPE         => 'disk',
                 device       => '/dev/sg2'
                 },
                 {
@@ -97,8 +83,6 @@ my %tests = (
                 FIRMWARE     => 'BA23',
                 MANUFACTURER => 'Seagate',
                 MODEL        => 'ST3300655SS',
-                DESCRIPTION  => 'SATA',
-                TYPE         => 'disk',
                 device       => '/dev/sg3'
             },
             {
@@ -106,8 +90,6 @@ my %tests = (
                 FIRMWARE     => 'BA23',
                 MANUFACTURER => 'Seagate',
                 MODEL        => 'ST3300655SS',
-                DESCRIPTION  => 'SATA',
-                TYPE         => 'disk',
                 device       => '/dev/sg4'
             },
             {
@@ -115,8 +97,6 @@ my %tests = (
                 FIRMWARE     => 'BA23',
                 MANUFACTURER => 'Seagate',
                 MODEL        => 'ST3300655SS',
-                DESCRIPTION  => 'SATA',
-                TYPE         => 'disk',
                 device       => '/dev/sg5'
             },
             {
@@ -124,8 +104,6 @@ my %tests = (
                 FIRMWARE     => 'BA23',
                 MANUFACTURER => 'Seagate',
                 MODEL        => 'ST3300655SS',
-                DESCRIPTION  => 'SATA',
-                TYPE         => 'disk',
                 device       => '/dev/sg6'
             },
             {
@@ -133,8 +111,6 @@ my %tests = (
                 FIRMWARE     => 'BA23',
                 MANUFACTURER => 'Seagate',
                 MODEL        => 'ST3300655SS',
-                DESCRIPTION  => 'SATA',
-                TYPE         => 'disk',
                 device       => '/dev/sg7'
             },
             {
@@ -142,8 +118,6 @@ my %tests = (
                 FIRMWARE     => '1.06',
                 MANUFACTURER => 'VSC7160',
                 MODEL        => 'VSC7160',
-                DESCRIPTION  => 'SATA',
-                TYPE         => 'disk',
                 device       => '/dev/sg8'
             }
         ]
diff --git a/t/inventory/linux/storages/lsilogic.t b/t/inventory/linux/storages/lsilogic.t
index fefa13a..115845f 100755
--- a/t/inventory/linux/storages/lsilogic.t
+++ b/t/inventory/linux/storages/lsilogic.t
@@ -15,9 +15,7 @@ my %tests = (
                 FIRMWARE     => 'D',
                 MANUFACTURER => 'Seagate',
                 MODEL        => 'ST3160815AS',
-                DESCRIPTION  => 'SATA',
                 device       => '/dev/sg1',
-                TYPE         => 'disk'
             },
             {
                 SIZE         => '152576',
@@ -25,9 +23,7 @@ my %tests = (
                 FIRMWARE     => 'D',
                 MANUFACTURER => 'Seagate',
                 MODEL        => 'ST3160815AS',
-                DESCRIPTION  => 'SATA',
                 device       => '/dev/sg0',
-                TYPE         => 'disk'
           }
         ]
     },
@@ -40,9 +36,7 @@ my %tests = (
                 FIRMWARE     => 'C610',
                 MANUFACTURER => 'CBRCA146C3ETS0 N',
                 MODEL        => 'CBRCA146C3ETS0 N',
-                DESCRIPTION  => 'SATA',
                 device       => '/dev/sg5',
-                TYPE         => 'disk'
             },
             {
                 SIZE         => '139264',
@@ -50,9 +44,7 @@ my %tests = (
                 FIRMWARE     => 'C610',
                 MANUFACTURER => 'CBRCA146C3ETS0 N',
                 MODEL        => 'CBRCA146C3ETS0 N',
-                DESCRIPTION  => 'SATA',
                 device       => '/dev/sg4',
-                TYPE         => 'disk'
             },
             {
                 SIZE         => '139264',
@@ -60,9 +52,7 @@ my %tests = (
                 FIRMWARE     => 'B53C',
                 MANUFACTURER => 'Seagate',
                 MODEL        => 'ST9146803SS',
-                DESCRIPTION  => 'SATA',
                 device       => '/dev/sg3',
-                TYPE         => 'disk'
             },
             {
                 SIZE         => '139264',
@@ -70,9 +60,7 @@ my %tests = (
                 FIRMWARE     => 'C610',
                 MANUFACTURER => 'CBRCA146C3ETS0 N',
                 MODEL        => 'CBRCA146C3ETS0 N',
-                DESCRIPTION  => 'SATA',
                 device       => '/dev/sg2',
-                TYPE         => 'disk'
             },
             {
                 SIZE         => '139264',
@@ -80,9 +68,7 @@ my %tests = (
                 FIRMWARE     => 'C610',
                 MANUFACTURER => 'CBRCA146C3ETS0 N',
                 MODEL        => 'CBRCA146C3ETS0 N',
-                DESCRIPTION  => 'SATA',
                 device       => '/dev/sg1',
-                TYPE         => 'disk'
             },
             {
                 SIZE         => '139264',
@@ -90,9 +76,7 @@ my %tests = (
                 FIRMWARE     => 'C610',
                 MANUFACTURER => 'CBRCA146C3ETS0 N',
                 MODEL        => 'CBRCA146C3ETS0 N',
-                DESCRIPTION  => 'SATA',
                 device       => '/dev/sg0',
-                TYPE         => 'disk'
             }
         ]
     }


================================================================
  Commit: ad57d4d964d1202a306fd32c5c530bed9e0da048
      https://github.com/fusinv/fusioninventory-agent/commit/ad57d4d964d1202a306fd32c5c530bed9e0da048
  Author: Guillaume Rousse <guillomovitch at gmail.com>
  Date:   2012-05-03 (Thu, 03 May 2012)

  Changed paths:
    M lib/FusionInventory/Agent/Task/Inventory/Input/Generic/Processes.pm
    M lib/FusionInventory/Agent/Task/Inventory/Input/Linux/Storages/Adaptec.pm
    M lib/FusionInventory/Agent/Task/Inventory/Input/Linux/Storages/Lsilogic.pm
    M lib/FusionInventory/Agent/Task/Inventory/Input/Virtualization/Qemu.pm
    M lib/FusionInventory/Agent/Tools/Generic.pm
    M lib/FusionInventory/Agent/Tools/Linux.pm
    M lib/FusionInventory/Agent/Tools/Screen.pm
    A resources/linux/mpt-status/sample1
    A resources/linux/mpt-status/sample2
    A resources/linux/proc/scsi/linux3
    A resources/linux/proc/scsi/linux4
    R resources/linux/smartctl/dell-xt2
    A resources/linux/smartctl/sample1
    A resources/linux/smartctl/sample2
    A resources/linux/smartctl/sample3
    A resources/linux/smartctl/sample4
    M t/inventory/linux/storages/adaptec.t
    A t/inventory/linux/storages/lsilogic.t
    M t/tools/generic.t
    M t/tools/linux.t

  Log Message:
  -----------
  Merge branch '2.2.x' into 2.3.x


diff --git a/lib/FusionInventory/Agent/Task/Inventory/Input/Generic/Processes.pm b/lib/FusionInventory/Agent/Task/Inventory/Input/Generic/Processes.pm
index e22c36c..ca95aaa 100644
--- a/lib/FusionInventory/Agent/Task/Inventory/Input/Generic/Processes.pm
+++ b/lib/FusionInventory/Agent/Task/Inventory/Input/Generic/Processes.pm
@@ -11,6 +11,7 @@ use FusionInventory::Agent::Tools::Unix;
 sub isEnabled {
     return 
         $OSNAME ne 'MSWin32' &&
+        !$params{no_category}->{process} &&
         canRun('ps');
 }
 
diff --git a/lib/FusionInventory/Agent/Task/Inventory/Input/Linux/Storages/Adaptec.pm b/lib/FusionInventory/Agent/Task/Inventory/Input/Linux/Storages/Adaptec.pm
index 4662f62..8976d61 100644
--- a/lib/FusionInventory/Agent/Task/Inventory/Input/Linux/Storages/Adaptec.pm
+++ b/lib/FusionInventory/Agent/Task/Inventory/Input/Linux/Storages/Adaptec.pm
@@ -8,12 +8,6 @@ use English qw(-no_match_vars);
 use FusionInventory::Agent::Tools;
 use FusionInventory::Agent::Tools::Linux;
 
-# Tested on 2.6.* kernels
-#
-# Cards tested :
-#
-# Adaptec AAC-RAID
-
 sub isEnabled {
     return -r '/proc/scsi/scsi';
 }
@@ -28,14 +22,21 @@ sub doInventory {
 
     foreach my $device (@devices) {
         next unless $device->{MANUFACTURER};
-        next unless $device->{MANUFACTURER} eq 'Adaptec';
+        next unless
+            $device->{MANUFACTURER} eq 'Adaptec' ||
+            $device->{MANUFACTURER} eq 'ServeRA';
 
         foreach my $disk (_getDisksFromProc(
                 controller => 'scsi' . $device->{SCSI_COID},
                 name       => $device->{NAME},
                 logger     => $logger
-            )) {
-            $disk->{SERIALNUMBER} = getSerialnumber($disk->{device});
+        )) {
+            # merge with smartctl info
+            my $info = getInfoFromSmartctl(device => $disk->{device});
+            foreach my $key (qw/SERIALNUMBER DESCRIPTION TYPE/) {
+                $disk->{$key} = $info->{$key};
+            }
+            delete $disk->{device};
             $inventory->addEntry(section => 'STORAGES', entry => $disk);
         }
     }
@@ -63,8 +64,6 @@ sub _getDisksFromProc {
                 # that's the controller we're looking for
                 $disk = {
                     NAME        => $params{name},
-                    DESCRIPTION => 'SATA',
-                    TYPE        => 'disk',
                 };
             } else {
                 # that's another controller
@@ -72,18 +71,18 @@ sub _getDisksFromProc {
             }
         }
 
-        if ($line =~ /Model:\s(\S+).*Rev:\s(\S+)/) {
+        if ($line =~ /Model: \s (\S.+\S) \s+ Rev: \s (\S+)/x) {
             next unless $disk;
             $disk->{MODEL}    = $1;
             $disk->{FIRMWARE} = $2;
 
             # that's the controller itself, not a disk
-            next if $disk->{MODEL} =~ 'raid';
+            next if $disk->{MODEL} =~ /(raid|RAID)/;
 
             $disk->{MANUFACTURER} = getCanonicalManufacturer(
                 $disk->{MODEL}
             );
-            $disk->{DEVICE} = "/dev/sg$count";
+            $disk->{device} = "/dev/sg$count";
 
             push @disks, $disk;
         }
diff --git a/lib/FusionInventory/Agent/Task/Inventory/Input/Linux/Storages/Lsilogic.pm b/lib/FusionInventory/Agent/Task/Inventory/Input/Linux/Storages/Lsilogic.pm
index 2b6a0ca..bb42ae2 100644
--- a/lib/FusionInventory/Agent/Task/Inventory/Input/Linux/Storages/Lsilogic.pm
+++ b/lib/FusionInventory/Agent/Task/Inventory/Input/Linux/Storages/Lsilogic.pm
@@ -6,14 +6,6 @@ use warnings;
 use FusionInventory::Agent::Tools;
 use FusionInventory::Agent::Tools::Linux;
 
-# Tested on 2.6.* kernels
-#
-# Cards tested :
-#
-# LSI Logic / Symbios Logic SAS1064E PCI-Express Fusion-MPT SAS
-#
-# mpt-status version : 1.2.0
-
 sub isEnabled {
     return canRun('mpt-status');
 }
@@ -26,37 +18,55 @@ sub doInventory {
 
     my @devices = getDevicesFromUdev(logger => $logger);
 
-    foreach my $hd (@devices) {
-        my $handle = getFileHandle(
-            logger => $logger,
-            command => "mpt-status -n -i $hd->{SCSI_UNID}"
-        );
-        next unless $handle;
-        while (my $line = <$handle>) {
-            next unless /phys_id:(\d+).*product_id:\s*(\S*)\s+revision:(\S+).*size\(GB\):(\d+)/;
-            my $id = $1;
-
-            my $storage = {
-                NAME => $hd->{NAME},
-                DESCRIPTION => 'SATA',
-                TYPE        => 'disk',
-                MODEL       => $2,
-                FIRMWARE    => $3,
-                SIZE        => $4 * 1024
-            };
-
-            $storage->{SERIALNUMBER} = getSerialnumber(
-                device => "/dev/sg$id"
-            );
-            $storage->{MANUFACTURER} = getCanonicalManufacturer(
-                $storage->{MODEL}
-            );
-
-            $inventory->addEntry(section => 'STORAGES', entry => $storage);
+    foreach my $device (@devices) {
+        foreach my $disk (_getDiskFromMptStatus(
+            name    => $device->{NAME},
+            logger  => $logger,
+            command => "mpt-status -n -i $device->{SCSI_UNID}"
+        )) {
+            # merge with smartctl info
+            my $info = getInfoFromSmartctl(device => $disk->{device});
+            foreach my $key (qw/SERIALNUMBER DESCRIPTION TYPE/) {
+                $disk->{$key} = $info->{$key};
+            }
+            delete $disk->{device};
+            $inventory->addEntry(section => 'STORAGES', entry => $disk);
         }
-        close $handle;
     }
 
 }
 
+sub _getDiskFromMptStatus {
+    my (%params) = @_;
+
+    my $handle = getFileHandle(%params);
+    next unless $handle;
+
+    my @disks;
+    while (my $line = <$handle>) {
+        next unless $line =~ /
+            phys_id:(\d+) \s
+            scsi_id:\d+ \s
+            vendor:\S+ \s+
+            product_id:(\S.+\S) \s+
+            revision:(\S+) \s+
+            size\(GB\):(\d+)
+        /x;
+
+        my $disk = {
+            NAME         => $params{name},
+            device       => "/dev/sg$1",
+            MODEL        => $2,
+            MANUFACTURER => getCanonicalManufacturer($2),
+            FIRMWARE     => $3,
+            SIZE         => $4 * 1024
+        };
+
+        push @disks, $disk;
+    }
+    close $handle;
+
+    return @disks;
+}
+
 1;
diff --git a/lib/FusionInventory/Agent/Task/Inventory/Input/Virtualization/Qemu.pm b/lib/FusionInventory/Agent/Task/Inventory/Input/Virtualization/Qemu.pm
index 92a8d21..979c2ed 100644
--- a/lib/FusionInventory/Agent/Task/Inventory/Input/Virtualization/Qemu.pm
+++ b/lib/FusionInventory/Agent/Task/Inventory/Input/Virtualization/Qemu.pm
@@ -27,17 +27,18 @@ sub doInventory {
         logger => $logger, command => 'ps -ef'
     )) {
         # match only if an qemu instance
-        next unless $process->{CMD} =~ /(qemu|kvm|(qemu-kvm)).*\-([fh]d[a-d]|cdrom).*/;
+        next unless 
+            $process->{CMD} =~ /(qemu|kvm|qemu-kvm) .* -([fhsv]d[a-d]|cdrom)/x;
             
         my $name;
         my $mem = 0;
         my $uuid;
         my $vmtype = $1;
                     
-        my @options = split (/\-/, $process->{CMD});
+        my @options = split (/-/, $process->{CMD});
         foreach my $option (@options) {
-            if ($option =~ m/^([fh]d[a-d]|cdrom) (\S+)/) {
-                $name = $2 if !$name;
+            if ($option =~ m/^(?:[fhsv]d[a-d]|cdrom) (\S+)/) {
+                $name = $1 if !$name;
             } elsif ($option =~ m/^name (\S+)/) {
                 $name = $1;
             } elsif ($option =~ m/^m (\S+)/) {
diff --git a/lib/FusionInventory/Agent/Tools/Generic.pm b/lib/FusionInventory/Agent/Tools/Generic.pm
index 25ac7ba..825b70a 100644
--- a/lib/FusionInventory/Agent/Tools/Generic.pm
+++ b/lib/FusionInventory/Agent/Tools/Generic.pm
@@ -99,13 +99,20 @@ sub getCpusFromDmidecode {
                 $cpu->{SPEED} = $1 * 1000;
             }
         }
-        if (!$cpu->{SPEED}) {
-            if ($info->{'Max Speed'}) {
-                if ($info->{'Max Speed'} =~ /^\s*(\d+)\s*Mhz/i) {
-                    $cpu->{SPEED} = $1;
-                } elsif ($info->{'Max Speed'} =~ /^\s*(\d+)\s*Ghz/i) {
-                    $cpu->{SPEED} = $1 * 1000;
-                }
+        if (!$cpu->{SPEED} && $info->{'Max Speed'}) {
+            # We only look for 3 digit Mhz frequency to avoid abvious bad
+            # value like 30000 (#633)
+            if ($info->{'Max Speed'} =~ /^\s*(\d{3,4})\s*Mhz/i) {
+                $cpu->{SPEED} = $1;
+            } elsif ($info->{'Max Speed'} =~ /^\s*(\d+)\s*Ghz/i) {
+                $cpu->{SPEED} = $1 * 1000;
+            }
+        }
+        if (!$cpu->{SPEED} && $info->{'Current Speed'}) {
+            if ($info->{'Current Speed'} =~ /^\s*(\d{3,4})\s*Mhz/i) {
+                $cpu->{SPEED} = $1;
+            } elsif ($info->{'Current Speed'} =~ /^\s*(\d+)\s*Ghz/i) {
+                $cpu->{SPEED} = $1 * 1000;
             }
         }
 
diff --git a/lib/FusionInventory/Agent/Tools/Linux.pm b/lib/FusionInventory/Agent/Tools/Linux.pm
index 94a38c8..6e8f5bc 100644
--- a/lib/FusionInventory/Agent/Tools/Linux.pm
+++ b/lib/FusionInventory/Agent/Tools/Linux.pm
@@ -16,7 +16,7 @@ our @EXPORT = qw(
     getDevicesFromHal
     getDevicesFromProc
     getCPUsFromProc
-    getSerialnumber
+    getInfoFromSmartctl
     getInterfacesFromIfconfig
     getInterfacesFromIp
 );
@@ -29,8 +29,11 @@ sub getDevicesFromUdev {
     my @devices;
 
     foreach my $file (glob ("/dev/.udev/db/*")) {
-        next unless $file =~ /([sh]d[a-z])$/;
-        my $device = $1;
+        my $device = getFirstMatch(
+            file    => $file,
+            pattern => qr/^N:(\S+)/
+        );
+        next unless $device =~ /([hsv]d[a-z]|sr\d+)$/;
         push (@devices, _parseUdevEntry(
                 logger => $params{logger}, file => $file, device => $device
             ));
@@ -240,17 +243,39 @@ sub _getValueFromSysProc {
     return $value;
 }
 
-sub getSerialnumber {
+sub getInfoFromSmartctl {
     my (%params) = @_;
 
-    my ($serial) = getFirstMatch(
+    my $handle = getFileHandle(
+        %params,
         command => $params{device} ? "smartctl -i $params{device}" : undef,
-        file    => $params{file},
-        logger  => $params{logger},
-        pattern => qr/^Serial Number:\s+(\S*)/
     );
+    return unless $handle;
+
+    my $info = {
+        TYPE        => 'disk',
+        DESCRIPTION => 'SATA',
+    };
+
+    while (my $line = <$handle>) {
+        if ($line =~ /^Transport protocol: +(\S+)/i) {
+            $info->{DESCRIPTION} = $1;
+            next;
+        }
+
+        if ($line =~ /^Device type: +(\S+)/i) {
+            $info->{TYPE} = $1;
+            next;
+        }
+
+        if ($line =~ /^Serial number: +(\S+)/i) {
+            $info->{SERIALNUMBER} = $1;
+            next;
+        }
+    }
+    close $handle;
 
-    return $serial;
+    return $info;
 }
 
 sub getInterfacesFromIfconfig {
@@ -437,9 +462,9 @@ Availables parameters:
 
 =back
 
-=head2 getSerialnumber(%params)
+=head2 getInfoFromSmartctl(%params)
 
-Returns the serial number of a drive, using smartctl.
+Returns some informations about a drive, using smartctl.
 
 Availables parameters:
 
diff --git a/lib/FusionInventory/Agent/Tools/Screen.pm b/lib/FusionInventory/Agent/Tools/Screen.pm
index 5cb71db..cd479fb 100644
--- a/lib/FusionInventory/Agent/Tools/Screen.pm
+++ b/lib/FusionInventory/Agent/Tools/Screen.pm
@@ -487,7 +487,9 @@ sub getManufacturerFromCode {
         "IFS" => "InFocus",
         "BOE" => "BOE Display Technology",
         "IQT" => "Hyundai",
-        "HSD" => "Hannspree Inc"
+        "HSD" => "Hannspree Inc",
+        "PRT" => "Princeton",
+        "PDC" => "Polaroid"
 
 
     };
diff --git a/resources/linux/mpt-status/sample1 b/resources/linux/mpt-status/sample1
new file mode 100644
index 0000000..bd2e0b2
--- /dev/null
+++ b/resources/linux/mpt-status/sample1
@@ -0,0 +1,5 @@
+ioc:0 vol_id:0 type:IM raidlevel:RAID-1 num_disks:2 size(GB):148 state: OPTIMAL flags: ENABLED
+ioc:0 phys_id:1 scsi_id:2 vendor:ATA      product_id:ST3160815AS      revision:D    size(GB):149 state: ONLINE flags: NONE sync_state: 100 ASC/ASCQ:0xff/0xff SMART ASC/ASCQ:0xff/0xff
+ioc:0 phys_id:0 scsi_id:1 vendor:ATA      product_id:ST3160815AS      revision:D    size(GB):149 state: ONLINE flags: NONE sync_state: 100 ASC/ASCQ:0xff/0xff SMART ASC/ASCQ:0xff/0xff
+scsi_id:1 100%
+scsi_id:0 100%
diff --git a/resources/linux/mpt-status/sample2 b/resources/linux/mpt-status/sample2
new file mode 100644
index 0000000..4e12a3d
--- /dev/null
+++ b/resources/linux/mpt-status/sample2
@@ -0,0 +1,13 @@
+ioc:0 vol_id:1 type:IME raidlevel:RAID-1E num_disks:6 size(GB):407 state: OPTIMAL flags: ENABLED
+ioc:0 phys_id:5 scsi_id:7 vendor:IBM-ESXS product_id:CBRCA146C3ETS0 N revision:C610 size(GB):136 state: ONLINE flags: NONE sync_state: 100 ASC/ASCQ:0xff/0xff SMART ASC/ASCQ:0xff/0xff
+ioc:0 phys_id:4 scsi_id:2 vendor:IBM-ESXS product_id:CBRCA146C3ETS0 N revision:C610 size(GB):136 state: ONLINE flags: NONE sync_state: 100 ASC/ASCQ:0xff/0xff SMART ASC/ASCQ:0xff/0xff
+ioc:0 phys_id:3 scsi_id:3 vendor:IBM-ESXS product_id:ST9146803SS      revision:B53C size(GB):136 state: ONLINE flags: NONE sync_state: 100 ASC/ASCQ:0xff/0xff SMART ASC/ASCQ:0xff/0xff
+ioc:0 phys_id:2 scsi_id:4 vendor:IBM-ESXS product_id:CBRCA146C3ETS0 N revision:C610 size(GB):136 state: ONLINE flags: NONE sync_state: 100 ASC/ASCQ:0xff/0xff SMART ASC/ASCQ:0xff/0xff
+ioc:0 phys_id:1 scsi_id:5 vendor:IBM-ESXS product_id:CBRCA146C3ETS0 N revision:C610 size(GB):136 state: ONLINE flags: NONE sync_state: 100 ASC/ASCQ:0xff/0xff SMART ASC/ASCQ:0xff/0xff
+ioc:0 phys_id:0 scsi_id:6 vendor:IBM-ESXS product_id:CBRCA146C3ETS0 N revision:C610 size(GB):136 state: ONLINE flags: NONE sync_state: 100 ASC/ASCQ:0xff/0xff SMART ASC/ASCQ:0xff/0xff
+scsi_id:5 100%
+scsi_id:4 100%
+scsi_id:3 100%
+scsi_id:2 100%
+scsi_id:1 100%
+scsi_id:0 100%
diff --git a/resources/linux/proc/scsi/linux3 b/resources/linux/proc/scsi/linux3
new file mode 100644
index 0000000..04587af
--- /dev/null
+++ b/resources/linux/proc/scsi/linux3
@@ -0,0 +1,25 @@
+Attached devices:
+Host: scsi0 Channel: 00 Id: 00 Lun: 00
+  Vendor: MATSHITA Model: UJDA782 DVD/CDRW Rev: VA13
+  Type:   CD-ROM                           ANSI  SCSI revision: 05
+Host: scsi4 Channel: 00 Id: 00 Lun: 00
+  Vendor: IBM-ESXS Model: CBRCA146C3ETS0 N Rev: C610
+  Type:   Direct-Access                    ANSI  SCSI revision: 06
+Host: scsi4 Channel: 00 Id: 01 Lun: 00
+  Vendor: IBM-ESXS Model: CBRCA146C3ETS0 N Rev: C610
+  Type:   Direct-Access                    ANSI  SCSI revision: 06
+Host: scsi4 Channel: 00 Id: 02 Lun: 00
+  Vendor: IBM-ESXS Model: ST9146803SS      Rev: B53C
+  Type:   Direct-Access                    ANSI  SCSI revision: 05
+Host: scsi4 Channel: 00 Id: 03 Lun: 00
+  Vendor: IBM-ESXS Model: CBRCA146C3ETS0 N Rev: C610
+  Type:   Direct-Access                    ANSI  SCSI revision: 06
+Host: scsi4 Channel: 00 Id: 04 Lun: 00
+  Vendor: IBM-ESXS Model: CBRCA146C3ETS0 N Rev: C610
+  Type:   Direct-Access                    ANSI  SCSI revision: 06
+Host: scsi4 Channel: 00 Id: 05 Lun: 00
+  Vendor: IBM-ESXS Model: CBRCA146C3ETS0 N Rev: C610
+  Type:   Direct-Access                    ANSI  SCSI revision: 06
+Host: scsi4 Channel: 01 Id: 01 Lun: 00
+  Vendor: LSILOGIC Model: Logical Volume   Rev: 3000
+  Type:   Direct-Access                    ANSI  SCSI revision: 02
diff --git a/resources/linux/proc/scsi/linux4 b/resources/linux/proc/scsi/linux4
new file mode 100644
index 0000000..f63873e
--- /dev/null
+++ b/resources/linux/proc/scsi/linux4
@@ -0,0 +1,28 @@
+Attached devices:
+Host: scsi0 Channel: 00 Id: 00 Lun: 00
+  Vendor: ServeRA  Model: Drive 1          Rev: V1.0
+  Type:   Direct-Access                    ANSI SCSI revision: 02
+Host: scsi0 Channel: 00 Id: 01 Lun: 00
+  Vendor: ServeRA  Model: Drive 2          Rev: V1.0
+  Type:   Direct-Access                    ANSI SCSI revision: 02
+Host: scsi0 Channel: 01 Id: 00 Lun: 00
+  Vendor: IBM-ESXS Model: ST3300655SS      Rev: BA23
+  Type:   Direct-Access                    ANSI SCSI revision: 05
+Host: scsi0 Channel: 01 Id: 01 Lun: 00
+  Vendor: IBM-ESXS Model: ST3300655SS      Rev: BA23
+  Type:   Direct-Access                    ANSI SCSI revision: 05
+Host: scsi0 Channel: 01 Id: 02 Lun: 00
+  Vendor: IBM-ESXS Model: ST3300655SS      Rev: BA23
+  Type:   Direct-Access                    ANSI SCSI revision: 05
+Host: scsi0 Channel: 01 Id: 03 Lun: 00
+  Vendor: IBM-ESXS Model: ST3300655SS      Rev: BA23
+  Type:   Direct-Access                    ANSI SCSI revision: 05
+Host: scsi0 Channel: 01 Id: 04 Lun: 00
+  Vendor: IBM-ESXS Model: ST3300655SS      Rev: BA23
+  Type:   Direct-Access                    ANSI SCSI revision: 05
+Host: scsi0 Channel: 01 Id: 05 Lun: 00
+  Vendor: IBM-ESXS Model: ST3300655SS      Rev: BA23
+  Type:   Direct-Access                    ANSI SCSI revision: 05
+Host: scsi0 Channel: 03 Id: 00 Lun: 00
+  Vendor: IBM-ESXS Model: VSC7160          Rev: 1.06
+  Type:   Enclosure                        ANSI SCSI revision: 03
diff --git a/resources/linux/smartctl/dell-xt2 b/resources/linux/smartctl/dell-xt2
deleted file mode 100644
index ba063ab..0000000
--- a/resources/linux/smartctl/dell-xt2
+++ /dev/null
@@ -1,15 +0,0 @@
-smartctl 5.40 2010-10-16 r3189 [x86_64-mandriva-linux-gnu] (local build)
-Copyright (C) 2002-10 by Bruce Allen, http://smartmontools.sourceforge.net
-
-=== START OF INFORMATION SECTION ===
-Device Model:     SAMSUNG SSD PM800 TM 128GB
-Serial Number:    DFW1W11002SE002B3117
-Firmware Version: VBM24D1Q
-User Capacity:    128 035 676 160 bytes
-Device is:        Not in smartctl database [for details use: -P showall]
-ATA Version is:   7
-ATA Standard is:  ATA/ATAPI-7 T13 1532D revision 1
-Local Time is:    Thu Dec 23 15:15:06 2010 CET
-SMART support is: Available - device has SMART capability.
-SMART support is: Enabled
-
diff --git a/resources/linux/smartctl/sample1 b/resources/linux/smartctl/sample1
new file mode 100644
index 0000000..ba063ab
--- /dev/null
+++ b/resources/linux/smartctl/sample1
@@ -0,0 +1,15 @@
+smartctl 5.40 2010-10-16 r3189 [x86_64-mandriva-linux-gnu] (local build)
+Copyright (C) 2002-10 by Bruce Allen, http://smartmontools.sourceforge.net
+
+=== START OF INFORMATION SECTION ===
+Device Model:     SAMSUNG SSD PM800 TM 128GB
+Serial Number:    DFW1W11002SE002B3117
+Firmware Version: VBM24D1Q
+User Capacity:    128 035 676 160 bytes
+Device is:        Not in smartctl database [for details use: -P showall]
+ATA Version is:   7
+ATA Standard is:  ATA/ATAPI-7 T13 1532D revision 1
+Local Time is:    Thu Dec 23 15:15:06 2010 CET
+SMART support is: Available - device has SMART capability.
+SMART support is: Enabled
+
diff --git a/resources/linux/smartctl/sample2 b/resources/linux/smartctl/sample2
new file mode 100644
index 0000000..0ad69b3
--- /dev/null
+++ b/resources/linux/smartctl/sample2
@@ -0,0 +1,7 @@
+smartctl version 5.38 [x86_64-redhat-linux-gnu] Copyright (C) 2002-8 Bruce Allen
+Home page is http://smartmontools.sourceforge.net/
+
+Device: ServeRA  Drive 1          Version: V1.0
+scsiModePageOffset: response length too short, resp_len=4 offset=4 bd_len=0
+>> Terminate command early due to bad response to IEC mode page
+A mandatory SMART command failed: exiting. To continue, add one or more '-T permissive' options.
diff --git a/resources/linux/smartctl/sample3 b/resources/linux/smartctl/sample3
new file mode 100644
index 0000000..b23d4a4
--- /dev/null
+++ b/resources/linux/smartctl/sample3
@@ -0,0 +1,10 @@
+smartctl version 5.38 [x86_64-redhat-linux-gnu] Copyright (C) 2002-8 Bruce Allen
+Home page is http://smartmontools.sourceforge.net/
+
+Device: IBM-ESXS ST3300655SS      Version: BA23
+Serial number: 3LM0L0FJ00009733Y46W
+Device type: disk
+Transport protocol: SAS
+Local Time is: Sat Apr 28 12:03:55 2012 MSK
+Device supports SMART and is Enabled
+Temperature Warning Enabled
diff --git a/resources/linux/smartctl/sample4 b/resources/linux/smartctl/sample4
new file mode 100644
index 0000000..6b3db52
--- /dev/null
+++ b/resources/linux/smartctl/sample4
@@ -0,0 +1,7 @@
+smartctl version 5.38 [x86_64-redhat-linux-gnu] Copyright (C) 2002-8 Bruce Allen
+Home page is http://smartmontools.sourceforge.net/
+
+Device: IBM-ESXS VSC7160          Version: 1.06
+Device type: enclosure
+Local Time is: Sat Apr 28 12:03:57 2012 MSK
+Device does not support SMART
diff --git a/t/inventory/linux/storages/adaptec.t b/t/inventory/linux/storages/adaptec.t
index 0ce27a0..ca154da 100644
--- a/t/inventory/linux/storages/adaptec.t
+++ b/t/inventory/linux/storages/adaptec.t
@@ -2,10 +2,9 @@
 
 use strict;
 use warnings;
-use FusionInventory::Agent::Task::Inventory::Input::Linux::Storages::Adaptec;
-use Test::More;
 
-plan tests => 2;
+use Test::More;
+use FusionInventory::Agent::Task::Inventory::Input::Linux::Storages::Adaptec;
 
 my %tests = (
     linux1 => {
@@ -14,12 +13,10 @@ my %tests = (
         disks   => [
             {
                 NAME         => 'foo',
-                DESCRIPTION  => 'SATA',
-                TYPE         => 'disk',
-                MODEL        => 'SAMSUNG',
+                MODEL        => 'SAMSUNG SSD PM80',
                 MANUFACTURER => 'Samsung',
                 FIRMWARE     => 'VBM2',
-                DEVICE       => '/dev/sg0'
+                device       => '/dev/sg0'
             }
         ]
     },
@@ -29,26 +26,106 @@ my %tests = (
         disks      => [
             {
                 NAME         => 'foo',
-                DESCRIPTION  => 'SATA',
-                TYPE         => 'disk',
                 MODEL        => 'HUS151436VL3800',
                 MANUFACTURER => 'Hitachi',
                 FIRMWARE     => 'S3C0',
-                DEVICE       => '/dev/sg1'
+                device       => '/dev/sg1'
             },
             {
                 NAME         => 'foo',
-                DESCRIPTION  => 'SATA',
-                TYPE         => 'disk',
                 MODEL        => 'HUS151436VL3800',
                 MANUFACTURER => 'Hitachi',
                 FIRMWARE     => 'S3C0',
-                DEVICE       => '/dev/sg2'
+                device       => '/dev/sg2'
+            }
+        ]
+    },
+    linux3 => {
+        controller => 'scsi0',
+        name       => 'foo',
+        disks      => [
+            {
+                NAME         => 'foo',
+                MODEL        => 'UJDA782 DVD/CDRW',
+                MANUFACTURER => 'UJDA782 DVD/CDRW',
+                FIRMWARE     => 'VA13',
+                device       => '/dev/sg0'
+            },
+        ]
+    },
+    linux4 => {
+        controller => 'scsi0',
+        name       => 'foo',
+        disks      => [
+            {
+                NAME         => 'foo',
+                FIRMWARE     => 'V1.0',
+                MANUFACTURER => 'Drive 1',
+                MODEL        => 'Drive 1',
+                device       => '/dev/sg0'
+            },
+            {
+                NAME         => 'foo',
+                FIRMWARE     => 'V1.0',
+                MANUFACTURER => 'Drive 2',
+                MODEL        => 'Drive 2',
+                device       => '/dev/sg1'
+            },
+            {
+                NAME         => 'foo',
+                FIRMWARE     => 'BA23',
+                MANUFACTURER => 'Seagate',
+                MODEL        => 'ST3300655SS',
+                device       => '/dev/sg2'
+                },
+                {
+                NAME         => 'foo',
+                FIRMWARE     => 'BA23',
+                MANUFACTURER => 'Seagate',
+                MODEL        => 'ST3300655SS',
+                device       => '/dev/sg3'
+            },
+            {
+                NAME         => 'foo',
+                FIRMWARE     => 'BA23',
+                MANUFACTURER => 'Seagate',
+                MODEL        => 'ST3300655SS',
+                device       => '/dev/sg4'
+            },
+            {
+                NAME         => 'foo',
+                FIRMWARE     => 'BA23',
+                MANUFACTURER => 'Seagate',
+                MODEL        => 'ST3300655SS',
+                device       => '/dev/sg5'
+            },
+            {
+                NAME         => 'foo',
+                FIRMWARE     => 'BA23',
+                MANUFACTURER => 'Seagate',
+                MODEL        => 'ST3300655SS',
+                device       => '/dev/sg6'
+            },
+            {
+                NAME         => 'foo',
+                FIRMWARE     => 'BA23',
+                MANUFACTURER => 'Seagate',
+                MODEL        => 'ST3300655SS',
+                device       => '/dev/sg7'
+            },
+            {
+                NAME         => 'foo',
+                FIRMWARE     => '1.06',
+                MANUFACTURER => 'VSC7160',
+                MODEL        => 'VSC7160',
+                device       => '/dev/sg8'
             }
         ]
     }
 );
 
+plan tests => scalar keys %tests;
+
 foreach my $test (keys %tests) {
     my $file = "resources/linux/proc/scsi/$test";
     my @disks = FusionInventory::Agent::Task::Inventory::Input::Linux::Storages::Adaptec::_getDisksFromProc(
diff --git a/t/inventory/linux/storages/lsilogic.t b/t/inventory/linux/storages/lsilogic.t
new file mode 100755
index 0000000..115845f
--- /dev/null
+++ b/t/inventory/linux/storages/lsilogic.t
@@ -0,0 +1,94 @@
+#!/usr/bin/perl
+
+use strict;
+use warnings;
+use FusionInventory::Agent::Task::Inventory::Input::Linux::Storages::Lsilogic;
+use Test::More;
+
+my %tests = (
+    sample1 => {
+        name       => 'foo',
+        disks   => [
+             {
+                SIZE         => '152576',
+                NAME         => 'foo',
+                FIRMWARE     => 'D',
+                MANUFACTURER => 'Seagate',
+                MODEL        => 'ST3160815AS',
+                device       => '/dev/sg1',
+            },
+            {
+                SIZE         => '152576',
+                NAME         => 'foo',
+                FIRMWARE     => 'D',
+                MANUFACTURER => 'Seagate',
+                MODEL        => 'ST3160815AS',
+                device       => '/dev/sg0',
+          }
+        ]
+    },
+    sample2 => {
+        name       => 'foo',
+        disks      => [
+            {
+                SIZE         => '139264',
+                NAME         => 'foo',
+                FIRMWARE     => 'C610',
+                MANUFACTURER => 'CBRCA146C3ETS0 N',
+                MODEL        => 'CBRCA146C3ETS0 N',
+                device       => '/dev/sg5',
+            },
+            {
+                SIZE         => '139264',
+                NAME         => 'foo',
+                FIRMWARE     => 'C610',
+                MANUFACTURER => 'CBRCA146C3ETS0 N',
+                MODEL        => 'CBRCA146C3ETS0 N',
+                device       => '/dev/sg4',
+            },
+            {
+                SIZE         => '139264',
+                NAME         => 'foo',
+                FIRMWARE     => 'B53C',
+                MANUFACTURER => 'Seagate',
+                MODEL        => 'ST9146803SS',
+                device       => '/dev/sg3',
+            },
+            {
+                SIZE         => '139264',
+                NAME         => 'foo',
+                FIRMWARE     => 'C610',
+                MANUFACTURER => 'CBRCA146C3ETS0 N',
+                MODEL        => 'CBRCA146C3ETS0 N',
+                device       => '/dev/sg2',
+            },
+            {
+                SIZE         => '139264',
+                NAME         => 'foo',
+                FIRMWARE     => 'C610',
+                MANUFACTURER => 'CBRCA146C3ETS0 N',
+                MODEL        => 'CBRCA146C3ETS0 N',
+                device       => '/dev/sg1',
+            },
+            {
+                SIZE         => '139264',
+                NAME         => 'foo',
+                FIRMWARE     => 'C610',
+                MANUFACTURER => 'CBRCA146C3ETS0 N',
+                MODEL        => 'CBRCA146C3ETS0 N',
+                device       => '/dev/sg0',
+            }
+        ]
+    }
+);
+
+plan tests => scalar keys %tests;
+
+foreach my $test (keys %tests) {
+    my $file = "resources/linux/mpt-status/$test";
+    my @disks = FusionInventory::Agent::Task::Inventory::Input::Linux::Storages::Lsilogic::_getDiskFromMptStatus(
+        file       => $file,
+        name       => $tests{$test}->{name},
+    );
+    is_deeply(\@disks, $tests{$test}->{disks}, $test);
+}
diff --git a/t/tools/generic.t b/t/tools/generic.t
index 42f4c6d..16f053e 100755
--- a/t/tools/generic.t
+++ b/t/tools/generic.t
@@ -5894,7 +5894,7 @@ my %cpu_tests = (
         {
             ID             => '42 0F 10 00 FF FB 8B 07',
             NAME           => undef,
-            SPEED          => '30000',
+            SPEED          => '2300',
             THREAD         => undef,
             SERIAL         => undef,
             MANUFACTURER   => 'AuthenticAMD',
diff --git a/t/tools/linux.t b/t/tools/linux.t
index 9ca970d..94276cc 100755
--- a/t/tools/linux.t
+++ b/t/tools/linux.t
@@ -533,7 +533,24 @@ my %hal_tests = (
 );
 
 my %smartctl_tests = (
-    'dell-xt2' => 'DFW1W11002SE002B3117'
+    sample1 => {
+        TYPE         => 'disk',
+        DESCRIPTION  => 'SATA',
+        SERIALNUMBER => 'DFW1W11002SE002B3117'
+    },
+    sample2 => {
+        TYPE         => 'disk',
+        DESCRIPTION  => 'SATA'
+    },
+    sample3 => {
+        TYPE         => 'disk',
+        DESCRIPTION  => 'SAS',
+        SERIALNUMBER => '3LM0L0FJ00009733Y46W',
+    },
+    sample4 => {
+        TYPE         => 'enclosure',
+        DESCRIPTION  => 'SATA'
+    },
 );
 
 my %ifconfig_tests = (
@@ -879,8 +896,8 @@ foreach my $test (keys %hal_tests) {
 
 foreach my $test (keys %smartctl_tests) {
     my $file = "resources/linux/smartctl/$test";
-    my $result = getSerialnumber(file => $file);
-    is($result, $smartctl_tests{$test}, "$test smartctl parsing");
+    my $result = getInfoFromSmartctl(file => $file);
+    is_deeply($result, $smartctl_tests{$test}, "$test smartctl parsing");
 }
 
 foreach my $test (keys %ifconfig_tests) {


================================================================
Compare: https://github.com/fusinv/fusioninventory-agent/compare/dcb3d56...ad57d4d


More information about the Fusioninventory-commit mailing list