From 0b1d513f53ce81042d546eb94b2d6ec789f421a9 Mon Sep 17 00:00:00 2001 From: Peter Johanson Date: Tue, 9 Apr 2024 21:43:07 -0700 Subject: [PATCH] fix(mouse): Fix up tests and make ZMK_MOUSE explicit. --- app/Kconfig.behaviors | 6 ++---- app/include/zmk/hid.h | 4 ---- app/include/zmk/mouse/hid.h | 4 ++++ app/tests/mouse-keys/mkp/native_posix_64.conf | 6 ++++++ app/tests/mouse-keys/mkp/native_posix_64.keymap | 1 - .../keycode_events.snapshot | 10 +++++----- .../move_diagonal_scaling/native_posix_64.conf | 6 ++++++ .../move_diagonal_scaling/native_posix_64.keymap | 16 +++++----------- .../keycode_events.snapshot | 12 ++++++------ .../move_diagonal_xy_invert/native_posix_64.conf | 6 ++++++ .../native_posix_64.keymap | 16 +++++----------- .../keycode_events.snapshot | 6 +++--- .../move_diagonal_xy_swap/native_posix_64.conf | 6 ++++++ .../move_diagonal_xy_swap/native_posix_64.keymap | 14 ++++---------- .../move_diagonal/native_posix_64.conf | 6 ++++++ .../mouse-move/move_x/native_posix_64.conf | 6 ++++++ .../mouse-move/move_y/native_posix_64.conf | 6 ++++++ 17 files changed, 76 insertions(+), 55 deletions(-) create mode 100644 app/tests/mouse-keys/mkp/native_posix_64.conf create mode 100644 app/tests/mouse-keys/mouse-move/input-configs/move_diagonal_scaling/native_posix_64.conf create mode 100644 app/tests/mouse-keys/mouse-move/input-configs/move_diagonal_xy_invert/native_posix_64.conf create mode 100644 app/tests/mouse-keys/mouse-move/input-configs/move_diagonal_xy_swap/native_posix_64.conf create mode 100644 app/tests/mouse-keys/mouse-move/move_diagonal/native_posix_64.conf create mode 100644 app/tests/mouse-keys/mouse-move/move_x/native_posix_64.conf create mode 100644 app/tests/mouse-keys/mouse-move/move_y/native_posix_64.conf diff --git a/app/Kconfig.behaviors b/app/Kconfig.behaviors index 5c00cdbefe7..8f633b3df39 100644 --- a/app/Kconfig.behaviors +++ b/app/Kconfig.behaviors @@ -9,8 +9,7 @@ config ZMK_BEHAVIOR_KEY_TOGGLE config ZMK_BEHAVIOR_MOUSE_KEY_PRESS bool default y - depends on DT_HAS_ZMK_BEHAVIOR_MOUSE_KEY_PRESS_ENABLED - imply ZMK_MOUSE + depends on DT_HAS_ZMK_BEHAVIOR_MOUSE_KEY_PRESS_ENABLED && ZMK_MOUSE config ZMK_BEHAVIOR_SOFT_OFF bool @@ -20,8 +19,7 @@ config ZMK_BEHAVIOR_SOFT_OFF config ZMK_BEHAVIOR_INPUT_TWO_AXIS bool default y - depends on DT_HAS_ZMK_BEHAVIOR_INPUT_TWO_AXIS_ENABLED - imply ZMK_MOUSE + depends on DT_HAS_ZMK_BEHAVIOR_INPUT_TWO_AXIS_ENABLED && ZMK_MOUSE config ZMK_BEHAVIOR_SENSOR_ROTATE_COMMON bool diff --git a/app/include/zmk/hid.h b/app/include/zmk/hid.h index 22af6d6e9b1..f11f00c1ec7 100644 --- a/app/include/zmk/hid.h +++ b/app/include/zmk/hid.h @@ -53,10 +53,6 @@ #define ZMK_HID_REPORT_ID_LEDS 0x01 #define ZMK_HID_REPORT_ID_CONSUMER 0x02 -// Needed until Zephyr offers a 2 byte usage macro -#define HID_USAGE16(idx) \ - HID_ITEM(HID_ITEM_TAG_USAGE, HID_ITEM_TYPE_LOCAL, 2), (idx & 0xFF), (idx >> 8 & 0xFF) - static const uint8_t zmk_hid_report_desc[] = { HID_USAGE_PAGE(HID_USAGE_GEN_DESKTOP), HID_USAGE(HID_USAGE_GD_KEYBOARD), diff --git a/app/include/zmk/mouse/hid.h b/app/include/zmk/mouse/hid.h index ba615d88c76..01fcc9ad7f3 100644 --- a/app/include/zmk/mouse/hid.h +++ b/app/include/zmk/mouse/hid.h @@ -21,6 +21,10 @@ #define ZMK_MOUSE_HID_REPORT_ID_MOUSE 0x01 +// Needed until Zephyr offers a 2 byte usage macro +#define HID_USAGE16(idx) \ + HID_ITEM(HID_ITEM_TAG_USAGE, HID_ITEM_TYPE_LOCAL, 2), (idx & 0xFF), (idx >> 8 & 0xFF) + static const uint8_t zmk_mouse_hid_report_desc[] = { HID_USAGE_PAGE(HID_USAGE_GD), HID_USAGE(HID_USAGE_GD_MOUSE), diff --git a/app/tests/mouse-keys/mkp/native_posix_64.conf b/app/tests/mouse-keys/mkp/native_posix_64.conf new file mode 100644 index 00000000000..65ed54bb204 --- /dev/null +++ b/app/tests/mouse-keys/mkp/native_posix_64.conf @@ -0,0 +1,6 @@ +CONFIG_GPIO=n +CONFIG_ZMK_BLE=n +CONFIG_LOG=y +CONFIG_LOG_BACKEND_SHOW_COLOR=n +CONFIG_ZMK_LOG_LEVEL_DBG=y +CONFIG_ZMK_MOUSE=y diff --git a/app/tests/mouse-keys/mkp/native_posix_64.keymap b/app/tests/mouse-keys/mkp/native_posix_64.keymap index 8b955846963..8e3071d4317 100644 --- a/app/tests/mouse-keys/mkp/native_posix_64.keymap +++ b/app/tests/mouse-keys/mkp/native_posix_64.keymap @@ -1,5 +1,4 @@ #include -#include #include #include #include diff --git a/app/tests/mouse-keys/mouse-move/input-configs/move_diagonal_scaling/keycode_events.snapshot b/app/tests/mouse-keys/mouse-move/input-configs/move_diagonal_scaling/keycode_events.snapshot index 6b9fa770b11..15d31600960 100644 --- a/app/tests/mouse-keys/mouse-move/input-configs/move_diagonal_scaling/keycode_events.snapshot +++ b/app/tests/mouse-keys/mouse-move/input-configs/move_diagonal_scaling/keycode_events.snapshot @@ -1,18 +1,18 @@ movement_set: Mouse movement set to -1/0 scroll_set: Mouse scroll set to 0/0 movement_set: Mouse movement set to 0/0 -movement_set: Mouse movement set to -2/-2 +movement_set: Mouse movement set to -3/-3 scroll_set: Mouse scroll set to 0/0 movement_set: Mouse movement set to 0/0 -movement_set: Mouse movement set to -2/-2 +movement_set: Mouse movement set to -3/-3 scroll_set: Mouse scroll set to 0/0 movement_set: Mouse movement set to 0/0 -movement_set: Mouse movement set to -3/-2 +movement_set: Mouse movement set to -5/-3 scroll_set: Mouse scroll set to 0/0 movement_set: Mouse movement set to 0/0 -movement_set: Mouse movement set to -3/-3 +movement_set: Mouse movement set to -5/-5 scroll_set: Mouse scroll set to 0/0 movement_set: Mouse movement set to 0/0 -movement_set: Mouse movement set to 0/-3 +movement_set: Mouse movement set to 0/-5 scroll_set: Mouse scroll set to 0/0 movement_set: Mouse movement set to 0/0 diff --git a/app/tests/mouse-keys/mouse-move/input-configs/move_diagonal_scaling/native_posix_64.conf b/app/tests/mouse-keys/mouse-move/input-configs/move_diagonal_scaling/native_posix_64.conf new file mode 100644 index 00000000000..65ed54bb204 --- /dev/null +++ b/app/tests/mouse-keys/mouse-move/input-configs/move_diagonal_scaling/native_posix_64.conf @@ -0,0 +1,6 @@ +CONFIG_GPIO=n +CONFIG_ZMK_BLE=n +CONFIG_LOG=y +CONFIG_LOG_BACKEND_SHOW_COLOR=n +CONFIG_ZMK_LOG_LEVEL_DBG=y +CONFIG_ZMK_MOUSE=y diff --git a/app/tests/mouse-keys/mouse-move/input-configs/move_diagonal_scaling/native_posix_64.keymap b/app/tests/mouse-keys/mouse-move/input-configs/move_diagonal_scaling/native_posix_64.keymap index 6351799bd2e..df8cda8cfdf 100644 --- a/app/tests/mouse-keys/mouse-move/input-configs/move_diagonal_scaling/native_posix_64.keymap +++ b/app/tests/mouse-keys/mouse-move/input-configs/move_diagonal_scaling/native_posix_64.keymap @@ -1,9 +1,13 @@ #include -#include #include #include #include +&mmv_input_listener { + scale-multiplier = <5>; + scale-divisor = <3>; +}; + / { keymap { compatible = "zmk,keymap"; @@ -16,16 +20,6 @@ >; }; }; - - input_configs { - compatible = "zmk,input-configs"; - - mmv { - device = <&mmv>; - scale-multiplier = <5>; - scale-divisor = <3>; - }; - }; }; diff --git a/app/tests/mouse-keys/mouse-move/input-configs/move_diagonal_xy_invert/keycode_events.snapshot b/app/tests/mouse-keys/mouse-move/input-configs/move_diagonal_xy_invert/keycode_events.snapshot index 6b9fa770b11..33bb267b073 100644 --- a/app/tests/mouse-keys/mouse-move/input-configs/move_diagonal_xy_invert/keycode_events.snapshot +++ b/app/tests/mouse-keys/mouse-move/input-configs/move_diagonal_xy_invert/keycode_events.snapshot @@ -1,18 +1,18 @@ -movement_set: Mouse movement set to -1/0 +movement_set: Mouse movement set to 1/0 scroll_set: Mouse scroll set to 0/0 movement_set: Mouse movement set to 0/0 -movement_set: Mouse movement set to -2/-2 +movement_set: Mouse movement set to 2/2 scroll_set: Mouse scroll set to 0/0 movement_set: Mouse movement set to 0/0 -movement_set: Mouse movement set to -2/-2 +movement_set: Mouse movement set to 2/2 scroll_set: Mouse scroll set to 0/0 movement_set: Mouse movement set to 0/0 -movement_set: Mouse movement set to -3/-2 +movement_set: Mouse movement set to 3/2 scroll_set: Mouse scroll set to 0/0 movement_set: Mouse movement set to 0/0 -movement_set: Mouse movement set to -3/-3 +movement_set: Mouse movement set to 3/3 scroll_set: Mouse scroll set to 0/0 movement_set: Mouse movement set to 0/0 -movement_set: Mouse movement set to 0/-3 +movement_set: Mouse movement set to 0/3 scroll_set: Mouse scroll set to 0/0 movement_set: Mouse movement set to 0/0 diff --git a/app/tests/mouse-keys/mouse-move/input-configs/move_diagonal_xy_invert/native_posix_64.conf b/app/tests/mouse-keys/mouse-move/input-configs/move_diagonal_xy_invert/native_posix_64.conf new file mode 100644 index 00000000000..65ed54bb204 --- /dev/null +++ b/app/tests/mouse-keys/mouse-move/input-configs/move_diagonal_xy_invert/native_posix_64.conf @@ -0,0 +1,6 @@ +CONFIG_GPIO=n +CONFIG_ZMK_BLE=n +CONFIG_LOG=y +CONFIG_LOG_BACKEND_SHOW_COLOR=n +CONFIG_ZMK_LOG_LEVEL_DBG=y +CONFIG_ZMK_MOUSE=y diff --git a/app/tests/mouse-keys/mouse-move/input-configs/move_diagonal_xy_invert/native_posix_64.keymap b/app/tests/mouse-keys/mouse-move/input-configs/move_diagonal_xy_invert/native_posix_64.keymap index 3392dd0de2e..9b07e1b9808 100644 --- a/app/tests/mouse-keys/mouse-move/input-configs/move_diagonal_xy_invert/native_posix_64.keymap +++ b/app/tests/mouse-keys/mouse-move/input-configs/move_diagonal_xy_invert/native_posix_64.keymap @@ -1,9 +1,13 @@ #include -#include #include #include #include +&mmv_input_listener { + x-invert; + y-invert; +}; + / { keymap { compatible = "zmk,keymap"; @@ -16,16 +20,6 @@ >; }; }; - - input_configs { - compatible = "zmk,input-configs"; - - mmv { - device = <&mmv>; - x-invert; - y-invert; - }; - }; }; diff --git a/app/tests/mouse-keys/mouse-move/input-configs/move_diagonal_xy_swap/keycode_events.snapshot b/app/tests/mouse-keys/mouse-move/input-configs/move_diagonal_xy_swap/keycode_events.snapshot index 6b9fa770b11..40daa64f0f6 100644 --- a/app/tests/mouse-keys/mouse-move/input-configs/move_diagonal_xy_swap/keycode_events.snapshot +++ b/app/tests/mouse-keys/mouse-move/input-configs/move_diagonal_xy_swap/keycode_events.snapshot @@ -1,4 +1,4 @@ -movement_set: Mouse movement set to -1/0 +movement_set: Mouse movement set to 0/-1 scroll_set: Mouse scroll set to 0/0 movement_set: Mouse movement set to 0/0 movement_set: Mouse movement set to -2/-2 @@ -7,12 +7,12 @@ movement_set: Mouse movement set to 0/0 movement_set: Mouse movement set to -2/-2 scroll_set: Mouse scroll set to 0/0 movement_set: Mouse movement set to 0/0 -movement_set: Mouse movement set to -3/-2 +movement_set: Mouse movement set to -2/-3 scroll_set: Mouse scroll set to 0/0 movement_set: Mouse movement set to 0/0 movement_set: Mouse movement set to -3/-3 scroll_set: Mouse scroll set to 0/0 movement_set: Mouse movement set to 0/0 -movement_set: Mouse movement set to 0/-3 +movement_set: Mouse movement set to -3/0 scroll_set: Mouse scroll set to 0/0 movement_set: Mouse movement set to 0/0 diff --git a/app/tests/mouse-keys/mouse-move/input-configs/move_diagonal_xy_swap/native_posix_64.conf b/app/tests/mouse-keys/mouse-move/input-configs/move_diagonal_xy_swap/native_posix_64.conf new file mode 100644 index 00000000000..65ed54bb204 --- /dev/null +++ b/app/tests/mouse-keys/mouse-move/input-configs/move_diagonal_xy_swap/native_posix_64.conf @@ -0,0 +1,6 @@ +CONFIG_GPIO=n +CONFIG_ZMK_BLE=n +CONFIG_LOG=y +CONFIG_LOG_BACKEND_SHOW_COLOR=n +CONFIG_ZMK_LOG_LEVEL_DBG=y +CONFIG_ZMK_MOUSE=y diff --git a/app/tests/mouse-keys/mouse-move/input-configs/move_diagonal_xy_swap/native_posix_64.keymap b/app/tests/mouse-keys/mouse-move/input-configs/move_diagonal_xy_swap/native_posix_64.keymap index d4cf5031252..719bca98f14 100644 --- a/app/tests/mouse-keys/mouse-move/input-configs/move_diagonal_xy_swap/native_posix_64.keymap +++ b/app/tests/mouse-keys/mouse-move/input-configs/move_diagonal_xy_swap/native_posix_64.keymap @@ -1,9 +1,12 @@ #include -#include #include #include #include +&mmv_input_listener { + xy-swap; +}; + / { keymap { compatible = "zmk,keymap"; @@ -16,15 +19,6 @@ >; }; }; - - input_configs { - compatible = "zmk,input-configs"; - - mmv { - device = <&mmv>; - xy-swap; - }; - }; }; diff --git a/app/tests/mouse-keys/mouse-move/move_diagonal/native_posix_64.conf b/app/tests/mouse-keys/mouse-move/move_diagonal/native_posix_64.conf new file mode 100644 index 00000000000..65ed54bb204 --- /dev/null +++ b/app/tests/mouse-keys/mouse-move/move_diagonal/native_posix_64.conf @@ -0,0 +1,6 @@ +CONFIG_GPIO=n +CONFIG_ZMK_BLE=n +CONFIG_LOG=y +CONFIG_LOG_BACKEND_SHOW_COLOR=n +CONFIG_ZMK_LOG_LEVEL_DBG=y +CONFIG_ZMK_MOUSE=y diff --git a/app/tests/mouse-keys/mouse-move/move_x/native_posix_64.conf b/app/tests/mouse-keys/mouse-move/move_x/native_posix_64.conf new file mode 100644 index 00000000000..65ed54bb204 --- /dev/null +++ b/app/tests/mouse-keys/mouse-move/move_x/native_posix_64.conf @@ -0,0 +1,6 @@ +CONFIG_GPIO=n +CONFIG_ZMK_BLE=n +CONFIG_LOG=y +CONFIG_LOG_BACKEND_SHOW_COLOR=n +CONFIG_ZMK_LOG_LEVEL_DBG=y +CONFIG_ZMK_MOUSE=y diff --git a/app/tests/mouse-keys/mouse-move/move_y/native_posix_64.conf b/app/tests/mouse-keys/mouse-move/move_y/native_posix_64.conf new file mode 100644 index 00000000000..65ed54bb204 --- /dev/null +++ b/app/tests/mouse-keys/mouse-move/move_y/native_posix_64.conf @@ -0,0 +1,6 @@ +CONFIG_GPIO=n +CONFIG_ZMK_BLE=n +CONFIG_LOG=y +CONFIG_LOG_BACKEND_SHOW_COLOR=n +CONFIG_ZMK_LOG_LEVEL_DBG=y +CONFIG_ZMK_MOUSE=y