Code

* Convert vendorId and productId to lower case. Udev-rules only match if vendorId...
[gosa.git] / trunk / gosa-plugins / goto / admin / devices / class_deviceGeneric.inc
index 0448b3bde477c104852c65bfc142a2dcb5f575ea..b8b91e2ccc2f94b2d0f734980dd1bcd9addaaf8b 100644 (file)
@@ -100,12 +100,15 @@ class deviceGeneric extends plugin
       $message[]= msgPool::required(_("iSerial"));
     }
     if(empty($this->serial) || !$this->is_2byteHex($this->serial)){
-      $message[]= msgPool::invalid(_("Serial"),"","","0x1234");
+      $message[]= msgPool::invalid(_("Product ID"),"","","0x1234");
     }
     if(empty($this->vendor) || !$this->is_2byteHex($this->vendor)){
       $message[]= msgPool::invalid(_("Vendor ID"),"","","0x1234");
     }
-  
+    /* Convert vendorId and productId to lower case */
+    $this->serial = strtolower($this->serial);
+    $this->vendor = strtolower($this->vendor);
+
     /* Check if entry already exists */ 
     if($this->cn != $this->orig_cn || $this->dn == "new"){
       $ldap = $this->config->get_ldap_link();
@@ -201,7 +204,7 @@ class deviceGeneric extends plugin
   /* check if given str in like this 0xffff*/
   function is_2byteHex($str)
   {
-    return !strlen($str) || preg_match("/^(0x|x|)[a-f0-9][a-f0-9][a-f0-9][a-f0-9]/i",$str);
+    return !strlen($str) || preg_match("/^(0x|)[A-Fa-f0-9]{4}$/i",$str);
   }