Skip to content

Commit caf7e93

Browse files
spbnickJiri Kosina
authored andcommitted
HID: 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. Signed-off-by: Nikolai Kondrashov <[email protected]> Signed-off-by: José Expósito <[email protected]> Signed-off-by: Jiri Kosina <[email protected]>
1 parent 945d5dd commit caf7e93

File tree

5 files changed

+39
-40
lines changed

5 files changed

+39
-40
lines changed

drivers/hid/hid-uclogic-core.c

Lines changed: 9 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -134,7 +134,7 @@ static int uclogic_input_configured(struct hid_device *hdev,
134134
* Disable EV_MSC reports for touch ring interfaces to
135135
* make the Wacom driver pickup touch ring extents
136136
*/
137-
if (frame->touch_ring_byte > 0)
137+
if (frame->touch_byte > 0)
138138
__clear_bit(EV_MSC, hi->input->evbit);
139139
}
140140
}
@@ -351,9 +351,8 @@ static int uclogic_raw_event_frame(
351351
/* If need to, and can, set pad device ID for Wacom drivers */
352352
if (frame->dev_id_byte > 0 && frame->dev_id_byte < size) {
353353
/* If we also have a touch ring and the finger left it */
354-
if (frame->touch_ring_byte > 0 &&
355-
frame->touch_ring_byte < size &&
356-
data[frame->touch_ring_byte] == 0) {
354+
if (frame->touch_byte > 0 && frame->touch_byte < size &&
355+
data[frame->touch_byte] == 0) {
357356
data[frame->dev_id_byte] = 0;
358357
} else {
359358
data[frame->dev_id_byte] = 0xf;
@@ -387,16 +386,15 @@ static int uclogic_raw_event_frame(
387386
}
388387

389388
/* If need to, and can, transform the touch ring reports */
390-
if (frame->touch_ring_byte > 0 && frame->touch_ring_byte < size &&
391-
frame->touch_ring_flip_at != 0) {
392-
__s8 value = data[frame->touch_ring_byte];
393-
389+
if (frame->touch_byte > 0 && frame->touch_byte < size &&
390+
frame->touch_flip_at != 0) {
391+
__s8 value = data[frame->touch_byte];
394392
if (value != 0) {
395-
value = frame->touch_ring_flip_at - value;
393+
value = frame->touch_flip_at - value;
396394
if (value < 0)
397-
value = frame->touch_ring_max + value;
395+
value = frame->touch_max + value;
398396

399-
data[frame->touch_ring_byte] = value;
397+
data[frame->touch_byte] = value;
400398
}
401399
}
402400

drivers/hid/hid-uclogic-params.c

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -93,10 +93,10 @@ static void uclogic_params_frame_hid_dbg(
9393
hid_dbg(hdev, "\t\t.suffix = %s\n", frame->suffix);
9494
hid_dbg(hdev, "\t\t.re_lsb = %u\n", frame->re_lsb);
9595
hid_dbg(hdev, "\t\t.dev_id_byte = %u\n", frame->dev_id_byte);
96-
hid_dbg(hdev, "\t\t.touch_ring_byte = %u\n", frame->touch_ring_byte);
97-
hid_dbg(hdev, "\t\t.touch_ring_max = %hhd\n", frame->touch_ring_max);
98-
hid_dbg(hdev, "\t\t.touch_ring_flip_at = %hhd\n",
99-
frame->touch_ring_flip_at);
96+
hid_dbg(hdev, "\t\t.touch_byte = %u\n", frame->touch_byte);
97+
hid_dbg(hdev, "\t\t.touch_max = %hhd\n", frame->touch_max);
98+
hid_dbg(hdev, "\t\t.touch_flip_at = %hhd\n",
99+
frame->touch_flip_at);
100100
hid_dbg(hdev, "\t\t.bitmap_dial_byte = %u\n",
101101
frame->bitmap_dial_byte);
102102
}
@@ -877,7 +877,7 @@ static int uclogic_params_huion_init(struct uclogic_params *params,
877877
&p.frame_list[1],
878878
uclogic_rdesc_v2_frame_touch_ring_arr,
879879
uclogic_rdesc_v2_frame_touch_ring_size,
880-
UCLOGIC_RDESC_V2_FRAME_TOUCH_RING_ID);
880+
UCLOGIC_RDESC_V2_FRAME_TOUCH_ID);
881881
if (rc != 0) {
882882
hid_err(hdev,
883883
"failed creating v2 frame touch ring parameters: %d\n",
@@ -886,10 +886,10 @@ static int uclogic_params_huion_init(struct uclogic_params *params,
886886
}
887887
p.frame_list[1].suffix = "Touch Ring";
888888
p.frame_list[1].dev_id_byte =
889-
UCLOGIC_RDESC_V2_FRAME_TOUCH_RING_DEV_ID_BYTE;
890-
p.frame_list[1].touch_ring_byte = 5;
891-
p.frame_list[1].touch_ring_max = 12;
892-
p.frame_list[1].touch_ring_flip_at = 6;
889+
UCLOGIC_RDESC_V2_FRAME_TOUCH_DEV_ID_BYTE;
890+
p.frame_list[1].touch_byte = 5;
891+
p.frame_list[1].touch_max = 12;
892+
p.frame_list[1].touch_flip_at = 6;
893893

894894
/* Create v2 frame dial parameters */
895895
rc = uclogic_params_frame_init_with_desc(
@@ -917,7 +917,7 @@ static int uclogic_params_huion_init(struct uclogic_params *params,
917917
UCLOGIC_RDESC_V2_FRAME_BUTTONS_ID;
918918
p.pen.subreport_list[1].value = 0xf0;
919919
p.pen.subreport_list[1].id =
920-
UCLOGIC_RDESC_V2_FRAME_TOUCH_RING_ID;
920+
UCLOGIC_RDESC_V2_FRAME_TOUCH_ID;
921921
p.pen.subreport_list[2].value = 0xf1;
922922
p.pen.subreport_list[2].id =
923923
UCLOGIC_RDESC_V2_FRAME_DIAL_ID;

drivers/hid/hid-uclogic-params.h

Lines changed: 14 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -128,31 +128,32 @@ 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;
142-
143-
/*
144-
* Maximum value of the touch ring report.
145-
* The minimum valid value is considered to be one,
146-
* with zero being out-of-proximity (finger lift) value.
147-
*/
148-
__s8 touch_ring_max;
149-
141+
unsigned int touch_byte;
150142
/*
151-
* The value to anchor the reversed reports at.
143+
* The value to anchor the reversed touch ring/strip reports at.
152144
* I.e. one, if the reports should be flipped without offset.
153145
* Zero if no reversal should be done.
146+
* Only valid if "touch_byte" is valid and not zero.
147+
*/
148+
__s8 touch_flip_at;
149+
/*
150+
* Maximum value of the touch ring/strip report around which the value
151+
* should be wrapped when flipping according to "touch_flip_at".
152+
* The minimum valid value is considered to be one, with zero being
153+
* out-of-proximity (finger lift) value.
154+
* Only valid if "touch_flip_at" is valid and not zero.
154155
*/
155-
__s8 touch_ring_flip_at;
156+
__s8 touch_max;
156157
/*
157158
* Offset of the bitmap dial byte, in the report. Zero if not present.
158159
* Only valid if "id" is not zero. A bitmap dial sends reports with a

drivers/hid/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), */

drivers/hid/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)