From 2112b49eaa5c5cffc22ddd8b3b09f7d20bf13819 Mon Sep 17 00:00:00 2001 From: Nikolai Kondrashov Date: Thu, 14 Apr 2022 13:09:35 +0200 Subject: HID: uclogic: Add support for bitmap dials MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 Signed-off-by: José Expósito Signed-off-by: Jiri Kosina --- drivers/hid/hid-uclogic-core.c | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'drivers/hid/hid-uclogic-core.c') 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; } -- cgit v1.2.3