diff --git a/includes/functions.php b/includes/functions.php index 138dfae8f..6f172ce61 100755 --- a/includes/functions.php +++ b/includes/functions.php @@ -766,4 +766,15 @@ function formatCiscoHardware(&$device, $short = false) } } } + +# from http://ditio.net/2008/11/04/php-string-to-hex-and-hex-to-string-functions/ +function hex2str($hex) +{ + $string=''; + for ($i=0; $i < strlen($hex)-1; $i+=2) + { + $string .= chr(hexdec($hex[$i].$hex[$i+1])); + } + return $string; +} ?> diff --git a/includes/polling/device-areca.inc.php b/includes/polling/device-areca.inc.php index d39eedcec..f2807360f 100644 --- a/includes/polling/device-areca.inc.php +++ b/includes/polling/device-areca.inc.php @@ -8,5 +8,11 @@ if (!$version) { $version = trim(snmp_get($device, "1.3.6.1.4.1.18928.1.2.1.4.0" $serial = trim(snmp_get($device, "1.3.6.1.4.1.18928.1.1.1.3.0", "-OQv", "", ""),'"'); if (!$serial) { $serial = trim(snmp_get($device, "1.3.6.1.4.1.18928.1.2.1.3.0", "-OQv", "", ""),'"'); } + +if (strstr($serial,' ')) +{ + # Sometimes firmware outputs serial as hex-string + $serial = hex2str(str_replace(' ','',str_replace(' 00','',$serial))); +} ?>