- # maybe this needs to be replaced by an external list.
- friendlyNames = {
- "eth0": _("Integrated Ethernet"),
- "wlan0": _("Wireless"),
- "ath0": _("Integrated Wireless")
- }
- return friendlyNames.get(x, x) # when we have no friendly name, use adapter name
+ if x in self.friendlyNames.keys():
+ return self.friendlyNames.get(x, x)
+ else:
+ self.friendlyNames[x] = self.getFriendlyAdapterNaming(x)
+ return self.friendlyNames.get(x, x) # when we have no friendly name, use adapter name
+
+ def getFriendlyAdapterNaming(self, iface):
+ if iface.startswith('eth'):
+ if iface not in self.lan_interfaces and len(self.lan_interfaces) == 0:
+ self.lan_interfaces.append(iface)
+ return _("LAN connection")
+ elif iface not in self.lan_interfaces and len(self.lan_interfaces) >= 1:
+ self.lan_interfaces.append(iface)
+ return _("LAN connection") + " " + str(len(self.lan_interfaces))
+ else:
+ if iface not in self.wlan_interfaces and len(self.wlan_interfaces) == 0:
+ self.wlan_interfaces.append(iface)
+ return _("WLAN connection")
+ elif iface not in self.wlan_interfaces and len(self.wlan_interfaces) >= 1:
+ self.wlan_interfaces.append(iface)
+ return _("WLAN connection") + " " + str(len(self.wlan_interfaces))
+
+ def getFriendlyAdapterDescription(self, iface):
+ if not self.isWirelessInterface(iface):
+ return _('Ethernet network interface')
+
+ moduledir = self.sysfsPath(iface) + '/device/driver/module'
+ if not os_path.isdir(moduledir):
+ tmpfiles = listdir(self.sysfsPath(iface) + '/device')
+ for x in tmpfiles:
+ if x.startswith("1-"):
+ moduledir = self.sysfsPath(iface) + '/device/' + x + '/driver/module'
+
+ if os_path.isdir(moduledir):
+ name = os_path.basename(os_path.realpath(moduledir))
+ if name in ('ath_pci','ath5k'):
+ name = 'Atheros'
+ elif name in ('rt73','rt73usb','rt3070sta'):
+ name = 'Ralink'
+ elif name == 'zd1211b':
+ name = 'Zydas'
+ else:
+ name = _('Unknown')
+
+ return name + ' ' + _('wireless network interface')