From a00610003002c709a542ae61458d4a322c062ad6 Mon Sep 17 00:00:00 2001 From: Cameron Gutman Date: Fri, 12 Jul 2024 20:21:38 -0500 Subject: [PATCH] Never report NOT_PRESENT or other unknown status values to inputino --- src/platform/linux/input/inputtino_gamepad.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/platform/linux/input/inputtino_gamepad.cpp b/src/platform/linux/input/inputtino_gamepad.cpp index 2436f89fd1c..15fbfcaf501 100644 --- a/src/platform/linux/input/inputtino_gamepad.cpp +++ b/src/platform/linux/input/inputtino_gamepad.cpp @@ -248,9 +248,9 @@ namespace platf::gamepad { if (!gamepad) { return; } - // Only the PS5 controller supports motion + // Only the PS5 controller supports battery reports if (std::holds_alternative(*gamepad->joypad)) { - inputtino::PS5Joypad::BATTERY_STATE state = inputtino::PS5Joypad::CHARGHING_ERROR; + inputtino::PS5Joypad::BATTERY_STATE state; switch (battery.state) { case LI_BATTERY_STATE_CHARGING: state = inputtino::PS5Joypad::BATTERY_CHARGHING; @@ -262,6 +262,8 @@ namespace platf::gamepad { state = inputtino::PS5Joypad::BATTERY_FULL; break; case LI_BATTERY_STATE_UNKNOWN: + case LI_BATTERY_STATE_NOT_PRESENT: + default: return; } if (battery.percentage != LI_BATTERY_PERCENTAGE_UNKNOWN) {