From 5992d94c85f8e07869487c4671395168b6526870 Mon Sep 17 00:00:00 2001 From: rafspiny Date: Sat, 19 Aug 2023 20:10:26 +0200 Subject: [PATCH] Silly me. Order! --- src/modules/convertible/dbus_acceleration.c | 66 ++++++++++----------- 1 file changed, 33 insertions(+), 33 deletions(-) diff --git a/src/modules/convertible/dbus_acceleration.c b/src/modules/convertible/dbus_acceleration.c index e5fc6f602..4d41d0d04 100644 --- a/src/modules/convertible/dbus_acceleration.c +++ b/src/modules/convertible/dbus_acceleration.c @@ -11,6 +11,39 @@ static DbusAccelerometer* accelerometer_dbus; +/** + * Helper to get the interface + * */ +static Eldbus_Proxy * +get_dbus_interface(const char *IFACE) +{ + DBG("Working on interface: %s", IFACE); + Eldbus_Connection *conn; + Eldbus_Object *obj; + Eldbus_Proxy *sensor_proxy; + + conn = eldbus_connection_get(ELDBUS_CONNECTION_TYPE_SYSTEM); + if (!conn) + { + ERR("Error: could not get system bus"); + return NULL; + } + obj = eldbus_object_get(conn, EFL_DBUS_ACC_BUS, EFL_DBUS_ACC_PATH); + if (!obj) + { + ERR("Error: could not get object"); + return NULL; + } + sensor_proxy = eldbus_proxy_get(obj, IFACE); + if (!sensor_proxy) + { + ERR("Error: could not get proxy for interface %s", IFACE); + return NULL; + } + + return sensor_proxy; +} + /** * Helper function to extract ta boolean property from the message * @param msg The message coming from the get property invocation @@ -194,39 +227,6 @@ _convertible_rotation_get(const enum screen_rotation orientation); int _is_device_a_touch_pointer(int dev_counter, int num_properties, char **iterator); -/** - * Helper to get the interface - * */ -static Eldbus_Proxy * -get_dbus_interface(const char *IFACE) -{ - DBG("Working on interface: %s", IFACE); - Eldbus_Connection *conn; - Eldbus_Object *obj; - Eldbus_Proxy *sensor_proxy; - - conn = eldbus_connection_get(ELDBUS_CONNECTION_TYPE_SYSTEM); - if (!conn) - { - ERR("Error: could not get system bus"); - return NULL; - } - obj = eldbus_object_get(conn, EFL_DBUS_ACC_BUS, EFL_DBUS_ACC_PATH); - if (!obj) - { - ERR("Error: could not get object"); - return NULL; - } - sensor_proxy = eldbus_proxy_get(obj, IFACE); - if (!sensor_proxy) - { - ERR("Error: could not get proxy for interface %s", IFACE); - return NULL; - } - - return sensor_proxy; -} - /** * Helper function to extract ta string property from the message * @param msg The message coming from the get property invocation