tools: don't allow setting macros where not supported
Fixes
@@ -379,12 +379,17 @@ def func_button_get(r, args):
def func_button_action_set_button(r, args):
b, p, d = find_button(r, args)
+ if not d.CAP_BUTTON in d.capabilities:
+ raise RatbagErrorCapability("assigning a button is not supported on this device")
b.mapping = args.target_button
commit(d, args)
def func_button_action_set_special(r, args):
b, p, d = find_button(r, args)
+ if not d.CAP_BUTTON in d.capabilities:
+ raise RatbagErrorCapability("assigning a button is not supported on this device")
+
try:
special = args.target_special
except AttributeError:
@@ -396,6 +401,9 @@ def func_button_action_set_special(r, args):
def func_button_action_set_macro(r, args):
b, p, d = find_button(r, args)
+ if not d.CAP_BUTTON_MACROS in d.capabilities:
+ raise RatbagErrorCapability("assigning a macro is not supported on this device")
+
macro_keys = args.target_macro
macro = RatbagdMacro()
for s in macro_keys:
