From 4b60f810d50e0de32a2b69ba7045ef0bdd00f31f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Luk=C3=A1=C5=A1=20Drahn=C3=ADk?= Date: Thu, 16 Mar 2023 22:37:41 +0100 Subject: [PATCH] Added protection against useless function call: do not check touchpad status when is NumberPad not activated or Disabling touchpad is not configured via config --- asus_touchpad.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/asus_touchpad.py b/asus_touchpad.py index 219e948..56fb002 100755 --- a/asus_touchpad.py +++ b/asus_touchpad.py @@ -1456,7 +1456,7 @@ def check_touchpad_status(): is_touchpad_enabled = is_device_enabled(touchpad_name) - if not is_touchpad_enabled and touchpad_disables_numpad and numlock: + if not is_touchpad_enabled: numlock = False deactivate_numpad() log.info("Numpad deactivated") @@ -1472,7 +1472,8 @@ def check_system_numlock_status(): def check_touchpad_status_endless_cycle(): while True and getting_device_status_failure_count < 9: - check_touchpad_status() + if touchpad_disables_numpad and numlock: + check_touchpad_status() sleep(0.5) log.info('Getting Device Enabled via xinput disabled because failed more then: \"%s\" times in row', getting_device_status_failure_count)