summaryrefslogtreecommitdiffstats
path: root/drivers/hid/hid-uclogic-core.c
diff options
context:
space:
mode:
authorNikolai Kondrashov <spbnick@gmail.com>2022-04-14 13:09:35 +0200
committerJiri Kosina <jkosina@suse.cz>2022-04-21 10:05:48 +0200
commit2112b49eaa5c5cffc22ddd8b3b09f7d20bf13819 (patch)
treef0223d00d72a76e595e1fe796ac69fb944c96a6f /drivers/hid/hid-uclogic-core.c
parentHID: uclogic: Reduce indent for params format str/args (diff)
downloadlinux-2112b49eaa5c5cffc22ddd8b3b09f7d20bf13819.tar.xz
linux-2112b49eaa5c5cffc22ddd8b3b09f7d20bf13819.zip
HID: uclogic: Add support for bitmap dials
A bitmap dial sends reports with a dedicated bit per direction: 1 means clockwise rotation, 2 means counterclockwise, as opposed to the normal 1 and -1 values. Signed-off-by: Nikolai Kondrashov <spbnick@gmail.com> 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-core.c')
-rw-r--r--drivers/hid/hid-uclogic-core.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/drivers/hid/hid-uclogic-core.c b/drivers/hid/hid-uclogic-core.c
index 96f3fb8c492c..627f1d0c52f2 100644
--- a/drivers/hid/hid-uclogic-core.c
+++ b/drivers/hid/hid-uclogic-core.c
@@ -382,6 +382,12 @@ static int uclogic_raw_event_frame(
}
}
+ /* If need to, and can, transform the bitmap dial reports */
+ if (frame->bitmap_dial_byte > 0 && frame->bitmap_dial_byte < size) {
+ if (data[frame->bitmap_dial_byte] == 2)
+ data[frame->bitmap_dial_byte] = -1;
+ }
+
return 0;
}