Comment 0 for bug 1732850

Revision history for this message
Joel Barrios (darkshram) wrote : Wrong variant in CanSusoend and CanHibernate in ConsoleKit2 support.

Systems using ConsoleKit2 instead of SystemD o elogind cannot suspend or hibernate from LightDM 1.24.0.

According to ConsoleKit2 documentation:

...
CanSuspend (out 's' can_suspend)
...
CanHibernate (out 's' can_hibernate)
...

But the code in liblightdm-gobject/power.c uses 'b':

        r = ck_call_function ("CanSuspend", NULL, NULL);
        if (r && g_variant_is_of_type (r, G_VARIANT_TYPE ("(b)")))
            g_variant_get (r, "(b)", &can_suspend);

       r = ck_call_function ("CanHibernate", NULL, NULL);
        if (r && g_variant_is_of_type (r, G_VARIANT_TYPE ("(b)")))
            g_variant_get (r, "(b)", &can_hibernate);

After changing "(b)" with "(s)", LightDM 1.24.0 can suspend an hibernate again in systems with ConsoleKit2.

        r = ck_call_function ("CanSuspend", NULL, NULL);
        if (r && g_variant_is_of_type (r, G_VARIANT_TYPE ("(s)")))
            g_variant_get (r, "(s)", &can_suspend);

       r = ck_call_function ("CanHibernate", NULL, NULL);
        if (r && g_variant_is_of_type (r, G_VARIANT_TYPE ("(s)")))
            g_variant_get (r, "(s)", &can_hibernate);