Skip to content

Commit

Permalink
NetworkManager template: set "StateReason" for SetDeviceActive()/SetD…
Browse files Browse the repository at this point in the history
…eviceDisconnected() (#57)

We need to set the "StateReason". See commit 776b131 ('NetworkManager
template: add "StateReason" property to devices (#55)') for the reasons.

See-also: https://gitlab.freedesktop.org/NetworkManager/NetworkManager/commit/ec39498fc6d70cf6887f08b4dfbc5cff021fc231
See-also: #55
See-also: https://gitlab.freedesktop.org/NetworkManager/NetworkManager/issues/313
  • Loading branch information
thom311 authored and martinpitt committed Dec 22, 2019
1 parent 1c72307 commit bd51d91
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions dbusmock/templates/networkmanager.py
Expand Up @@ -279,6 +279,7 @@ def SetDeviceActive(self, device_path, active_connection_path):
dev_obj.Set(DEVICE_IFACE, 'ActiveConnection', dbus.ObjectPath(active_connection_path))
old_state = dev_obj.Get(DEVICE_IFACE, 'State')
dev_obj.Set(DEVICE_IFACE, 'State', dbus.UInt32(DeviceState.ACTIVATED))
dev_obj.Set(DEVICE_IFACE, 'StateReason', (dbus.UInt32(DeviceState.ACTIVATED), dbus.UInt32(0)))

dev_obj.EmitSignal(DEVICE_IFACE, 'StateChanged', 'uuu', [dbus.UInt32(DeviceState.ACTIVATED), old_state, dbus.UInt32(1)])

Expand All @@ -290,6 +291,7 @@ def SetDeviceDisconnected(self, device_path):
dev_obj.Set(DEVICE_IFACE, 'ActiveConnection', dbus.ObjectPath('/'))
old_state = dev_obj.Get(DEVICE_IFACE, 'State')
dev_obj.Set(DEVICE_IFACE, 'State', dbus.UInt32(DeviceState.DISCONNECTED))
dev_obj.Set(DEVICE_IFACE, 'StateReason', (dbus.UInt32(DeviceState.DISCONNECTED), dbus.UInt32(0)))

dev_obj.EmitSignal(DEVICE_IFACE, 'StateChanged', 'uuu', [dbus.UInt32(DeviceState.DISCONNECTED), old_state, dbus.UInt32(1)])

Expand Down

0 comments on commit bd51d91

Please sign in to comment.