This repository has been archived by the owner on May 3, 2022. It is now read-only.
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
MCE uses general rule with usb modes: Apart from select modes known to imply "disconnected" state, everything is assumed to mean "connected". This misfires with recently introduced "busy" mode, which can occur also when cable is physically detached from the device. Use symbolic mode names from usb-moded devel package. Add all known transient and stable modes to the lookup table. Do not take "busy" and some other modes into account when evaluating cable connected state. Signed-off-by: Simo Piiroinen <simo.piiroinen@jollamobile.com>
Do not assume "busy" usb-mode means connected See merge request mer-core/mce!86
Expand all tabs in source files that are supposed to use only spaces for indentation. Signed-off-by: Simo Piiroinen <simo.piiroinen@jollamobile.com>
Inter dependencies make it hard to have the variables next to the datapipe callback functions. Signed-off-by: Simo Piiroinen <simo.piiroinen@jollamobile.com>
Enabler for fingerprint sensor wakeups via device unlock UI. If we see device getting unlocked while display is not in fully powered on state, assume unlocking happened due to fingerprint authentication handled by device lock ui and power up display to a state where further interaction is possible. Signed-off-by: Simo Piiroinen <simo.piiroinen@jollamobile.com>
Normally fingerprint sensor is used only for purposes of authenticating user within an application / unlocking the device under control of device lock ui. This leaves out possibility of waking up the device with fingerprint scanner while the device is not locked. Track system state in sufficient detail to implement a policy that knows both when fingerprint wakeup can have some useful purpose and device lock ui is not going to have ongoing fingerprint authentication. Implement state machinery that mce can use fingerprint scanner for waking up the device while allowed by the fingerprint wakeup policy. Signed-off-by: Simo Piiroinen <simo.piiroinen@jollamobile.com>
If fingerprint scanner is physically located on the power button, pressing the button can yield both fp identification and key events - which can result in confusion. Delay handling of fingerprint identification a bit so that it can be ignored if almost simultaneous power key event is also seen. Disable fingerprint wakeup policy while power key is pressed down so that fingerprint is either not scanned at all, or gets ignored if received. Signed-off-by: Simo Piiroinen <simo.piiroinen@jollamobile.com>
Settings for enabling/disabling fingerprint wakeups and finetuning related delays. Added mcetool options are: --set-fingerprint-wakeup-mode=<never|always|proximity> --set-fingerprint-wakeup-allow-delay=<ms> --set-fingerprint-wakeup-trigger-delay=<ms> --set-fingerprint-wakeup-throttle-delay=<ms> Signed-off-by: Simo Piiroinen <simo.piiroinen@jollamobile.com>
While suspend proofed custom wltimer_t already exists, it does not function as drop in replacement for glib functions. Add mce_wakelocked_timeout_xxx() functions that behave exactly like g_timeout_xxx() functions except they hold a wakelock until the associated glib timer resource gets released. Signed-off-by: Simo Piiroinen <simo.piiroinen@jollamobile.com>
The sailfish-fpd has been developed under assumption that it must block suspend while acquiring fingerprints. This assumption has leaked also in related code which has not needed to be suspend proofed. Suspend proof fingerprint related timers and idle callbacks as an enabler for allowing sailfish-fpd to release wakelocks during fingerprint acquisition in devices where it is possible. Signed-off-by: Simo Piiroinen <simo.piiroinen@jollamobile.com>
How well fingerprint wakeups work while device is allowed to suspend and how much battery drain is induced from keeping the scanner active varies from one device to another. Make it so that fingerprint wakeups are disabled by default. Device specific configuration files can be used to override this built-in default when appropriate, and users can always opt in via execting from command line: - mcetool --set-fingerprint-wakeup-mode=proximity Fingerprint scanner is activated and used for waking up device when the scanner is not used for authentication purposes and proximity sensor is not covered. - mcetool --set-fingerprint-wakeup-mode=always Fingerprint scanner is activated and used for waking up device when the scanner is not used for authentication purposes. - mcetool --set-fingerprint-wakeup-mode=never Fingerprint scanner is not used for waking up device. Signed-off-by: Simo Piiroinen <simo.piiroinen@jollamobile.com>
…2145 Looks like hard to reproduce problems like defunct device unlock view and semi-active lockscreen might be caused by various glitches in mce side tklock submode tracking and lockscreen state synchronization. Force tklock submode datapipe changes to comply with lockscreen policy by installing a datapipe filter instead of attempting to correct after arriving to non-allowed state. Sync lockscreen policy changes to tklock submode from idle callback instead of using potentially hazardous recursive datapipe execution. Use only lockscreen policy state when deciding how tklock state should show up on D-Bus. Signed-off-by: Simo Piiroinen <simo.piiroinen@jollamobile.com>
Implement fingerprint wakeup functionality See merge request mer-core/mce!84
Switch to indent by 4 spaces. Rename datapipe_struct to datapipe_t, and use dp_ prefix for member data. Rename read_only_policy_t to datapipe_filtering_t, and values READ_WRITE -> DATAPIPE_FILTERING_ALLOWED READ_ONLY -> DATAPIPE_FILTERING_DENIED Rename cache_free_policy_t to datapipe_data_t, and values DONT_FREE_CACHE -> DATAPIPE_DATA_LITERAL FREE_CACHE -> DATAPIPE_DATA_DYNAMIC Rename data_source_t to datapipe_use_t, and values USE_INDATA -> DATAPIPE_USE_INDATA USE_CACHE -> DATAPIPE_USE_CACHED Rename caching_policy_t to datapipe_cache_t, and values DONT_CACHE_INDATA -> DATAPIPE_CACHE_NOTHING CACHE_INDATA -> DATAPIPE_CACHE_INDATA CACHE_OUTDATA -> DATAPIPE_CACHE_OUTDATA Signed-off-by: Simo Piiroinen <simo.piiroinen@jollamobile.com>
Use mce_datapipe_xxx prefix for functions that are not "methods" for dealing with datapipe_t objects. Signed-off-by: Simo Piiroinen <simo.piiroinen@jollamobile.com>
Remove unused macros: - datapipe_get_gsize() - datapipe_get_gbool() - datapipe_get_gpointer() Signed-off-by: Simo Piiroinen <simo.piiroinen@jollamobile.com>
Enabler for making generic datapipe debugging useful. Signed-off-by: Simo Piiroinen <simo.piiroinen@jollamobile.com>
Most modules already use array based datapipe binding. Make all modules use only array based binding. Signed-off-by: Simo Piiroinen <simo.piiroinen@jollamobile.com>
Low level trigger/filter registration functions are used only within datapipe module. As an enabler for internal refactoring, make all datapipe functions not used outside datapipe mode static. Signed-off-by: Simo Piiroinen <simo.piiroinen@jollamobile.com>
Signed-off-by: Simo Piiroinen <simo.piiroinen@jollamobile.com>
…#22475 Only place where datapipes are executed without explicitly giving an input value is when brightness datapipes are re-executed. As an enabler for dropping otherwise unneeded parameter, rewrite the re-execution so that it explicitly provides current value as input. Signed-off-by: Simo Piiroinen <simo.piiroinen@jollamobile.com>
Signed-off-by: Simo Piiroinen <simo.piiroinen@jollamobile.com>
As DATAPIPE_USE_INDATA is the only value left in the enumeration, it is pointless to pass it as an argument. Do not use datapipe_use_t values as function arguments. Remove the whole datapipe_use_t enumeration. Signed-off-by: Simo Piiroinen <simo.piiroinen@jollamobile.com>
The following datapipes are not used to store dynamically allocated data eventhough they are marked as such: - led_pattern_activate_pipe - led_pattern_deactivate_pipe - keypress_event_pipe - touchscreen_event_pipe Switch types from DATAPIPE_DATA_DYNAMIC to DATAPIPE_DATA_LITERAL. Signed-off-by: Simo Piiroinen <simo.piiroinen@jollamobile.com>
No datapipes utilize DATAPIPE_DATA_DYNAMIC, so all special case code related to it can be removed. Signed-off-by: Simo Piiroinen <simo.piiroinen@jollamobile.com>
Only possible datapipe_data_t value left is DATAPIPE_DATA_LITERAL, so it does not make sense to pass it around as function parameter. Remove all references to datapipe_data_t enumeration type. Signed-off-by: Simo Piiroinen <simo.piiroinen@jollamobile.com>
While in thery it might be useful to be able to control datapipe caching with every exec call, in practice the extra parameter just makes things look more complicated and errors are extremely difficult to spot. Define caching policy for each datapipe on initialization, and drop the cache control parameter from datapipe_exec_full() function. Signed-off-by: Simo Piiroinen <simo.piiroinen@jollamobile.com>
Now that datapipes do not even in theory anymore support dynamically allocated data, make the api reflect that. Signed-off-by: Simo Piiroinen <simo.piiroinen@jollamobile.com>
In some devices initial power supply device probing can block mce for several seconds. As this happens during mce startup, it also delays readiness of mce systemd service. Which in turn can cause unnecessary waiting during bootup. Handle time-consuming udev property scanning from idle callback so that it happens after systemd has been notified that mce is ready. Signed-off-by: Simo Piiroinen <simo.piiroinen@jollamobile.com>
For example pinephone exposes charger devices in a manner where the name is prefixed with chiptype (e.g. "axp813-ac" / "axp20x-usb"). As mce does not recognize these, both wall charger and pc connection gets treated as "other" type charger - which works to some extent but triggers incorrect UI actions. If direct match for power supply device type / name is not found, try to eliminate chipname prefix so that for example names such as "axp20x-usb" get treated as plain "usb". To future proof things, make it possible to override build-in defaults and heuristics via mce configuration files. Signed-off-by: Simo Piiroinen <simo.piiroinen@jollamobile.com>
For example pinephone sends udev notification about charger disconnect, but not about battery making related transition to discharging state - which leaves system believing battery is still getting charged. Add enablers for optionally refreshing properties of all power supply devices whenever at least one device is reporting changes. Forced refresh is disabled by default. Enabling should be done only on those devices where it is needed, via hw specific mce configuration. Signed-off-by: Simo Piiroinen <simo.piiroinen@jollamobile.com>
There might not be udev notification about every battery capacity percent value change. While this is usually harmless when battery is sufficiently full, it can cause issues like missed battery low notifications and/or delay battery empty shutdown so much that battery gets too depleted for regular bootup. Poll power supply device properties in process watchdog heartbeat pace i.e. about every 36 seconds of uptime not spent in suspend. Periodic udev polling is enabled by default, but can be disabled via mce configuration. Signed-off-by: Simo Piiroinen <simo.piiroinen@jollamobile.com>
Enablers for periodic / forced battery info polling See merge request mer-core/mce!139
…to JB#49681 Plugins are under /usr/lib64 instead of /usr/lib on aarch64. Signed-off-by: Matti Lehtimäki <matti.lehtimaki@jolla.com>
Load plugins from /usr/lib64 instead of /usr/lib on aarch64 See merge request mer-core/mce!140
…#49634 Whether fpwakeups are allowed or not shares logic with touchscreen gesture (e.g. doubletaps) handling. This is not entirely correct and leads to fpwakeups getting ignored in situations where display is on. Implement fpwakeup specific action policy that allows event actions to be taken when either display is off or lockscreen is active. Signed-off-by: Simo Piiroinen <simo.piiroinen@jollamobile.com>
[aarch64] Fix packaging systemd unit files. Contributes to JB#49681 See merge request mer-core/mce!142
Implement separate policy for allowing fingerprint wakeups See merge request mer-core/mce!141
Signed-off-by: Matti Kosola <matti.kosola@jolla.com>
Also remove dependency on dbus-glib. Signed-off-by: Björn Bidar <bjorn.bidar@jolla.com>
As required by dbus-gmain. Signed-off-by: Björn Bidar <bjorn.bidar@jolla.com>
Use dbus_gmain instead of dbus-glib. JB#51115 See merge request mer-core/mce!144
Signed-off-by: Simo Piiroinen <simo.piiroinen@jollamobile.com>
[packaging] Use sailfish-mirror instead of upstream for dbus-glib. JB#51115 Signed-off-by: Björn Bidar <bjorn.bidar@jolla.com>
Use sailfish-mirror instead of upstream See merge request mer-core/mce!145
[mce] Use sensord.sock from /run. JB#52757 Changed to be in sync with sensorfw.
mce: Use sensord.sock from /run See merge request mer-core/mce!146
RTLD_DEEPBIND is glibc specific and not in POSIX, guard it's use TEMP_FAILURE_RETRY is glibc specific. If it's not available, define it. The implementation is taken from Bionic which is permissively licensed, so should be compatible with the licensing here but IANAL On 32-bit arches input_event->time is undefined when using a time64 kernel. Instead read the input_event_sec and input_event_usec values directly and save those instead. Also make sure to support input_event_sec and input_event_usec on non-time64 kernels (downstream Android ones for example)
FlorentRevest
approved these changes
Apr 28, 2021
Uh, ignore this. I'm upstreaming my fixes to SFOS and will carry this patch downstream for now. Eventually it should trickle down to AsteroidOS sources as well. |
This has now been merged upstream at sailfishos/mce#1. |
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
The glib header files are available under glib-2.0 but weren't included
as such. This isn't Musl specific but it broke the build
RTLD_DEEPBIND is glibc specific and not in POSIX, guard it's use
TEMP_FAILURE_RETRY is glibc specific. If it's not available, define it.
The implementation is taken from Bionic which is permissively licensed,
so should be compatible with the licensing here but IANAL