diff options
Diffstat (limited to 'h-source/Application/Include/vendors.php')
-rw-r--r-- | h-source/Application/Include/vendors.php | 19 |
1 files changed, 13 insertions, 6 deletions
diff --git a/h-source/Application/Include/vendors.php b/h-source/Application/Include/vendors.php index 79fcefb..8dcc312 100644 --- a/h-source/Application/Include/vendors.php +++ b/h-source/Application/Include/vendors.php @@ -3,24 +3,28 @@ class Vendors { - public static function getName($id) + public static function getName($id,$interface) { - if (self::check($id)) + if (self::check($id,$interface)) { + $idArray = strcmp($interface,'USB') === 0 ? self::$usbId : self::$pciId; + $temp = explode(':',$id); $vendorId = $temp[0]; - return self::$id[$vendorId]; + return $idArray[$vendorId]; } return 'not-known'; } - public static function check($id) + public static function check($id,$interface = 'USB') { if (preg_match('/^[a-zA-Z0-9]{4}(\:)[a-zA-Z0-9]{4}$/',$id)) { + $idArray = strcmp($interface,'USB') === 0 ? self::$usbId : self::$pciId; + $temp = explode(':',$id); $vendorId = $temp[0]; - if (array_key_exists($vendorId,self::$id)) + if (array_key_exists($vendorId,$idArray)) { return true; } @@ -28,7 +32,7 @@ class Vendors return false; } - public static $id = array( + public static $pciId = array( '0010' => 'Allied-Telesis-Inc', '001a' => 'Ascend-Communications-Inc.', '001c' => 'PEAK-System-Technik-GmbH', @@ -1802,6 +1806,9 @@ class Vendors 'feda' => 'Broadcom', 'fede' => 'Fedetec-Inc.', 'fffd' => 'XenSource-Inc.', + ); + + public static $usbId = array( '0001' => 'Frys-Electronics', '0002' => 'Ingram', '0003' => 'Club-Mac', |