Skip to content

Commit a4442d0

Browse files
committed
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.
1 parent a19717f commit a4442d0

2 files changed

Lines changed: 8 additions & 7 deletions

File tree

hid-uclogic-core.c

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -399,15 +399,16 @@ static int uclogic_raw_event_frame(
399399
}
400400

401401
/* If need to, and can, transform the touch ring reports */
402-
if (frame->touch_byte > 0 && frame->touch_byte < size &&
403-
frame->touch_flip_at != 0) {
402+
if (frame->touch_byte > 0 && frame->touch_byte < size) {
404403
__s8 value = data[frame->touch_byte];
405404
if (value != 0) {
406-
value = frame->touch_flip_at - value;
407-
if (value < 0) {
408-
value = frame->touch_max + value;
405+
if (frame->touch_flip_at != 0) {
406+
value = frame->touch_flip_at - value;
407+
if (value <= 0) {
408+
value = frame->touch_max + value;
409+
}
409410
}
410-
data[frame->touch_byte] = value;
411+
data[frame->touch_byte] = value - 1;
411412
}
412413
}
413414

hid-uclogic-params.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -883,7 +883,7 @@ static int uclogic_params_huion_init(struct uclogic_params *params,
883883
UCLOGIC_RDESC_V2_FRAME_TOUCH_DEV_ID_BYTE;
884884
p.frame_list[1].touch_byte = 5;
885885
p.frame_list[1].touch_max = 12;
886-
p.frame_list[1].touch_flip_at = 6;
886+
p.frame_list[1].touch_flip_at = 7;
887887

888888
/* Create v2 frame dial parameters */
889889
rc = uclogic_params_frame_init_with_desc(

0 commit comments

Comments
 (0)