diff options
author | Derek Foreman <derekf@osg.samsung.com> | 2017-05-31 14:16:36 -0500 |
---|---|---|
committer | Derek Foreman <derekf@osg.samsung.com> | 2017-05-31 14:16:36 -0500 |
commit | b53d1e29f1f240c0a30a5751acb09636a49e82ed (patch) | |
tree | 3a672ce68d32a4ebea8a3b2d1fb315b6370e6332 /src/lib/elput | |
parent | cb1d53c835ef465b870d76850beb0f65b7871753 (diff) | |
download | efl-b53d1e29f1f240c0a30a5751acb09636a49e82ed.tar.gz |
elput: Fix logind session object path
We're supposed to query the path for a session id instead of just
making up the string ourselves.
Fixes all input devices being dead after a vc switch for some users.
Diffstat (limited to 'src/lib/elput')
-rw-r--r-- | src/lib/elput/elput_logind.c | 53 |
1 files changed, 49 insertions, 4 deletions
diff --git a/src/lib/elput/elput_logind.c b/src/lib/elput/elput_logind.c index cfce90e3aa..e93633edc1 100644 --- a/src/lib/elput/elput_logind.c +++ b/src/lib/elput/elput_logind.c @@ -162,14 +162,59 @@ _logind_dbus_close(Eldbus_Connection *conn) } static Eina_Bool +_logind_session_object_path_get(Elput_Manager *em) +{ + Eldbus_Message *msg, *reply; + Eldbus_Object *obj; + Eldbus_Proxy *proxy; + const char *errname, *errmsg; + char *str; + Eina_Bool ret = EINA_FALSE; + + obj = + eldbus_object_get(em->dbus.conn, "org.freedesktop.login1", + "/org/freedesktop/login1"); + if (!obj) return EINA_FALSE; + + proxy = eldbus_proxy_get(obj, "org.freedesktop.login1.Manager"); + if (!proxy) goto proxy_fail; + + msg = eldbus_proxy_method_call_new(proxy, "GetSession"); + if (!msg) + { + ERR("Could not create method call for proxy"); + goto message_fail; + } + + eldbus_message_arguments_append(msg, "s", em->sid); + + reply = eldbus_proxy_send_and_block(proxy, msg, -1); + if (eldbus_message_error_get(reply, &errname, &errmsg)) + { + ERR("Eldbus Message Error: %s %s", errname, errmsg); + eldbus_message_unref(reply); + goto message_fail; + } + if (!eldbus_message_arguments_get(reply, "o", &str)) + goto message_fail; + + em->dbus.path = strdup(str); + eldbus_message_unref(reply); + ret = EINA_TRUE; + +message_fail: + eldbus_proxy_unref(proxy); +proxy_fail: + eldbus_object_unref(obj); + return ret; +} + +static Eina_Bool _logind_dbus_setup(Elput_Manager *em) { Eldbus_Proxy *proxy; - int ret = 0; - ret = asprintf(&em->dbus.path, - "/org/freedesktop/login1/session/%s", em->sid); - if (ret < 0) return EINA_FALSE; + if (!_logind_session_object_path_get(em)) return EINA_FALSE; em->dbus.obj = eldbus_object_get(em->dbus.conn, "org.freedesktop.login1", |