Skip to content

Commit d729461

Browse files
committed
uclogic: Support custom device suffix for frames
Support assigning custom device name suffixes to frame input devices instead of just "Pad". This allows distinguishing multiple frame input devices, e.g. for Huion HS610.
1 parent 68ba46e commit d729461

2 files changed

Lines changed: 31 additions & 21 deletions

File tree

hid-uclogic-core.c

Lines changed: 25 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -120,6 +120,8 @@ static int uclogic_input_configured(struct hid_device *hdev,
120120
for (i = 0; i < ARRAY_SIZE(params->frame_list); i++) {
121121
frame = &params->frame_list[i];
122122
if (hi->report->id == frame->id) {
123+
/* Assign custom suffix, if any */
124+
suffix = frame->suffix;
123125
/*
124126
* Disable EV_MSC reports for touch ring interfaces to
125127
* make the Wacom driver pickup touch ring extents
@@ -130,27 +132,29 @@ static int uclogic_input_configured(struct hid_device *hdev,
130132
}
131133
}
132134

133-
field = hi->report->field[0];
134-
135-
switch (field->application) {
136-
case HID_GD_KEYBOARD:
137-
suffix = "Keyboard";
138-
break;
139-
case HID_GD_MOUSE:
140-
suffix = "Mouse";
141-
break;
142-
case HID_GD_KEYPAD:
143-
suffix = "Pad";
144-
break;
145-
case HID_DG_PEN:
146-
suffix = "Pen";
147-
break;
148-
case HID_CP_CONSUMER_CONTROL:
149-
suffix = "Consumer Control";
150-
break;
151-
case HID_GD_SYSTEM_CONTROL:
152-
suffix = "System Control";
153-
break;
135+
if (!suffix) {
136+
field = hi->report->field[0];
137+
138+
switch (field->application) {
139+
case HID_GD_KEYBOARD:
140+
suffix = "Keyboard";
141+
break;
142+
case HID_GD_MOUSE:
143+
suffix = "Mouse";
144+
break;
145+
case HID_GD_KEYPAD:
146+
suffix = "Pad";
147+
break;
148+
case HID_DG_PEN:
149+
suffix = "Pen";
150+
break;
151+
case HID_CP_CONSUMER_CONTROL:
152+
suffix = "Consumer Control";
153+
break;
154+
case HID_GD_SYSTEM_CONTROL:
155+
suffix = "System Control";
156+
break;
157+
}
154158
}
155159

156160
if (suffix) {

hid-uclogic-params.h

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -114,6 +114,10 @@ struct uclogic_params_frame {
114114
* Report ID, if reports should be tweaked, zero if not.
115115
*/
116116
unsigned int id;
117+
/*
118+
* The suffix to add to the input device name, if not NULL.
119+
*/
120+
const char *suffix;
117121
/*
118122
* Number of the least-significant bit of the 2-bit state of a rotary
119123
* encoder, in the report. Cannot point to a 2-bit field crossing a
@@ -212,6 +216,7 @@ extern int uclogic_params_init(struct uclogic_params *params,
212216
".frame_list[0].desc_ptr = %p\n" \
213217
".frame_list[0].desc_size = %u\n" \
214218
".frame_list[0].id = %u\n" \
219+
".frame_list[0].suffix = %s\n" \
215220
".frame_list[0].re_lsb = %u\n" \
216221
".frame_list[0].dev_id_byte = %u\n" \
217222
".frame_list[0].touch_ring_byte = %u\n" \
@@ -234,6 +239,7 @@ extern int uclogic_params_init(struct uclogic_params *params,
234239
(_params)->frame_list[0].desc_ptr, \
235240
(_params)->frame_list[0].desc_size, \
236241
(_params)->frame_list[0].id, \
242+
(_params)->frame_list[0].suffix, \
237243
(_params)->frame_list[0].re_lsb, \
238244
(_params)->frame_list[0].dev_id_byte, \
239245
(_params)->frame_list[0].touch_ring_byte, \

0 commit comments

Comments
 (0)