From e26eac95db8dec317a49c4a30c575f5b03e0f4a5 Mon Sep 17 00:00:00 2001 From: Yaroslav Chvanov Date: Mon, 14 Nov 2022 14:22:17 +0300 Subject: [PATCH] sinowealth: remove now unused `button_set_key_action_from_macro` I first thought that we could use try to use this instead of full-fledged macros when possible, but the implementation then is going to look quite messy, so let's just delete this. --- src/driver-sinowealth.c | 31 ------------------------------- 1 file changed, 31 deletions(-) diff --git a/src/driver-sinowealth.c b/src/driver-sinowealth.c index e7fb8443..4de795ce 100644 --- a/src/driver-sinowealth.c +++ b/src/driver-sinowealth.c @@ -1207,37 +1207,6 @@ sinowealth_update_profile_from_buttons(struct ratbag_profile *profile) } } -/* @return 0 on success or an error code. */ -static int -sinowealth_button_set_key_action_from_macro(struct ratbag_device *device, struct ratbag_button *button, struct sinowealth_button_data *button_data) -{ - assert(button->action.type == RATBAG_BUTTON_ACTION_TYPE_MACRO); - - struct ratbag_button_action *action = &button->action; - - int rc = 0; - unsigned int key = 0; - unsigned int modifiers = 0; - - rc = ratbag_action_keycode_from_macro(action, &key, &modifiers); - if (rc < 0) { - log_error(device->ratbag, "Could not make a keycode from macro for button %d\n", button->index); - return rc; - } - - uint8_t raw_key = ratbag_hidraw_get_keyboard_usage_from_keycode(device, key); - if (raw_key == 0) { - log_debug(device->ratbag, "Could not set unsupported key %#x to button %u\n", key, button->index); - return -1; - } - - button_data->type = SINOWEALTH_BUTTON_TYPE_KEY; - button_data->key.modifiers = modifiers; - button_data->key.key = raw_key; - - return 0; -} - /* @return 0 on success or an error code. */ static int sinowealth_button_set_key_action(struct ratbag_device *device, const struct ratbag_button *button, struct sinowealth_button_data *button_data)