From 920b71d94c19ceba9acb8588ab544adad51d32b3 Mon Sep 17 00:00:00 2001 From: Peter Hutterer Date: Wed, 22 Aug 2018 09:01:27 +1000 Subject: [PATCH] ratbagd: if the action special type is invalid, change to unknown This prevents us from sending -1 down the wire as unsigned int. This may be the cause of https://github.com/libratbag/piper/issues/208 Signed-off-by: Peter Hutterer --- ratbagd/ratbagd-button.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/ratbagd/ratbagd-button.c b/ratbagd/ratbagd-button.c index 8f0faddc..7f5f9bd0 100644 --- a/ratbagd/ratbagd-button.c +++ b/ratbagd/ratbagd-button.c @@ -128,6 +128,11 @@ static int ratbagd_button_get_special(sd_bus *bus, enum ratbag_button_action_special special; special = ratbag_button_get_special(button->lib_button); + if (special == RATBAG_BUTTON_ACTION_SPECIAL_INVALID) { + log_error("%s: changing button special action from INVALID to UNKNOWN\n", + ratbagd_device_get_sysname(button->device)); + special = RATBAG_BUTTON_ACTION_SPECIAL_UNKNOWN; + } return sd_bus_message_append(reply, "u", special); }