From 646abc0426950e68b6a7c4035645f96b0a5e19ed Mon Sep 17 00:00:00 2001 From: Christoffer Sandberg Date: Tue, 14 Feb 2023 16:56:22 +0100 Subject: [PATCH] charging: Move event catch to appropriate place and tweak setting - Charging profile prepared but not included (most likely not needed) - Charging prio kept with slight delay to catch some timing issues Note: Workaround not perfect but catches most cases where connecting barrel plug would make charging prio setting jump to charge battery --- src/uniwill_keyboard.h | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/uniwill_keyboard.h b/src/uniwill_keyboard.h index 2e9a257..e2810c0 100644 --- a/src/uniwill_keyboard.h +++ b/src/uniwill_keyboard.h @@ -386,11 +386,16 @@ void uniwill_event_callb(u32 code) // Refresh keyboard state and charging profile on cable switch event case UNIWILL_OSD_DC_ADAPTER_CHANGE: uniwill_write_kbd_bl_state(); - uw_charging_profile_write_state(); - uw_charging_priority_write_state(); break; } } + + switch (code) { + case UNIWILL_OSD_DC_ADAPTER_CHANGE: + msleep(50); + uw_charging_priority_write_state(); + break; + } } static ssize_t uw_brightness_show(struct device *child,