Skip to content
This repository has been archived by the owner on Mar 7, 2022. It is now read-only.

qt5-qpa-hwcomposer-plugin: Synchronize LCD time when transitioning display. #4

Closed
wants to merge 1 commit into from

Conversation

MagneFire
Copy link
Member

Use the vendor provided libmcutool.so library to synchronize the LCD time when the screen turns off.

The patch isn't currently the greatest work (hence draft for now). But it should get the general idea across.
I'm also not entirely sure if having this code in here is even the correct state. I was thinking about some daemon, but that needs to somehow hook into time change events. Which for now I'm not sure how to do.

…splay.

Use the vendor provided libmcutool.so library to synchronize the LCD time when the screen turns off.

Signed-off-by: Darrel Griët <dgriet@gmail.com>
@LecrisUT
Copy link
Contributor

LecrisUT commented Feb 4, 2022

How about we try a systemd timer using OnClockChange? As for the 12/24h time format, isn't it solely controlled by the UI element?

@MagneFire
Copy link
Member Author

Thanks so much for that suggestion!
This looks like THE best solution: trigger some daemon when OnClockChange is called by systemd.

The 12/24h time format is already controllable from the settings app, but it's only for the ui. It does not change anything else. We may build some small daemon that always runs in the background and listens to the D-Bus change. (ref: https://github.com/AsteroidOS/asteroid-settings/blob/master/src/qml/UnitsPage.qml#L31)

Copy link
Member

@FlorentRevest FlorentRevest left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah I agree, a systemd timer and a slim daemon could be great here :)
Thanks for sharing your experiment MagneFire

+ fprintf(stderr, "Unable to get symbol\n"); \
+ } \
+}
+#define LOAD_MCU_FUNC5(x) { \
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ooc have you tried using variadic macros ? something along the line of https://github.com/torvalds/linux/blob/master/tools/lib/bpf/bpf_tracing.h#L321

+ } \
+}
+
+extern "C" void *android_dlopen(const char *filename, int flags);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am trying to add this header on a cmake file at #5 , but I can't figure out how to do so. Any hints on that?

#ifdef HWC_DEVICE_API_VERSION_1_5
+ if (mcu) {
+ mcu->nativeAutoLowPowerScreen(0, 0, 1);
+ mcu->nativeSyncTime();
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why do you lookup all these symbols if you only end up calling two ?

sleepDisplay(false);
+ void *handler = android_dlopen("libmcutool.so", RTLD_LAZY);
+ if (handler) {
+ mcu = (mcu_t*) malloc(sizeof(mcu_t));
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should be freed in the destructor as well then

@LecrisUT LecrisUT mentioned this pull request Feb 10, 2022
8 tasks
@MagneFire
Copy link
Member Author

This work has been superseded by #5.

@MagneFire MagneFire closed this Mar 6, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants