- if not os_path.isdir(moduledir):
- tmpfiles = listdir(devicedir)
- moduledir_found = False
- for x in tmpfiles:
- if x.startswith("1-"):
- moduledir_found = True
- moduledir = devicedir + '/' + x + '/driver/module'
- if not moduledir_found:
- moduledir_found = True
- if os_path.isdir(devicedir + '/driver'):
- moduledir = devicedir + '/driver'
-
- return moduledir
+ if os_path.isdir(moduledir):
+ return moduledir
+
+ # identification is not possible over default moduledir
+ for x in listdir(devicedir):
+ # rt3070 on kernel 2.6.18 registers wireless devices as usb_device (e.g. 1-1.3:1.0) and identification is only possible over /sys/class/net/'ifacename'/device/1-xxx
+ if x.startswith("1-"):
+ moduledir = devicedir + '/' + x + '/driver/module'
+ if os_path.isdir(moduledir):
+ return moduledir
+ # rt73, zd1211b, r871x_usb_drv on kernel 2.6.12 can be identified over /sys/class/net/'ifacename'/device/driver, so look also here
+ moduledir = devicedir + '/driver'
+ if os_path.isdir(moduledir):
+ return moduledir
+
+ return None