Skip to content

Commit

Permalink
Using sensorfw for ambient light / proximity sensor control is not op…
Browse files Browse the repository at this point in the history
…tional

The legacy sensor control methods are removed, only sensorfw can be used
for starting/stopping sensors. If sensord is not running on the device
or does not support some of the expected to be available sensors, mce
will still function and uses sensible fallback values for sensors.

Remove the build time configuration for disabling sensorfw usage.

[mce] Using sensorfw for ambient light / proximity sensor control is not optional. Fixes JB#27286
  • Loading branch information
spiiroin committed Mar 15, 2015
1 parent 92b1d17 commit 05eac7d
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 31 deletions.
12 changes: 1 addition & 11 deletions Makefile
Expand Up @@ -75,9 +75,6 @@ PKG_CONFIG ?= pkg-config
# Whether to enable DEVEL release logging
ENABLE_DEVEL_LOGGING ?= y

# Whether to use sensorfw for ALS/PS
ENABLE_SENSORFW ?= y

# Whether to enable support for libhybris plugin
ENABLE_HYBRIS ?= y

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

ifeq ($(ENABLE_SENSORFW),y)
CPPFLAGS += -DENABLE_SENSORFW
endif

ifeq ($(ENABLE_HYBRIS),y)
CPPFLAGS += -DENABLE_HYBRIS
endif
Expand Down Expand Up @@ -302,11 +295,8 @@ MCE_CORE += filewatcher.c
ifeq ($(ENABLE_HYBRIS),y)
MCE_CORE += mce-hybris.c
endif
ifeq ($(ENABLE_SENSORFW),y)
MCE_CORE += mce-sensorfw.c
endif

MCE_CORE += builtin-gconf.c
MCE_CORE += builtin-gconf.c

ifeq ($(strip $(ENABLE_WAKELOCKS)),y)
MCE_CORE += libwakelock.c
Expand Down
8 changes: 1 addition & 7 deletions mce.c
Expand Up @@ -28,9 +28,7 @@
#include "mce-dsme.h"
#include "mce-modules.h"
#include "mce-command-line.h"
#ifdef ENABLE_SENSORFW
# include "mce-sensorfw.h"
#endif
#include "mce-sensorfw.h"
#include "tklock.h"
#include "powerkey.h"
#include "event-input.h"
Expand Down Expand Up @@ -1048,11 +1046,9 @@ int main(int argc, char **argv)
goto EXIT;
}

#ifdef ENABLE_SENSORFW
if( !mce_sensorfw_init() ) {
goto EXIT;
}
#endif

/* Load all modules */
if (mce_modules_init() == FALSE) {
Expand Down Expand Up @@ -1089,9 +1085,7 @@ int main(int argc, char **argv)
mce_modules_exit();

/* Call the exit function for all components */
#ifdef ENABLE_SENSORFW
mce_sensorfw_quit();
#endif
mce_tklock_exit();
mce_switches_exit();
mce_input_exit();
Expand Down
14 changes: 1 addition & 13 deletions modules/proximity.c
Expand Up @@ -25,9 +25,7 @@
#include "../mce.h"
#include "../mce-log.h"
#include "../mce-gconf.h"
#ifdef ENABLE_SENSORFW
# include "../mce-sensorfw.h"
#endif
#include "../mce-sensorfw.h"

#include <gmodule.h>

Expand Down Expand Up @@ -97,7 +95,6 @@ static void report_proximity(cover_state_t state)
*
* @param covered proximity sensor covered
*/
#ifdef ENABLE_SENSORFW
static void ps_sensorfw_iomon_cb(bool covered)
{
cover_state_t proximity_sensor_state = COVER_UNDEF;
Expand All @@ -111,7 +108,6 @@ static void ps_sensorfw_iomon_cb(bool covered)

return;
}
#endif /* ENABLE_SENSORFW */

/** Enable the proximity monitoring
*/
Expand All @@ -124,11 +120,9 @@ static void enable_proximity_monitor(void)
mce_log(LL_DEBUG, "enable PS monitoring");
proximity_monitor_active = TRUE;

#ifdef ENABLE_SENSORFW
/* install input processing hooks, update current state */
mce_sensorfw_ps_set_notify(ps_sensorfw_iomon_cb);
mce_sensorfw_ps_enable();
#endif

EXIT:
return;
Expand All @@ -146,13 +140,11 @@ static void disable_proximity_monitor(void)
mce_log(LL_DEBUG, "disable PS monitoring");
proximity_monitor_active = FALSE;

#ifdef ENABLE_SENSORFW
/* disable input */
mce_sensorfw_ps_disable();

/* remove input processing hooks */
mce_sensorfw_ps_set_notify(0);
#endif

EXIT:
return;
Expand All @@ -169,7 +161,6 @@ static guint use_ps_conf_id = 0;
*/
static void update_proximity_monitor(void)
{
#ifdef ENABLE_SENSORFW
static gboolean old_enable = FALSE;

gboolean enable = FALSE;
Expand All @@ -195,9 +186,6 @@ static void update_proximity_monitor(void)
EXIT:
if( !enable && fake_open )
report_proximity(COVER_OPEN);
#else
report_proximity(COVER_OPEN);
#endif
}

/** GConf callback for use proximity sensor setting
Expand Down

0 comments on commit 05eac7d

Please sign in to comment.