1
0
forked from drath/libratbag

tools: ratbagctl: fixes for specials

few minor issues which were unseen because driver-test was missing to set
the special key mappings

Signed-off-by: Benjamin Tissoires <benjamin.tissoires@gmail.com>
This commit is contained in:
Benjamin Tissoires
2017-07-26 18:08:39 +02:00
parent 861562e58a
commit 7c313a31fd
3 changed files with 26 additions and 25 deletions

View File

@@ -127,6 +127,10 @@ test_read_button(struct ratbag_button *button)
ratbag_button_copy_macro(button, m);
ratbag_button_macro_unref(m);
break;
case RATBAG_BUTTON_ACTION_TYPE_SPECIAL:
button->action.type = RATBAG_BUTTON_ACTION_TYPE_SPECIAL;
button->action.action.special = p->buttons[button->index].special;
break;
default:
button->action.type = RATBAG_BUTTON_ACTION_TYPE_UNKNOWN;
}

View File

@@ -375,8 +375,7 @@ class TestRatbgagCtlButton(TestRatbagCtl):
r = self.launch_good_test("button 1 get test_device")
self.assertEqual(r, "Button: 1 type middle is mapped to 'KEY_3'")
r = self.launch_good_test("button 2 get test_device")
# FIXME: special maps to UNKNOWN????
self.assertEqual(r, "Button: 2 type right is mapped to UNKNOWN")
self.assertEqual(r, "Button: 2 type right is mapped to 'profile-cycle-up'")
r = self.launch_good_test("button 3 get test_device")
self.assertEqual(r, "Button: 3 type unknown is mapped to macro '+KEY_B -KEY_B t300'")
self.launch_fail_test("button 1 get 10 test_device")
@@ -408,13 +407,11 @@ class TestRatbgagCtlButton(TestRatbagCtl):
self.setProfile(2)
command = "button 0 action set special "
r = self.launch_good_test("button 0 action get test_device")
# FIXME: special maps to UNKNOWN????
self.assertEqual(r, "Button: 0 type left is mapped to UNKNOWN")#'profile-cycle-up'")
self.assertEqual(r, "Button: 0 type left is mapped to 'profile-cycle-up'")
r = self.launch_good_test(command + " second-mode test_device")
self.assertEqual(r, '')
r = self.launch_good_test("button 0 action get test_device")
# FIXME: special maps to UNKNOWN????
self.assertEqual(r, "Button: 0 type left is mapped to UNKNOWN")#'second-mode'")
self.assertEqual(r, "Button: 0 type left is mapped to 'second-mode'")
self.launch_fail_test(command)
self.launch_fail_test(command + " X test_device")
self.launch_fail_test(command + " 100 test_device X")

View File

@@ -440,25 +440,25 @@ class RatbagdButton(_RatbagdDBus):
ACTION_TYPE_KEY = 3
ACTION_TYPE_MACRO = 4
ACTION_SPECIAL_UNKNOWN = (1 << 30),
ACTION_SPECIAL_DOUBLECLICK = (1 << 30) + 1,
ACTION_SPECIAL_WHEEL_LEFT = (1 << 30) + 2,
ACTION_SPECIAL_WHEEL_RIGHT = (1 << 30) + 3,
ACTION_SPECIAL_WHEEL_UP = (1 << 30) + 4,
ACTION_SPECIAL_WHEEL_DOWN = (1 << 30) + 5,
ACTION_SPECIAL_RATCHET_MODE_SWITCH = (1 << 30) + 6,
ACTION_SPECIAL_RESOLUTION_CYCLE_UP = (1 << 30) + 7,
ACTION_SPECIAL_RESOLUTION_CYCLE_DOWN = (1 << 30) + 8,
ACTION_SPECIAL_RESOLUTION_UP = (1 << 30) + 9,
ACTION_SPECIAL_RESOLUTION_DOWN = (1 << 30) + 10,
ACTION_SPECIAL_RESOLUTION_ALTERNATE = (1 << 30) + 11,
ACTION_SPECIAL_RESOLUTION_DEFAULT = (1 << 30) + 12,
ACTION_SPECIAL_PROFILE_CYCLE_UP = (1 << 30) + 13,
ACTION_SPECIAL_PROFILE_CYCLE_DOWN = (1 << 30) + 14,
ACTION_SPECIAL_PROFILE_UP = (1 << 30) + 15,
ACTION_SPECIAL_PROFILE_DOWN = (1 << 30) + 16,
ACTION_SPECIAL_SECOND_MODE = (1 << 30) + 17,
ACTION_SPECIAL_BATTERY_LEVEL = (1 << 30) + 18,
ACTION_SPECIAL_UNKNOWN = (1 << 30)
ACTION_SPECIAL_DOUBLECLICK = (1 << 30) + 1
ACTION_SPECIAL_WHEEL_LEFT = (1 << 30) + 2
ACTION_SPECIAL_WHEEL_RIGHT = (1 << 30) + 3
ACTION_SPECIAL_WHEEL_UP = (1 << 30) + 4
ACTION_SPECIAL_WHEEL_DOWN = (1 << 30) + 5
ACTION_SPECIAL_RATCHET_MODE_SWITCH = (1 << 30) + 6
ACTION_SPECIAL_RESOLUTION_CYCLE_UP = (1 << 30) + 7
ACTION_SPECIAL_RESOLUTION_CYCLE_DOWN = (1 << 30) + 8
ACTION_SPECIAL_RESOLUTION_UP = (1 << 30) + 9
ACTION_SPECIAL_RESOLUTION_DOWN = (1 << 30) + 10
ACTION_SPECIAL_RESOLUTION_ALTERNATE = (1 << 30) + 11
ACTION_SPECIAL_RESOLUTION_DEFAULT = (1 << 30) + 12
ACTION_SPECIAL_PROFILE_CYCLE_UP = (1 << 30) + 13
ACTION_SPECIAL_PROFILE_CYCLE_DOWN = (1 << 30) + 14
ACTION_SPECIAL_PROFILE_UP = (1 << 30) + 15
ACTION_SPECIAL_PROFILE_DOWN = (1 << 30) + 16
ACTION_SPECIAL_SECOND_MODE = (1 << 30) + 17
ACTION_SPECIAL_BATTERY_LEVEL = (1 << 30) + 18
MACRO_KEY_PRESS = 1
MACRO_KEY_RELEASE = 2