Skip to content

Commit 33d02d5

Browse files
committed
uclogic: Do not focus on touch ring only
Accommodate both touch ring and touch strip in naming throughout hid-uclogic by talking about abstract "touch" instead of "touch ring", wherever possible.
1 parent a99ecb8 commit 33d02d5

5 files changed

Lines changed: 32 additions & 33 deletions

File tree

hid-uclogic-core.c

Lines changed: 9 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -144,7 +144,7 @@ static int uclogic_input_configured(struct hid_device *hdev,
144144
* Disable EV_MSC reports for touch ring interfaces to
145145
* make the Wacom driver pickup touch ring extents
146146
*/
147-
if (frame->touch_ring_byte > 0) {
147+
if (frame->touch_byte > 0) {
148148
__clear_bit(EV_MSC, hi->input->evbit);
149149
}
150150
}
@@ -364,9 +364,8 @@ static int uclogic_raw_event_frame(
364364
/* If need to, and can, set pad device ID for Wacom drivers */
365365
if (frame->dev_id_byte > 0 && frame->dev_id_byte < size) {
366366
/* If we also have a touch ring and the finger left it */
367-
if (frame->touch_ring_byte > 0 &&
368-
frame->touch_ring_byte < size &&
369-
data[frame->touch_ring_byte] == 0) {
367+
if (frame->touch_byte > 0 && frame->touch_byte < size &&
368+
data[frame->touch_byte] == 0) {
370369
data[frame->dev_id_byte] = 0;
371370
} else {
372371
data[frame->dev_id_byte] = 0xf;
@@ -400,15 +399,15 @@ static int uclogic_raw_event_frame(
400399
}
401400

402401
/* If need to, and can, transform the touch ring reports */
403-
if (frame->touch_ring_byte > 0 && frame->touch_ring_byte < size &&
404-
frame->touch_ring_flip_at != 0) {
405-
__s8 value = data[frame->touch_ring_byte];
402+
if (frame->touch_byte > 0 && frame->touch_byte < size &&
403+
frame->touch_flip_at != 0) {
404+
__s8 value = data[frame->touch_byte];
406405
if (value != 0) {
407-
value = frame->touch_ring_flip_at - value;
406+
value = frame->touch_flip_at - value;
408407
if (value < 0) {
409-
value = frame->touch_ring_max + value;
408+
value = frame->touch_max + value;
410409
}
411-
data[frame->touch_ring_byte] = value;
410+
data[frame->touch_byte] = value;
412411
}
413412
}
414413

hid-uclogic-params.c

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -94,10 +94,10 @@ static void uclogic_params_frame_hid_dbg(
9494
hid_dbg(hdev, "\t\t.suffix = %s\n", frame->suffix);
9595
hid_dbg(hdev, "\t\t.re_lsb = %u\n", frame->re_lsb);
9696
hid_dbg(hdev, "\t\t.dev_id_byte = %u\n", frame->dev_id_byte);
97-
hid_dbg(hdev, "\t\t.touch_ring_byte = %u\n", frame->touch_ring_byte);
98-
hid_dbg(hdev, "\t\t.touch_ring_max = %hhd\n", frame->touch_ring_max);
99-
hid_dbg(hdev, "\t\t.touch_ring_flip_at = %hhd\n",
100-
frame->touch_ring_flip_at);
97+
hid_dbg(hdev, "\t\t.touch_byte = %u\n", frame->touch_byte);
98+
hid_dbg(hdev, "\t\t.touch_max = %hhd\n", frame->touch_max);
99+
hid_dbg(hdev, "\t\t.touch_flip_at = %hhd\n",
100+
frame->touch_flip_at);
101101
hid_dbg(hdev, "\t\t.bitmap_dial_byte = %u\n",
102102
frame->bitmap_dial_byte);
103103
}
@@ -870,7 +870,7 @@ static int uclogic_params_huion_init(struct uclogic_params *params,
870870
&p.frame_list[1],
871871
uclogic_rdesc_v2_frame_touch_ring_arr,
872872
uclogic_rdesc_v2_frame_touch_ring_size,
873-
UCLOGIC_RDESC_V2_FRAME_TOUCH_RING_ID);
873+
UCLOGIC_RDESC_V2_FRAME_TOUCH_ID);
874874
if (rc != 0) {
875875
hid_err(hdev,
876876
"failed creating v2 frame touch ring "
@@ -880,10 +880,10 @@ static int uclogic_params_huion_init(struct uclogic_params *params,
880880
}
881881
p.frame_list[1].suffix = "Touch Ring";
882882
p.frame_list[1].dev_id_byte =
883-
UCLOGIC_RDESC_V2_FRAME_TOUCH_RING_DEV_ID_BYTE;
884-
p.frame_list[1].touch_ring_byte = 5;
885-
p.frame_list[1].touch_ring_max = 12;
886-
p.frame_list[1].touch_ring_flip_at = 6;
883+
UCLOGIC_RDESC_V2_FRAME_TOUCH_DEV_ID_BYTE;
884+
p.frame_list[1].touch_byte = 5;
885+
p.frame_list[1].touch_max = 12;
886+
p.frame_list[1].touch_flip_at = 6;
887887

888888
/* Create v2 frame dial parameters */
889889
rc = uclogic_params_frame_init_with_desc(
@@ -912,7 +912,7 @@ static int uclogic_params_huion_init(struct uclogic_params *params,
912912
UCLOGIC_RDESC_V2_FRAME_BUTTONS_ID;
913913
p.pen.subreport_list[1].value = 0xf0;
914914
p.pen.subreport_list[1].id =
915-
UCLOGIC_RDESC_V2_FRAME_TOUCH_RING_ID;
915+
UCLOGIC_RDESC_V2_FRAME_TOUCH_ID;
916916
p.pen.subreport_list[2].value = 0xf1;
917917
p.pen.subreport_list[2].id =
918918
UCLOGIC_RDESC_V2_FRAME_DIAL_ID;

hid-uclogic-params.h

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -128,31 +128,31 @@ struct uclogic_params_frame {
128128
* Offset of the Wacom-style device ID byte in the report, to be set
129129
* to pad device ID (0xf), for compatibility with Wacom drivers. Zero
130130
* if no changes to the report should be made. The ID byte will be set
131-
* to zero whenever the byte pointed by "touch_ring_byte" is zero, if
131+
* to zero whenever the byte pointed by "touch_byte" is zero, if
132132
* the latter is valid. Only valid if "id" is not zero.
133133
*/
134134
unsigned int dev_id_byte;
135135
/*
136-
* Offset of the touch ring state byte, in the report.
136+
* Offset of the touch ring/strip state byte, in the report.
137137
* Zero if not present. If dev_id_byte is also valid and non-zero,
138138
* then the device ID byte will be cleared when the byte pointed to by
139139
* this offset is zero. Only valid if "id" is not zero.
140140
*/
141-
unsigned int touch_ring_byte;
141+
unsigned int touch_byte;
142142

143143
/*
144-
* Maximum value of the touch ring report.
144+
* Maximum value of the touch ring/strip report.
145145
* The minimum valid value is considered to be one,
146146
* with zero being out-of-proximity (finger lift) value.
147147
*/
148-
__s8 touch_ring_max;
148+
__s8 touch_max;
149149

150150
/*
151-
* The value to anchor the reversed reports at.
151+
* The value to anchor the reversed touch ring/strip reports at.
152152
* I.e. one, if the reports should be flipped without offset.
153153
* Zero if no reversal should be done.
154154
*/
155-
__s8 touch_ring_flip_at;
155+
__s8 touch_flip_at;
156156
/*
157157
* Offset of the bitmap dial byte, in the report. Zero if not present.
158158
* Only valid if "id" is not zero. A bitmap dial sends reports with a

hid-uclogic-rdesc.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -718,8 +718,8 @@ const __u8 uclogic_rdesc_v2_frame_touch_ring_arr[] = {
718718
0x05, 0x01, /* Usage Page (Desktop), */
719719
0x09, 0x07, /* Usage (Keypad), */
720720
0xA1, 0x01, /* Collection (Application), */
721-
0x85, UCLOGIC_RDESC_V2_FRAME_TOUCH_RING_ID,
722-
/* Report ID (DIAL_ID), */
721+
0x85, UCLOGIC_RDESC_V2_FRAME_TOUCH_ID,
722+
/* Report ID (TOUCH_ID), */
723723
0x14, /* Logical Minimum (0), */
724724
0x05, 0x0D, /* Usage Page (Digitizer), */
725725
0x09, 0x39, /* Usage (Tablet Function Keys), */

hid-uclogic-rdesc.h

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -131,15 +131,15 @@ extern const size_t uclogic_rdesc_v1_frame_size;
131131
extern const __u8 uclogic_rdesc_v2_frame_buttons_arr[];
132132
extern const size_t uclogic_rdesc_v2_frame_buttons_size;
133133

134-
/* Report ID for tweaked v2 frame touch ring reports */
135-
#define UCLOGIC_RDESC_V2_FRAME_TOUCH_RING_ID 0xf8
134+
/* Report ID for tweaked v2 frame touch ring/strip reports */
135+
#define UCLOGIC_RDESC_V2_FRAME_TOUCH_ID 0xf8
136136

137137
/* Fixed report descriptor for (tweaked) v2 frame touch ring reports */
138138
extern const __u8 uclogic_rdesc_v2_frame_touch_ring_arr[];
139139
extern const size_t uclogic_rdesc_v2_frame_touch_ring_size;
140140

141-
/* Device ID byte offset in v2 frame touch ring reports */
142-
#define UCLOGIC_RDESC_V2_FRAME_TOUCH_RING_DEV_ID_BYTE 0x4
141+
/* Device ID byte offset in v2 frame touch ring/strip reports */
142+
#define UCLOGIC_RDESC_V2_FRAME_TOUCH_DEV_ID_BYTE 0x4
143143

144144
/* Report ID for tweaked v2 frame dial reports */
145145
#define UCLOGIC_RDESC_V2_FRAME_DIAL_ID 0xf9

0 commit comments

Comments
 (0)