forked from drath/libratbag
etekcity: fix the retrieval of the raw code given the action
Signed-off-by: Benjamin Tissoires <benjamin.tissoires@gmail.com>
This commit is contained in:
@@ -197,8 +197,25 @@ etekcity_button_action_to_raw(const struct ratbag_button_action *action)
|
||||
struct etekcity_button_mapping *mapping;
|
||||
|
||||
ARRAY_FOR_EACH(etekcity_button_mapping, mapping) {
|
||||
if (mapping->action.type == action->type)
|
||||
if (mapping->action.type == action->type) {
|
||||
switch (action->type) {
|
||||
case RATBAG_BUTTON_ACTION_TYPE_BUTTON:
|
||||
if (mapping->action.action.button != action->action.button)
|
||||
continue;
|
||||
break;
|
||||
case RATBAG_BUTTON_ACTION_TYPE_KEY:
|
||||
if (mapping->action.action.key.key != action->action.key.key)
|
||||
continue;
|
||||
case RATBAG_BUTTON_ACTION_TYPE_SPECIAL:
|
||||
if (mapping->action.action.special != action->action.special)
|
||||
continue;
|
||||
case RATBAG_BUTTON_ACTION_TYPE_MACRO:
|
||||
/* FIXME: currently, do nothing */
|
||||
default: /* do nothing, we are good */
|
||||
break;
|
||||
}
|
||||
return mapping->raw;
|
||||
}
|
||||
}
|
||||
|
||||
return 0;
|
||||
|
||||
Reference in New Issue
Block a user