It appears that fix is not in the latest 2.1:
WIFI_P2P devices #72
One of the suggestions I would make is making sure that a dictionary lookup doesn't crash like so:
def device_class(typ):
return {
NM_DEVICE_TYPE_ADSL: Adsl,
NM_DEVICE_TYPE_BOND: Bond,
NM_DEVICE_TYPE_BRIDGE: Bridge,
NM_DEVICE_TYPE_BT: Bluetooth,
NM_DEVICE_TYPE_ETHERNET: Wired,
NM_DEVICE_TYPE_GENERIC: Generic,
NM_DEVICE_TYPE_INFINIBAND: Infiniband,
NM_DEVICE_TYPE_IP_TUNNEL: IPTunnel,
NM_DEVICE_TYPE_MACVLAN: Macvlan,
NM_DEVICE_TYPE_MODEM: Modem,
NM_DEVICE_TYPE_OLPC_MESH: OlpcMesh,
NM_DEVICE_TYPE_TEAM: Team,
NM_DEVICE_TYPE_TUN: Tun,
NM_DEVICE_TYPE_VETH: Veth,
NM_DEVICE_TYPE_VLAN: Vlan,
NM_DEVICE_TYPE_VXLAN: Vxlan,
NM_DEVICE_TYPE_WIFI: Wireless,
NM_DEVICE_TYPE_WIMAX: Wimax,
NM_DEVICE_TYPE_MACSEC: MacSec,
NM_DEVICE_TYPE_DUMMY: Dummy,
NM_DEVICE_TYPE_PPP: PPP,
NM_DEVICE_TYPE_OVS_INTERFACE: OvsIf,
NM_DEVICE_TYPE_OVS_PORT: OvsPort,
NM_DEVICE_TYPE_OVS_BRIDGE: OvsBridge
}.get(typ,None)
Of course, I did realize something else needed a good value, so i had to change the following routine to catch error (Can't use None as an object):
def __new__(klass, object_path):
if klass == Device:
# Automatically specialize the device
try:
obj = dbus.SystemBus().get_object(klass.dbus_service, object_path)
klass = device_class(obj.Get('org.freedesktop.NetworkManager.Device', 'DeviceType', dbus_interface='org.freedesktop.DBus.Properties'))
return klass.__new__(klass, object_path)
except ObjectVanished:
pass
except TypeError:
return None
return super(Device, klass).__new__(klass, object_path)
It appears that fix is not in the latest 2.1:
WIFI_P2P devices #72
One of the suggestions I would make is making sure that a dictionary lookup doesn't crash like so:
def device_class(typ):
return {
NM_DEVICE_TYPE_ADSL: Adsl,
NM_DEVICE_TYPE_BOND: Bond,
NM_DEVICE_TYPE_BRIDGE: Bridge,
NM_DEVICE_TYPE_BT: Bluetooth,
NM_DEVICE_TYPE_ETHERNET: Wired,
NM_DEVICE_TYPE_GENERIC: Generic,
NM_DEVICE_TYPE_INFINIBAND: Infiniband,
NM_DEVICE_TYPE_IP_TUNNEL: IPTunnel,
NM_DEVICE_TYPE_MACVLAN: Macvlan,
NM_DEVICE_TYPE_MODEM: Modem,
NM_DEVICE_TYPE_OLPC_MESH: OlpcMesh,
NM_DEVICE_TYPE_TEAM: Team,
NM_DEVICE_TYPE_TUN: Tun,
NM_DEVICE_TYPE_VETH: Veth,
NM_DEVICE_TYPE_VLAN: Vlan,
NM_DEVICE_TYPE_VXLAN: Vxlan,
NM_DEVICE_TYPE_WIFI: Wireless,
NM_DEVICE_TYPE_WIMAX: Wimax,
NM_DEVICE_TYPE_MACSEC: MacSec,
NM_DEVICE_TYPE_DUMMY: Dummy,
NM_DEVICE_TYPE_PPP: PPP,
NM_DEVICE_TYPE_OVS_INTERFACE: OvsIf,
NM_DEVICE_TYPE_OVS_PORT: OvsPort,
NM_DEVICE_TYPE_OVS_BRIDGE: OvsBridge
}.get(typ,None)
Of course, I did realize something else needed a good value, so i had to change the following routine to catch error (Can't use None as an object):