[Uludag-commits] r6837 - trunk/comar/betikler

svn-uludag at uludag.org.tr svn-uludag at uludag.org.tr
5 Nis 2006 Çar 16:17:15 EEST


Author: gurer
Date: Wed Apr  5 16:17:14 2006
New Revision: 6837

Modified:
   trunk/comar/betikler/link-wifi.py
   trunk/comar/betikler/link.py
Log:
yeni apiyi kullanmaya başla


Modified: trunk/comar/betikler/link-wifi.py
=================================================================
--- trunk/comar/betikler/link-wifi.py	(original)
+++ trunk/comar/betikler/link-wifi.py	Wed Apr  5 16:17:14 2006
@@ -18,7 +18,7 @@
 import csapi
 import popen2
 from glob import glob
-
+from comar.device import idsQuery
 
 def capture(cmd):
     out = []
@@ -432,42 +432,11 @@
 
 def queryUSB(vendor, device):
     # dependency to pciutils!
-    f = file("/usr/share/misc/usb.ids")
-    flag = 0
-    company = ""
-    for line in f.readlines():
-        if flag == 0:
-            if line.startswith(vendor):
-                flag = 1
-                company = line[5:].strip()
-        else:
-            if line.startswith("\t"):
-                if line.startswith("\t" + device):
-                    return "%s - %s" % (line[6:].strip(), company)
-            elif not line.startswith("#"):
-                flag = 0
-    if company != "":
-        return "%s (%s)" % (company, device)
-    else:
-        return "Unknown (%s:%s)" % (vendor, device)
+    return idsQuery("/usr/share/misc/usb.ids", vendor, device)
 
 def queryPCI(vendor, device):
     # dependency to pciutils!
-    f = file("/usr/share/misc/pci.ids")
-    flag = 0
-    company = ""
-    for line in f.readlines():
-        if flag == 0:
-            if line.startswith(vendor):
-                flag = 1
-                company = line[5:].strip()
-        else:
-            if line.startswith("\t"):
-                if line.startswith("\t" + device):
-                    return "%s - %s" % (line[6:].strip(), company)
-            elif not line.startswith("#"):
-                flag = 0
-    return "Unknown (%s:%s)" % (vendor, device)
+    return idsQuery("/usr/share/misc/pci.ids", vendor, device)
 
 
 class Scanner:

Modified: trunk/comar/betikler/link.py
=================================================================
--- trunk/comar/betikler/link.py	(original)
+++ trunk/comar/betikler/link.py	Wed Apr  5 16:17:14 2006
@@ -17,6 +17,7 @@
 import csapi
 import popen2
 from glob import glob
+from comar.device import idsQuery
 
 class ifconfig:
     """ ioctl stuff """
@@ -298,42 +299,11 @@
 
 def queryUSB(vendor, device):
     # dependency to pciutils!
-    f = file("/usr/share/misc/usb.ids")
-    flag = 0
-    company = ""
-    for line in f.readlines():
-        if flag == 0:
-            if line.startswith(vendor):
-                flag = 1
-                company = line[5:].strip()
-        else:
-            if line.startswith("\t"):
-                if line.startswith("\t" + device):
-                    return "%s - %s" % (line[6:].strip(), company)
-            elif not line.startswith("#"):
-                flag = 0
-    if company != "":
-        return "%s (%s)" % (company, device)
-    else:
-        return "Unknown (%s:%s)" % (vendor, device)
+    return idsQuery("/usr/share/misc/usb.ids", vendor, device)
 
 def queryPCI(vendor, device):
     # dependency to pciutils!
-    f = file("/usr/share/misc/pci.ids")
-    flag = 0
-    company = ""
-    for line in f.readlines():
-        if flag == 0:
-            if line.startswith(vendor):
-                flag = 1
-                company = line[5:].strip()
-        else:
-            if line.startswith("\t"):
-                if line.startswith("\t" + device):
-                    return "%s - %s" % (line[6:].strip(), company)
-            elif not line.startswith("#"):
-                flag = 0
-    return "Unknown (%s:%s)" % (vendor, device)
+    return idsQuery("/usr/share/misc/pci.ids", vendor, device)
 
 # Internal functions
 


Uludag-commits mesaj listesiyle ilgili daha fazla bilgi