Commit e0d23627 authored by spiiroin's avatar spiiroin

[mce-hybris] Enablers for masking hybris plugin features. JB#46746

In some cases functionality from mce-plugin-libhybris that works and
is needed in some devices can cause problems in other devices - for
example using android hwc2 interface for display blank/unblank purposes
can interfere with minui based unlock/upgrade UIs on devices that use
kms/drm instead of legacy frame buffer.

Make it possible to use configuration files for enabling / disabling
features implemented in the hybris plugin.

Keep all features enabled by default.

Install configuration file that keeps enabled those features that actually
might be used by mce and disables the rest.
Signed-off-by: spiiroin's avatarSimo Piiroinen <simo.piiroinen@jollamobile.com>
parent 0a04373c
......@@ -467,6 +467,7 @@ install:: build
$(INSTALL_DTA) inifiles/mce.ini $(DESTDIR)$(CONFDIR)/$(CONFFILE)
$(INSTALL_DTA) inifiles/mce-radio-states.ini $(DESTDIR)$(CONFDIR)/$(RADIOSTATESCONFFILE)
$(INSTALL_DTA) inifiles/hybris-led.ini $(DESTDIR)$(CONFDIR)/20hybris-led.ini
$(INSTALL_DTA) inifiles/hybris-features.ini $(DESTDIR)$(CONFDIR)/20hybris-features.ini
$(INSTALL_DTA) inifiles/debug-led.ini $(DESTDIR)$(CONFDIR)/20debug-led.ini
$(INSTALL_DTA) inifiles/als-defaults.ini $(DESTDIR)$(CONFDIR)/20als-defaults.ini
$(INSTALL_DTA) inifiles/legacy.ini $(DESTDIR)$(CONFDIR)/11legacy.ini
......
# Configuration file for MCE - allow/mask features provided by hybris backend
[FeatureHybris]
# If no configuration file is provided, all functionality implemented in
# mce-plugin-libhybris is enabled by default. If some feature is causing
# problems for some device, it should be disabled in hw specific configuration
# file by overriding one of the values below.
FrameBuffer = true
BackLight = true
KeyPad = true
IndicatorLed = true
# Supporting sensors via hybris plugin is a vestigial feature. Masking via
# config solely for the sake of symmetry. Keep all of them disabled.
ProximitySensor = false
LightSensor = false
......@@ -45,6 +45,29 @@
#include <errno.h>
#include <dlfcn.h>
/* ========================================================================= *
* On some devices using in theory supported hybris functionality can lead
* to problems. As a solution mce side configuration files can be used to
* disable individual features.
* ========================================================================= */
#define MCE_CONF_FEATURE_HYBRIS_GROUP "FeatureHybris"
#define MCE_CONF_FEATURE_HYBRIS_FRAMEBUFFER "FrameBuffer"
#define MCE_CONF_FEATURE_HYBRIS_BACKLIGHT "BackLight"
#define MCE_CONF_FEATURE_HYBRIS_KEYPAD "KeyPad"
#define MCE_CONF_FEATURE_HYBRIS_INDICATOR_LED "IndicatorLed"
#define MCE_CONF_FEATURE_HYBRIS_PROXIMITY_SENSOR "ProximitySensor"
#define MCE_CONF_FEATURE_HYBRIS_LIGHT_SENSOR "LightSensor"
static bool
mce_hybris_feature_supported(const char *key)
{
bool res = mce_conf_get_bool(MCE_CONF_FEATURE_HYBRIS_GROUP, key, true);
mce_log(LL_WARN, "hybris feature %s is %s", key, res ? "allowed" : "denied");
return res;
}
static void mce_hybris_ps_set_hook(mce_hybris_ps_fn cb);
static void mce_hybris_als_set_hook(mce_hybris_als_fn cb);
......@@ -403,7 +426,8 @@ void mce_hybris_quit(void)
bool mce_hybris_framebuffer_init(void)
{
static bool (*real)(void) = 0;
RESOLVE;
if( mce_hybris_feature_supported(MCE_CONF_FEATURE_HYBRIS_FRAMEBUFFER) )
RESOLVE;
return !real ? false : real();
}
......@@ -440,7 +464,8 @@ bool mce_hybris_framebuffer_set_power(bool state)
bool mce_hybris_backlight_init(void)
{
static bool (*real)(void) = 0;
RESOLVE;
if( mce_hybris_feature_supported(MCE_CONF_FEATURE_HYBRIS_BACKLIGHT) )
RESOLVE;
return !real ? false : real();
}
......@@ -477,7 +502,8 @@ bool mce_hybris_backlight_set_brightness(int level)
bool mce_hybris_keypad_init(void)
{
static bool (*real)(void) = 0;
RESOLVE;
if( mce_hybris_feature_supported(MCE_CONF_FEATURE_HYBRIS_KEYPAD) )
RESOLVE;
return !real ? false : real();
}
......@@ -514,7 +540,8 @@ bool mce_hybris_keypad_set_brightness(int level)
bool mce_hybris_indicator_init(void)
{
static bool (*real)(void) = 0;
RESOLVE;
if( mce_hybris_feature_supported(MCE_CONF_FEATURE_HYBRIS_INDICATOR_LED) )
RESOLVE;
return !real ? false : real();
}
......@@ -595,7 +622,8 @@ bool mce_hybris_indicator_set_brightness(int level)
bool mce_hybris_ps_init(void)
{
bool (*real)(void) = 0;
RESOLVE;
if( mce_hybris_feature_supported(MCE_CONF_FEATURE_HYBRIS_PROXIMITY_SENSOR) )
RESOLVE;
return !real ? false : real();
}
......@@ -670,7 +698,8 @@ bool mce_hybris_ps_set_callback(mce_hybris_ps_fn cb)
bool mce_hybris_als_init(void)
{
bool (*real)(void) = 0;
RESOLVE;
if( mce_hybris_feature_supported(MCE_CONF_FEATURE_HYBRIS_LIGHT_SENSOR) )
RESOLVE;
return !real ? false : real();
}
......
......@@ -106,6 +106,7 @@ systemctl daemon-reload || :
%config %{_sysconfdir}/%{name}/10mce.ini
%config %{_sysconfdir}/%{name}/20mce-radio-states.ini
%config %{_sysconfdir}/%{name}/20hybris-led.ini
%config %{_sysconfdir}/%{name}/20hybris-features.ini
%config %{_sysconfdir}/%{name}/20debug-led.ini
%config %{_sysconfdir}/%{name}/20als-defaults.ini
# empty /var/lib/mce -> rpm
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment