events: fix D-Bus proxy by introspecting before use
Major skill issue on my behalf. Passing `None` as the introspection XML to `get_proxy_object()` skips interface generation... Signed-off-by: NotAShelf <raf@notashelf.dev> Change-Id: Iebccb4d7ef68a406c05f2b3dec4732f66a6a6964
This commit is contained in:
parent
8868962b05
commit
d13884e949
1 changed files with 6 additions and 2 deletions
|
|
@ -31,15 +31,19 @@ class PoweroffEvent(Event):
|
||||||
|
|
||||||
bus = await MessageBus(bus_type=BusType.SYSTEM).connect()
|
bus = await MessageBus(bus_type=BusType.SYSTEM).connect()
|
||||||
try:
|
try:
|
||||||
|
introspection = await bus.introspect(
|
||||||
|
"org.freedesktop.login1",
|
||||||
|
"/org/freedesktop/login1",
|
||||||
|
)
|
||||||
proxy = bus.get_proxy_object(
|
proxy = bus.get_proxy_object(
|
||||||
"org.freedesktop.login1",
|
"org.freedesktop.login1",
|
||||||
"/org/freedesktop/login1",
|
"/org/freedesktop/login1",
|
||||||
None,
|
introspection,
|
||||||
)
|
)
|
||||||
manager = proxy.get_interface("org.freedesktop.login1.Manager")
|
manager = proxy.get_interface("org.freedesktop.login1.Manager")
|
||||||
await manager.call_power_off(False)
|
await manager.call_power_off(False)
|
||||||
finally:
|
finally:
|
||||||
await bus.disconnect()
|
bus.disconnect()
|
||||||
|
|
||||||
|
|
||||||
class EventRegistry:
|
class EventRegistry:
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue