How to use the jeepney.bus_messages function in jeepney

To help you get started, we’ve selected a few jeepney examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github amezin / amdgpu-tweakd / amdgpu_tweakd / daemon.py View on Github external
update_loop_task.cancel()
        else:
            wake_event.set()
            logging.info("Woke up")

    _, dbus_proto = await jeepney.integrate.asyncio.connect_and_authenticate('SYSTEM')
    dbus_bus = jeepney.integrate.asyncio.Proxy(jeepney.bus_messages.message_bus, dbus_proto)

    dbus_proto.router.subscribe_signal(
        callback=lambda args: prepare_for_sleep(*args),
        path='/org/freedesktop/login1',
        interface='org.freedesktop.login1.Manager',
        member='PrepareForSleep'
    )

    await dbus_bus.AddMatch(jeepney.bus_messages.MatchRule(
        type='signal',
        sender='org.freedesktop.login1',
        interface='org.freedesktop.login1.Manager',
        member='PrepareForSleep',
        path='/org/freedesktop/login1'
    ))

    while True:
        logging.info("Waiting for wake event")
        await wake_event.wait()
        logging.info("Starting update loop")
        update_loop_task = asyncio.ensure_future(update_loop(config, udev))
        try:
            await update_loop_task
        except asyncio.CancelledError:
            logging.info("Stopped update loop")
github amezin / amdgpu-tweakd / radeon_fan_control.py View on Github external
update_loop_task.cancel()
        else:
            wake_event.set()
            logging.info("Woke up")

    _, dbus_proto = await jeepney.integrate.asyncio.connect_and_authenticate('SYSTEM')
    dbus_bus = jeepney.integrate.asyncio.Proxy(jeepney.bus_messages.message_bus, dbus_proto)

    dbus_proto.router.subscribe_signal(
        callback=lambda args: prepare_for_sleep(*args),
        path='/org/freedesktop/login1',
        interface='org.freedesktop.login1.Manager',
        member='PrepareForSleep'
    )

    await dbus_bus.AddMatch(jeepney.bus_messages.MatchRule(
        type='signal',
        sender='org.freedesktop.login1',
        interface='org.freedesktop.login1.Manager',
        member='PrepareForSleep',
        path='/org/freedesktop/login1'
    ))

    while True:
        logging.info("Waiting for wake event")
        await wake_event.wait()
        logging.info("Starting update loop")
        update_loop_task = asyncio.ensure_future(update_loop(config, udev))
        try:
            await update_loop_task
        except asyncio.CancelledError:
            logging.info("Stopped update loop")