Skip to content

Commit fbc08b4

Browse files
spbnickJiri Kosina
authored andcommitted
HID: uclogic: Always shift touch reports to zero
Always decrement touch report values to have the range start with zero, regardless if flipped or not. This fixes the future non-flipped touch strip reports. Signed-off-by: Nikolai Kondrashov <[email protected]> Signed-off-by: José Expósito <[email protected]> Signed-off-by: Jiri Kosina <[email protected]>
1 parent caf7e93 commit fbc08b4

File tree

2 files changed

+9
-8
lines changed

2 files changed

+9
-8
lines changed

drivers/hid/hid-uclogic-core.c

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -386,15 +386,16 @@ static int uclogic_raw_event_frame(
386386
}
387387

388388
/* If need to, and can, transform the touch ring reports */
389-
if (frame->touch_byte > 0 && frame->touch_byte < size &&
390-
frame->touch_flip_at != 0) {
389+
if (frame->touch_byte > 0 && frame->touch_byte < size) {
391390
__s8 value = data[frame->touch_byte];
392-
if (value != 0) {
393-
value = frame->touch_flip_at - value;
394-
if (value < 0)
395-
value = frame->touch_max + value;
396391

397-
data[frame->touch_byte] = value;
392+
if (value != 0) {
393+
if (frame->touch_flip_at != 0) {
394+
value = frame->touch_flip_at - value;
395+
if (value <= 0)
396+
value = frame->touch_max + value;
397+
}
398+
data[frame->touch_byte] = value - 1;
398399
}
399400
}
400401

drivers/hid/hid-uclogic-params.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -889,7 +889,7 @@ static int uclogic_params_huion_init(struct uclogic_params *params,
889889
UCLOGIC_RDESC_V2_FRAME_TOUCH_DEV_ID_BYTE;
890890
p.frame_list[1].touch_byte = 5;
891891
p.frame_list[1].touch_max = 12;
892-
p.frame_list[1].touch_flip_at = 6;
892+
p.frame_list[1].touch_flip_at = 7;
893893

894894
/* Create v2 frame dial parameters */
895895
rc = uclogic_params_frame_init_with_desc(

0 commit comments

Comments
 (0)