Skip to content

Commit

Permalink
Drop sysinfod support
Browse files Browse the repository at this point in the history
The sysinfod service is provided by proprietary Nokia component
and the compatibility has already been disabled for almost two
years.

Since get_sysinfo_value() was the last place within mce itself
to use blocking dbus method calls, dropping support altogether
allows removal of blocking dbus call helpers too.
  • Loading branch information
spiiroin committed Aug 25, 2014
1 parent 2684574 commit fbe9f8a
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 48 deletions.
7 changes: 0 additions & 7 deletions Makefile
Expand Up @@ -87,9 +87,6 @@ ENABLE_WAKELOCKS ?= y
# Whether to enable cpu scaling governor policy
ENABLE_CPU_GOVERNOR ?= y

# Whether to enable sysinfod queries
ENABLE_SYSINFOD_QUERIES ?= n

# Whether to install systemd control files
ENABLE_SYSTEMD_SUPPORT ?= y

Expand Down Expand Up @@ -200,10 +197,6 @@ ifeq ($(strip $(ENABLE_CPU_GOVERNOR)),y)
CPPFLAGS += -DENABLE_CPU_GOVERNOR
endif

ifeq ($(strip $(ENABLE_SYSINFOD_QUERIES)),y)
CPPFLAGS += -DENABLE_SYSINFOD_QUERIES
endif

ifeq ($(ENABLE_SENSORFW),y)
CPPFLAGS += -DENABLE_SENSORFW
endif
Expand Down
47 changes: 10 additions & 37 deletions mce-hal.c
Expand Up @@ -117,45 +117,20 @@ static char *getenv_from_init_process(const char *key)
/**
* Retrieve a sysinfo value via D-Bus
*
* @param key The sysinfo key to retrieve
* @param[out] array A newly allocated byte array with the result;
* this array should to be freed when no longer used
* @param[out] len The length of the newly allocated string
* Note: The sysinfod service is provided proprietary Nokia component
* and is not supported in nemomobile. This function tries to
* handle some queries possibly made by mce on legacy Nokia hw
* by getting relevant information from environment variables.
*
* @param key The sysinfo key to retrieve
* @param[out] array A newly allocated byte array with the result;
* this array should to be freed when no longer used
* @param[out] len The length of the newly allocated string
*
* @return TRUE on success, FALSE on failure
*/
gboolean get_sysinfo_value(const gchar *const key, guint8 **array, gulong *len)
{
#ifdef ENABLE_SYSINFOD_QUERIES
DBusMessage *reply;
guint8 *tmp = NULL;
gboolean status = FALSE;

if ((reply = dbus_send_with_block(SYSINFOD_SERVICE, SYSINFOD_PATH,
SYSINFOD_INTERFACE,
SYSINFOD_GET_CONFIG_VALUE,
-1,
DBUS_TYPE_STRING, &key,
DBUS_TYPE_INVALID)) != NULL) {
dbus_message_get_args(reply, NULL,
DBUS_TYPE_ARRAY,
DBUS_TYPE_BYTE,
&tmp, len,
DBUS_TYPE_INVALID);

if (*len > 0) {
if ((*array = malloc(*len)) != NULL) {
*array = memcpy(*array, tmp, *len);
} else {
*len = 0;
}
}

dbus_message_unref(reply);
status = TRUE;
}

return status;
#else
/* Try to provide some values from environment */
const char *env = 0;
const char *val = 0;
Expand All @@ -177,8 +152,6 @@ gboolean get_sysinfo_value(const gchar *const key, guint8 **array, gulong *len)
key, env, res, (int)cnt);

return *array = (guint8*)res, *len = cnt, (res != 0);
#endif /* ENABLE_SYSINFOD_QUERIES */

}

/**
Expand Down
4 changes: 0 additions & 4 deletions modules/proximity.c
Expand Up @@ -292,11 +292,7 @@ static void calibrate_ps(void)
/* Retrieve the calibration data from sysinfo */
if (get_sysinfo_value(PS_CALIB_IDENTIFIER, &tmp, &len) == FALSE) {
mce_log(
#ifdef ENABLE_SYSINFOD_QUERIES
LL_ERR,
#else
LL_NOTICE,
#endif
"Failed to retrieve PS calibration data");
goto EXIT;
}
Expand Down

0 comments on commit fbe9f8a

Please sign in to comment.