summaryrefslogtreecommitdiff
path: root/src/lib/elput/elput_logind.c
diff options
context:
space:
mode:
authorDerek Foreman <derekf@osg.samsung.com>2017-05-31 14:16:36 -0500
committerDerek Foreman <derekf@osg.samsung.com>2017-05-31 14:16:36 -0500
commitb53d1e29f1f240c0a30a5751acb09636a49e82ed (patch)
tree3a672ce68d32a4ebea8a3b2d1fb315b6370e6332 /src/lib/elput/elput_logind.c
parentcb1d53c835ef465b870d76850beb0f65b7871753 (diff)
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/elput_logind.c')
-rw-r--r--src/lib/elput/elput_logind.c53
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)
162} 162}
163 163
164static Eina_Bool 164static Eina_Bool
165_logind_session_object_path_get(Elput_Manager *em)
166{
167 Eldbus_Message *msg, *reply;
168 Eldbus_Object *obj;
169 Eldbus_Proxy *proxy;
170 const char *errname, *errmsg;
171 char *str;
172 Eina_Bool ret = EINA_FALSE;
173
174 obj =
175 eldbus_object_get(em->dbus.conn, "org.freedesktop.login1",
176 "/org/freedesktop/login1");
177 if (!obj) return EINA_FALSE;
178
179 proxy = eldbus_proxy_get(obj, "org.freedesktop.login1.Manager");
180 if (!proxy) goto proxy_fail;
181
182 msg = eldbus_proxy_method_call_new(proxy, "GetSession");
183 if (!msg)
184 {
185 ERR("Could not create method call for proxy");
186 goto message_fail;
187 }
188
189 eldbus_message_arguments_append(msg, "s", em->sid);
190
191 reply = eldbus_proxy_send_and_block(proxy, msg, -1);
192 if (eldbus_message_error_get(reply, &errname, &errmsg))
193 {
194 ERR("Eldbus Message Error: %s %s", errname, errmsg);
195 eldbus_message_unref(reply);
196 goto message_fail;
197 }
198 if (!eldbus_message_arguments_get(reply, "o", &str))
199 goto message_fail;
200
201 em->dbus.path = strdup(str);
202 eldbus_message_unref(reply);
203 ret = EINA_TRUE;
204
205message_fail:
206 eldbus_proxy_unref(proxy);
207proxy_fail:
208 eldbus_object_unref(obj);
209 return ret;
210}
211
212static Eina_Bool
165_logind_dbus_setup(Elput_Manager *em) 213_logind_dbus_setup(Elput_Manager *em)
166{ 214{
167 Eldbus_Proxy *proxy; 215 Eldbus_Proxy *proxy;
168 int ret = 0;
169 216
170 ret = asprintf(&em->dbus.path, 217 if (!_logind_session_object_path_get(em)) return EINA_FALSE;
171 "/org/freedesktop/login1/session/%s", em->sid);
172 if (ret < 0) return EINA_FALSE;
173 218
174 em->dbus.obj = 219 em->dbus.obj =
175 eldbus_object_get(em->dbus.conn, "org.freedesktop.login1", 220 eldbus_object_get(em->dbus.conn, "org.freedesktop.login1",