From b917a97e93cd9fcb7438066aec6e17c75a305d98 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?L=C3=A1szl=C3=B3=20Monda?= Date: Thu, 3 May 2018 00:42:20 +0200 Subject: [PATCH] Parse long media macro actions. --- right/src/config_parser/parse_macro.c | 6 ++++-- right/src/macros.h | 2 +- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/right/src/config_parser/parse_macro.c b/right/src/config_parser/parse_macro.c index 24be4cb..416d76a 100644 --- a/right/src/config_parser/parse_macro.c +++ b/right/src/config_parser/parse_macro.c @@ -7,13 +7,15 @@ parser_error_t parseKeyMacroAction(config_buffer_t *buffer, macro_action_t *macr uint8_t keyMacroType = macroActionType - SerializedMacroActionType_KeyMacroAction; uint8_t action = keyMacroType & 0b11; uint8_t type; - uint8_t scancode; + uint16_t scancode = 0; uint8_t modifierMask; keyMacroType >>= 2; type = keyMacroType & 0b11; keyMacroType >>= 2; - scancode = keyMacroType & 0b10 ? ReadUInt8(buffer) : 0; + if (keyMacroType & 0b10) { + scancode = type == SerializedKeystrokeType_LongMedia ? ReadUInt16(buffer) : ReadUInt8(buffer); + } modifierMask = keyMacroType & 0b01 ? ReadUInt8(buffer) : 0; macroAction->type = MacroActionType_Key; macroAction->key.action = action; diff --git a/right/src/macros.h b/right/src/macros.h index 289cc63..6eecc1a 100644 --- a/right/src/macros.h +++ b/right/src/macros.h @@ -39,7 +39,7 @@ struct { macro_sub_action_t action; keystroke_type_t type; - uint8_t scancode; + uint16_t scancode; uint8_t modifierMask; } ATTR_PACKED key; struct {