summaryrefslogtreecommitdiff
path: root/drivers/hid/hid-uclogic-rdesc-test.c
diff options
context:
space:
mode:
authorJosé Expósito <jose.exposito89@gmail.com>2022-06-11 14:39:13 +0300
committerJiri Kosina <jkosina@suse.cz>2022-06-15 16:51:46 +0300
commit867c8925442579f7c4a8901f02a54fb07e99c2be (patch)
tree3b10c702082d30b5458c860fbeae2a1f5e26a50f /drivers/hid/hid-uclogic-rdesc-test.c
parent2d167aaba3864cf8f46b8364aa33e780de1da8f4 (diff)
downloadlinux-867c8925442579f7c4a8901f02a54fb07e99c2be.tar.xz
HID: uclogic: Allow to generate frame templates
Add a new template placeholder to allow configuring the number of buttons in the drawing tablet frame and update the KUnit tests to cover the new case. Signed-off-by: José Expósito <jose.exposito89@gmail.com> Signed-off-by: Jiri Kosina <jkosina@suse.cz>
Diffstat (limited to 'drivers/hid/hid-uclogic-rdesc-test.c')
-rw-r--r--drivers/hid/hid-uclogic-rdesc-test.c36
1 files changed, 36 insertions, 0 deletions
diff --git a/drivers/hid/hid-uclogic-rdesc-test.c b/drivers/hid/hid-uclogic-rdesc-test.c
index ded59e226230..ebebffef5f8a 100644
--- a/drivers/hid/hid-uclogic-rdesc-test.c
+++ b/drivers/hid/hid-uclogic-rdesc-test.c
@@ -31,6 +31,10 @@ static const s32 params_pen_some[] = {
[UCLOGIC_RDESC_PEN_PH_ID_X_PM] = 0xBB,
};
+static const s32 params_frame_all[UCLOGIC_RDESC_PH_ID_NUM] = {
+ [UCLOGIC_RDESC_FRAME_PH_ID_UM] = 0xFF,
+};
+
static const __u8 template_empty[] = { };
static const __u8 template_small[] = { 0x00 };
static const __u8 template_no_ph[] = { 0xAA, 0xFE, 0xAA, 0xED, 0x1D };
@@ -39,6 +43,10 @@ static const __u8 template_pen_ph_end[] = {
0xAA, 0xBB, UCLOGIC_RDESC_PEN_PH_HEAD
};
+static const __u8 template_btn_ph_end[] = {
+ 0xAA, 0xBB, UCLOGIC_RDESC_FRAME_PH_BTN_HEAD
+};
+
static const __u8 template_pen_all_params[] = {
UCLOGIC_RDESC_PEN_PH(X_LM),
0x47, UCLOGIC_RDESC_PEN_PH(X_PM),
@@ -55,6 +63,18 @@ static const __u8 expected_pen_all_params[] = {
0x00, 0xEE, 0x00, 0x00, 0x00,
};
+static const __u8 template_frame_all_params[] = {
+ 0x01, 0x02,
+ UCLOGIC_RDESC_FRAME_PH_BTN,
+ 0x99,
+};
+
+static const __u8 expected_frame_all_params[] = {
+ 0x01, 0x02,
+ 0x2A, 0xFF, 0x00,
+ 0x99,
+};
+
static const __u8 template_pen_some_params[] = {
0x01, 0x02,
UCLOGIC_RDESC_PEN_PH(X_LM),
@@ -109,6 +129,14 @@ static struct uclogic_template_case uclogic_template_cases[] = {
.expected = template_pen_ph_end,
},
{
+ .name = "Frame button placeholder at the end, without ID",
+ .template = template_btn_ph_end,
+ .template_size = sizeof(template_btn_ph_end),
+ .param_list = params_frame_all,
+ .param_num = ARRAY_SIZE(params_frame_all),
+ .expected = template_btn_ph_end,
+ },
+ {
.name = "All params present in the pen template",
.template = template_pen_all_params,
.template_size = sizeof(template_pen_all_params),
@@ -117,6 +145,14 @@ static struct uclogic_template_case uclogic_template_cases[] = {
.expected = expected_pen_all_params,
},
{
+ .name = "All params present in the frame template",
+ .template = template_frame_all_params,
+ .template_size = sizeof(template_frame_all_params),
+ .param_list = params_frame_all,
+ .param_num = ARRAY_SIZE(params_frame_all),
+ .expected = expected_frame_all_params,
+ },
+ {
.name = "Some params present in the pen template (complete param list)",
.template = template_pen_some_params,
.template_size = sizeof(template_pen_some_params),