diff --git a/src/org.freedesktop.UPower.PowerProfiles.xml b/src/org.freedesktop.UPower.PowerProfiles.xml deleted file mode 100644 index 49535b8..0000000 --- a/src/org.freedesktop.UPower.PowerProfiles.xml +++ /dev/null @@ -1,140 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/src/power-profiles-daemon.c b/src/power-profiles-daemon.c index ea5ccaf..cd8fe09 100644 --- a/src/power-profiles-daemon.c +++ b/src/power-profiles-daemon.c @@ -121,10 +121,17 @@ typedef enum { PROP_PROFILES = 1 << 2, PROP_ACTIONS = 1 << 3, PROP_DEGRADED = 1 << 4, - PROP_ACTIVE_PROFILE_HOLDS = 1 << 5 + PROP_ACTIVE_PROFILE_HOLDS = 1 << 5, + PROP_VERSION = 1 << 6, } PropertiesMask; -#define PROP_ALL (PROP_ACTIVE_PROFILE | PROP_INHIBITED | PROP_PROFILES | PROP_ACTIONS | PROP_DEGRADED | PROP_ACTIVE_PROFILE_HOLDS) +#define PROP_ALL (PROP_ACTIVE_PROFILE | \ + PROP_INHIBITED | \ + PROP_PROFILES | \ + PROP_ACTIONS | \ + PROP_DEGRADED | \ + PROP_ACTIVE_PROFILE_HOLDS | \ + PROP_VERSION) static gboolean driver_profile_support (PpdDriver *driver, @@ -310,6 +317,10 @@ send_dbus_event_iface (PpdApp *data, g_variant_builder_add (&props_builder, "{sv}", "ActiveProfileHolds", get_profile_holds_variant (data)); } + if (mask & PROP_VERSION) { + g_variant_builder_add (&props_builder, "{sv}", "Version", + g_variant_new_string (VERSION)); + } props_changed = g_variant_new ("(s@a{sv}@as)", iface, g_variant_builder_end (&props_builder), @@ -831,6 +842,8 @@ handle_get_property (GDBusConnection *connection, } if (g_strcmp0 (property_name, "ActiveProfileHolds") == 0) return get_profile_holds_variant (data); + if (g_strcmp0 (property_name, "Version") == 0) + return g_variant_new_string (VERSION); return NULL; } diff --git a/src/power-profiles-daemon.dbus.xml.in b/src/power-profiles-daemon.dbus.xml.in index 0888b15..04cfa72 100644 --- a/src/power-profiles-daemon.dbus.xml.in +++ b/src/power-profiles-daemon.dbus.xml.in @@ -136,5 +136,12 @@ --> + + + diff --git a/src/powerprofilesctl.in b/src/powerprofilesctl.in index c2ae485..1748170 100755 --- a/src/powerprofilesctl.in +++ b/src/powerprofilesctl.in @@ -92,8 +92,6 @@ def usage(_command=None): else: usage_main() -def version(): - print (VERSION) def get_proxy(): try: @@ -104,6 +102,11 @@ def get_proxy(): raise return proxy +def version(): + proxy = get_proxy() + ver = proxy.Get('(ss)', PP_IFACE, 'Version') + print(ver) + def _get(): proxy = get_proxy() profile = proxy.Get('(ss)', PP_IFACE, 'ActiveProfile') diff --git a/tests/integration_test.py b/tests/integration_test.py index 8a2d704..1bce399 100644 --- a/tests/integration_test.py +++ b/tests/integration_test.py @@ -1949,6 +1949,11 @@ class Tests(dbusmock.DBusTestCase): self.stop_daemon() + def test_get_version_prop(self): + """Checks that the version property is advertised""" + self.start_daemon() + self.assertTrue(self.get_dbus_property("Version")) + def test_intel_pstate_noturbo(self): """Intel P-State driver (balance)"""