Skip to content

Commit bd51d91

Browse files
thom311martinpitt
authored andcommitted
NetworkManager template: set "StateReason" for SetDeviceActive()/SetDeviceDisconnected() (#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
1 parent 1c72307 commit bd51d91

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

dbusmock/templates/networkmanager.py

+2
Original file line numberDiff line numberDiff line change
@@ -279,6 +279,7 @@ def SetDeviceActive(self, device_path, active_connection_path):
279279
dev_obj.Set(DEVICE_IFACE, 'ActiveConnection', dbus.ObjectPath(active_connection_path))
280280
old_state = dev_obj.Get(DEVICE_IFACE, 'State')
281281
dev_obj.Set(DEVICE_IFACE, 'State', dbus.UInt32(DeviceState.ACTIVATED))
282+
dev_obj.Set(DEVICE_IFACE, 'StateReason', (dbus.UInt32(DeviceState.ACTIVATED), dbus.UInt32(0)))
282283

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

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

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

0 commit comments

Comments
 (0)