xref: /linux/drivers/hid/hid-uclogic-core.c (revision ca220141fa8ebae09765a242076b2b77338106b0)
1 // SPDX-License-Identifier: GPL-2.0+
2 /*
3  *  HID driver for UC-Logic devices not fully compliant with HID standard
4  *
5  *  Copyright (c) 2010-2014 Nikolai Kondrashov
6  *  Copyright (c) 2013 Martin Rusko
7  */
8 
9 /*
10  * This program is free software; you can redistribute it and/or modify it
11  * under the terms of the GNU General Public License as published by the Free
12  * Software Foundation; either version 2 of the License, or (at your option)
13  * any later version.
14  */
15 
16 #include <linux/device.h>
17 #include <linux/hid.h>
18 #include <linux/module.h>
19 #include <linux/timer.h>
20 #include "usbhid/usbhid.h"
21 #include "hid-uclogic-params.h"
22 
23 #include "hid-ids.h"
24 
25 /**
26  * uclogic_inrange_timeout - handle pen in-range state timeout.
27  * Emulate input events normally generated when pen goes out of range for
28  * tablets which don't report that.
29  *
30  * @t:	The timer the timeout handler is attached to, stored in a struct
31  *	uclogic_drvdata.
32  */
33 static void uclogic_inrange_timeout(struct timer_list *t)
34 {
35 	struct uclogic_drvdata *drvdata = timer_container_of(drvdata, t,
36 							     inrange_timer);
37 	struct input_dev *input = drvdata->pen_input;
38 
39 	if (input == NULL)
40 		return;
41 	input_report_abs(input, ABS_PRESSURE, 0);
42 	/* If BTN_TOUCH state is changing */
43 	if (test_bit(BTN_TOUCH, input->key)) {
44 		input_event(input, EV_MSC, MSC_SCAN,
45 				/* Digitizer Tip Switch usage */
46 				0xd0042);
47 		input_report_key(input, BTN_TOUCH, 0);
48 	}
49 	input_report_key(input, BTN_TOOL_PEN, 0);
50 	input_sync(input);
51 }
52 
53 static const __u8 *uclogic_report_fixup(struct hid_device *hdev, __u8 *rdesc,
54 					unsigned int *rsize)
55 {
56 	struct uclogic_drvdata *drvdata = hid_get_drvdata(hdev);
57 
58 	if (drvdata->desc_ptr != NULL) {
59 		*rsize = drvdata->desc_size;
60 		return drvdata->desc_ptr;
61 	}
62 	return rdesc;
63 }
64 
65 /* Buttons considered valid tablet pad inputs. */
66 static const unsigned int uclogic_extra_input_mapping[] = {
67 	BTN_0,
68 	BTN_1,
69 	BTN_2,
70 	BTN_3,
71 	BTN_4,
72 	BTN_5,
73 	BTN_6,
74 	BTN_7,
75 	BTN_8,
76 	BTN_RIGHT,
77 	BTN_MIDDLE,
78 	BTN_SIDE,
79 	BTN_EXTRA,
80 	BTN_FORWARD,
81 	BTN_BACK,
82 	BTN_B,
83 	BTN_A,
84 	BTN_BASE,
85 	BTN_BASE2,
86 	BTN_X
87 };
88 
89 static int uclogic_input_mapping(struct hid_device *hdev,
90 				 struct hid_input *hi,
91 				 struct hid_field *field,
92 				 struct hid_usage *usage,
93 				 unsigned long **bit,
94 				 int *max)
95 {
96 	struct uclogic_drvdata *drvdata = hid_get_drvdata(hdev);
97 	struct uclogic_params *params = &drvdata->params;
98 
99 	if (field->application == HID_GD_KEYPAD) {
100 		/*
101 		 * Remap input buttons to sensible ones that are not invalid.
102 		 * This only affects previous behavior for devices with more than ten or so buttons.
103 		 */
104 		const int key = (usage->hid & HID_USAGE) - 1;
105 
106 		if (key < ARRAY_SIZE(uclogic_extra_input_mapping)) {
107 			hid_map_usage(hi,
108 				      usage,
109 				      bit,
110 				      max,
111 				      EV_KEY,
112 				      uclogic_extra_input_mapping[key]);
113 			return 1;
114 		}
115 	} else if (field->application == HID_DG_PEN) {
116 		/* Discard invalid pen usages */
117 		if (params->pen.usage_invalid)
118 			return -1;
119 	}
120 
121 	/* Let hid-core decide what to do */
122 	return 0;
123 }
124 
125 static int uclogic_input_configured(struct hid_device *hdev,
126 		struct hid_input *hi)
127 {
128 	struct uclogic_drvdata *drvdata = hid_get_drvdata(hdev);
129 	struct uclogic_params *params = &drvdata->params;
130 	const char *suffix = NULL;
131 	struct hid_field *field;
132 	size_t i;
133 	const struct uclogic_params_frame *frame;
134 
135 	/* no report associated (HID_QUIRK_MULTI_INPUT not set) */
136 	if (!hi->report)
137 		return 0;
138 
139 	/*
140 	 * If this is the input corresponding to the pen report
141 	 * in need of tweaking.
142 	 */
143 	if (hi->report->id == params->pen.id) {
144 		/* Remember the input device so we can simulate events */
145 		drvdata->pen_input = hi->input;
146 	}
147 
148 	/* If it's one of the frame devices */
149 	for (i = 0; i < ARRAY_SIZE(params->frame_list); i++) {
150 		frame = &params->frame_list[i];
151 		if (hi->report->id == frame->id) {
152 			/* Assign custom suffix, if any */
153 			suffix = frame->suffix;
154 			/*
155 			 * Disable EV_MSC reports for touch ring interfaces to
156 			 * make the Wacom driver pickup touch ring extents
157 			 */
158 			if (frame->touch_byte > 0)
159 				__clear_bit(EV_MSC, hi->input->evbit);
160 		}
161 	}
162 
163 	if (!suffix) {
164 		field = hi->report->field[0];
165 
166 		switch (field->application) {
167 		case HID_GD_KEYBOARD:
168 			suffix = "Keyboard";
169 			break;
170 		case HID_GD_MOUSE:
171 			suffix = "Mouse";
172 			break;
173 		case HID_GD_KEYPAD:
174 			suffix = "Pad";
175 			break;
176 		case HID_DG_PEN:
177 		case HID_DG_DIGITIZER:
178 			suffix = "Pen";
179 			break;
180 		case HID_CP_CONSUMER_CONTROL:
181 			suffix = "Consumer Control";
182 			break;
183 		case HID_GD_SYSTEM_CONTROL:
184 			suffix = "System Control";
185 			break;
186 		}
187 	} else {
188 		hi->input->name = devm_kasprintf(&hdev->dev, GFP_KERNEL,
189 						 "%s %s", hdev->name, suffix);
190 		if (!hi->input->name)
191 			return -ENOMEM;
192 	}
193 
194 	return 0;
195 }
196 
197 static int uclogic_probe(struct hid_device *hdev,
198 		const struct hid_device_id *id)
199 {
200 	int rc;
201 	struct uclogic_drvdata *drvdata = NULL;
202 	bool params_initialized = false;
203 
204 	if (!hid_is_usb(hdev))
205 		return -EINVAL;
206 
207 	/*
208 	 * libinput requires the pad interface to be on a different node
209 	 * than the pen, so use QUIRK_MULTI_INPUT for all tablets.
210 	 */
211 	hdev->quirks |= HID_QUIRK_MULTI_INPUT;
212 	hdev->quirks |= HID_QUIRK_HIDINPUT_FORCE;
213 
214 	/* Allocate and assign driver data */
215 	drvdata = devm_kzalloc(&hdev->dev, sizeof(*drvdata), GFP_KERNEL);
216 	if (drvdata == NULL) {
217 		rc = -ENOMEM;
218 		goto failure;
219 	}
220 	timer_setup(&drvdata->inrange_timer, uclogic_inrange_timeout, 0);
221 	drvdata->re_state = U8_MAX;
222 	drvdata->quirks = id->driver_data;
223 	hid_set_drvdata(hdev, drvdata);
224 
225 	/* Initialize the device and retrieve interface parameters */
226 	rc = uclogic_params_init(&drvdata->params, hdev);
227 	if (rc != 0) {
228 		hid_err(hdev, "failed probing parameters: %d\n", rc);
229 		goto failure;
230 	}
231 	params_initialized = true;
232 	hid_dbg(hdev, "parameters:\n");
233 	uclogic_params_hid_dbg(hdev, &drvdata->params);
234 	if (drvdata->params.invalid) {
235 		hid_info(hdev, "interface is invalid, ignoring\n");
236 		rc = -ENODEV;
237 		goto failure;
238 	}
239 
240 	/* Generate replacement report descriptor */
241 	rc = uclogic_params_get_desc(&drvdata->params,
242 				     &drvdata->desc_ptr,
243 				     &drvdata->desc_size);
244 	if (rc) {
245 		hid_err(hdev,
246 			"failed generating replacement report descriptor: %d\n",
247 			rc);
248 		goto failure;
249 	}
250 
251 	rc = hid_parse(hdev);
252 	if (rc) {
253 		hid_err(hdev, "parse failed\n");
254 		goto failure;
255 	}
256 
257 	rc = hid_hw_start(hdev, HID_CONNECT_DEFAULT);
258 	if (rc) {
259 		hid_err(hdev, "hw start failed\n");
260 		goto failure;
261 	}
262 
263 	return 0;
264 failure:
265 	/* Assume "remove" might not be called if "probe" failed */
266 	if (params_initialized)
267 		uclogic_params_cleanup(&drvdata->params);
268 	return rc;
269 }
270 
271 static int uclogic_resume(struct hid_device *hdev)
272 {
273 	int rc;
274 	struct uclogic_params params;
275 
276 	/* Re-initialize the device, but discard parameters */
277 	rc = uclogic_params_init(&params, hdev);
278 	if (rc != 0)
279 		hid_err(hdev, "failed to re-initialize the device\n");
280 	else
281 		uclogic_params_cleanup(&params);
282 
283 	return rc;
284 }
285 
286 /**
287  * uclogic_exec_event_hook - if the received event is hooked schedules the
288  * associated work.
289  *
290  * @p:		Tablet interface report parameters.
291  * @event:	Raw event.
292  * @size:	The size of event.
293  *
294  * Returns:
295  *	Whether the event was hooked or not.
296  */
297 static bool uclogic_exec_event_hook(struct uclogic_params *p, u8 *event, int size)
298 {
299 	struct uclogic_raw_event_hook *curr;
300 
301 	if (!p->event_hooks)
302 		return false;
303 
304 	list_for_each_entry(curr, &p->event_hooks->list, list) {
305 		if (curr->size == size && memcmp(curr->event, event, size) == 0) {
306 			schedule_work(&curr->work);
307 			return true;
308 		}
309 	}
310 
311 	return false;
312 }
313 
314 /**
315  * uclogic_raw_event_pen - handle raw pen events (pen HID reports).
316  *
317  * @drvdata:	Driver data.
318  * @data:	Report data buffer, can be modified.
319  * @size:	Report data size, bytes.
320  *
321  * Returns:
322  *	Negative value on error (stops event delivery), zero for success.
323  */
324 static int uclogic_raw_event_pen(struct uclogic_drvdata *drvdata,
325 					u8 *data, int size)
326 {
327 	struct uclogic_params_pen *pen = &drvdata->params.pen;
328 
329 	WARN_ON(drvdata == NULL);
330 	WARN_ON(data == NULL && size != 0);
331 
332 	/* If in-range reports are inverted */
333 	if (pen->inrange ==
334 		UCLOGIC_PARAMS_PEN_INRANGE_INVERTED) {
335 		/* Invert the in-range bit */
336 		data[1] ^= 0x40;
337 	}
338 	/*
339 	 * If report contains fragmented high-resolution pen
340 	 * coordinates
341 	 */
342 	if (size >= 10 && pen->fragmented_hires) {
343 		u8 pressure_low_byte;
344 		u8 pressure_high_byte;
345 
346 		/* Lift pressure bytes */
347 		pressure_low_byte = data[6];
348 		pressure_high_byte = data[7];
349 		/*
350 		 * Move Y coord to make space for high-order X
351 		 * coord byte
352 		 */
353 		data[6] = data[5];
354 		data[5] = data[4];
355 		/* Move high-order X coord byte */
356 		data[4] = data[8];
357 		/* Move high-order Y coord byte */
358 		data[7] = data[9];
359 		/* Place pressure bytes */
360 		data[8] = pressure_low_byte;
361 		data[9] = pressure_high_byte;
362 	}
363 	if (size == 12 && pen->fragmented_hires2) {
364 		// 00 00 when on the left side, 01 00 in the right
365 		// we move these to the end of the x coord (u16) to create a correct x coord (u32)
366 		u8 lsb_low_byte = data[10];
367 		u8 lsb_high_byte = data[11];
368 
369 		// shift everything right by 2 bytes, to make space for the moved lsb
370 		data[11] = data[9];
371 		data[10] = data[8];
372 		data[9] = data[7];
373 		data[8] = data[6];
374 		data[7] = data[5];
375 		data[6] = data[4];
376 
377 		data[4] = lsb_low_byte;
378 		data[5] = lsb_high_byte;
379 	}
380 	/* If we need to emulate in-range detection */
381 	if (pen->inrange == UCLOGIC_PARAMS_PEN_INRANGE_NONE) {
382 		/* Set in-range bit */
383 		data[1] |= 0x40;
384 		/* (Re-)start in-range timeout */
385 		mod_timer(&drvdata->inrange_timer,
386 				jiffies + msecs_to_jiffies(100));
387 	}
388 	/* If we report tilt and Y direction is flipped */
389 	if (size >= 12 && pen->tilt_y_flipped)
390 		data[11] = -data[11];
391 
392 	return 0;
393 }
394 
395 /**
396  * uclogic_raw_event_frame - handle raw frame events (frame HID reports).
397  *
398  * @drvdata:	Driver data.
399  * @frame:	The parameters of the frame controls to handle.
400  * @data:	Report data buffer, can be modified.
401  * @size:	Report data size, bytes.
402  *
403  * Returns:
404  *	Negative value on error (stops event delivery), zero for success.
405  */
406 static int uclogic_raw_event_frame(
407 		struct uclogic_drvdata *drvdata,
408 		const struct uclogic_params_frame *frame,
409 		u8 *data, int size)
410 {
411 	WARN_ON(drvdata == NULL);
412 	WARN_ON(data == NULL && size != 0);
413 
414 	/* If need to, and can, set pad device ID for Wacom drivers */
415 	if (frame->dev_id_byte > 0 && frame->dev_id_byte < size) {
416 		/* If we also have a touch ring and the finger left it */
417 		if (frame->touch_byte > 0 && frame->touch_byte < size &&
418 		    data[frame->touch_byte] == 0) {
419 			data[frame->dev_id_byte] = 0;
420 		} else {
421 			data[frame->dev_id_byte] = 0xf;
422 		}
423 	}
424 
425 	/* If need to, and can, read rotary encoder state change */
426 	if (frame->re_lsb > 0 && frame->re_lsb / 8 < size) {
427 		unsigned int byte = frame->re_lsb / 8;
428 		unsigned int bit = frame->re_lsb % 8;
429 
430 		u8 change;
431 		u8 prev_state = drvdata->re_state;
432 		/* Read Gray-coded state */
433 		u8 state = (data[byte] >> bit) & 0x3;
434 		/* Encode state change into 2-bit signed integer */
435 		if ((prev_state == 1 && state == 0) ||
436 		    (prev_state == 2 && state == 3)) {
437 			change = 1;
438 		} else if ((prev_state == 2 && state == 0) ||
439 			   (prev_state == 1 && state == 3)) {
440 			change = 3;
441 		} else {
442 			change = 0;
443 		}
444 		/* Write change */
445 		data[byte] = (data[byte] & ~((u8)3 << bit)) |
446 				(change << bit);
447 		/* Remember state */
448 		drvdata->re_state = state;
449 	}
450 
451 	/* If need to, and can, transform the touch ring reports */
452 	if (frame->touch_byte > 0 && frame->touch_byte < size) {
453 		__s8 value = data[frame->touch_byte];
454 
455 		if (value != 0) {
456 			if (frame->touch_flip_at != 0) {
457 				value = frame->touch_flip_at - value;
458 				if (value <= 0)
459 					value = frame->touch_max + value;
460 			}
461 			data[frame->touch_byte] = value - 1;
462 		}
463 	}
464 
465 	/* If need to, and can, transform the bitmap dial reports */
466 	if (frame->bitmap_dial_byte > 0 && frame->bitmap_dial_byte < size) {
467 		switch (data[frame->bitmap_dial_byte]) {
468 		case 2:
469 			data[frame->bitmap_dial_byte] = -1;
470 			break;
471 
472 		/* Everything below here is for tablets that shove multiple dials into 1 byte */
473 		case 16:
474 			data[frame->bitmap_dial_byte] = 0;
475 			data[frame->bitmap_second_dial_destination_byte] = 1;
476 			break;
477 
478 		case 32:
479 			data[frame->bitmap_dial_byte] = 0;
480 			data[frame->bitmap_second_dial_destination_byte] = -1;
481 			break;
482 		}
483 	}
484 
485 	return 0;
486 }
487 
488 static int uclogic_raw_event(struct hid_device *hdev,
489 				struct hid_report *report,
490 				u8 *data, int size)
491 {
492 	unsigned int report_id = report->id;
493 	struct uclogic_drvdata *drvdata = hid_get_drvdata(hdev);
494 	struct uclogic_params *params = &drvdata->params;
495 	struct uclogic_params_pen_subreport *subreport;
496 	struct uclogic_params_pen_subreport *subreport_list_end;
497 	size_t i;
498 
499 	/* Do not handle anything but input reports */
500 	if (report->type != HID_INPUT_REPORT)
501 		return 0;
502 
503 	if (uclogic_exec_event_hook(params, data, size))
504 		return 0;
505 
506 	while (true) {
507 		/* Tweak pen reports, if necessary */
508 		if ((report_id == params->pen.id) && (size >= 2)) {
509 			subreport_list_end =
510 				params->pen.subreport_list +
511 				ARRAY_SIZE(params->pen.subreport_list);
512 			/* Try to match a subreport */
513 			for (subreport = params->pen.subreport_list;
514 			     subreport < subreport_list_end; subreport++) {
515 				if (subreport->value != 0 &&
516 				    subreport->value == data[1]) {
517 					break;
518 				}
519 			}
520 			/* If a subreport matched */
521 			if (subreport < subreport_list_end) {
522 				/* Change to subreport ID, and restart */
523 				report_id = data[0] = subreport->id;
524 				continue;
525 			} else {
526 				return uclogic_raw_event_pen(drvdata, data, size);
527 			}
528 		}
529 
530 		/* Tweak frame control reports, if necessary */
531 		for (i = 0; i < ARRAY_SIZE(params->frame_list); i++) {
532 			if (report_id == params->frame_list[i].id) {
533 				return uclogic_raw_event_frame(
534 					drvdata, &params->frame_list[i],
535 					data, size);
536 			}
537 		}
538 
539 		break;
540 	}
541 
542 	return 0;
543 }
544 
545 static void uclogic_remove(struct hid_device *hdev)
546 {
547 	struct uclogic_drvdata *drvdata = hid_get_drvdata(hdev);
548 
549 	timer_delete_sync(&drvdata->inrange_timer);
550 	hid_hw_stop(hdev);
551 	kfree(drvdata->desc_ptr);
552 	uclogic_params_cleanup(&drvdata->params);
553 }
554 
555 static const struct hid_device_id uclogic_devices[] = {
556 	{ HID_USB_DEVICE(USB_VENDOR_ID_UCLOGIC,
557 				USB_DEVICE_ID_UCLOGIC_TABLET_PF1209) },
558 	{ HID_USB_DEVICE(USB_VENDOR_ID_UCLOGIC,
559 				USB_DEVICE_ID_UCLOGIC_TABLET_WP4030U) },
560 	{ HID_USB_DEVICE(USB_VENDOR_ID_UCLOGIC,
561 				USB_DEVICE_ID_UCLOGIC_TABLET_WP5540U) },
562 	{ HID_USB_DEVICE(USB_VENDOR_ID_UCLOGIC,
563 				USB_DEVICE_ID_UCLOGIC_TABLET_WP8060U) },
564 	{ HID_USB_DEVICE(USB_VENDOR_ID_UCLOGIC,
565 				USB_DEVICE_ID_UCLOGIC_TABLET_WP1062) },
566 	{ HID_USB_DEVICE(USB_VENDOR_ID_UCLOGIC,
567 				USB_DEVICE_ID_UCLOGIC_WIRELESS_TABLET_TWHL850) },
568 	{ HID_USB_DEVICE(USB_VENDOR_ID_UCLOGIC,
569 				USB_DEVICE_ID_UCLOGIC_TABLET_TWHA60) },
570 	{ HID_USB_DEVICE(USB_VENDOR_ID_HUION,
571 				USB_DEVICE_ID_HUION_TABLET) },
572 	{ HID_USB_DEVICE(USB_VENDOR_ID_HUION,
573 				USB_DEVICE_ID_HUION_TABLET2) },
574 	{ HID_USB_DEVICE(USB_VENDOR_ID_TRUST,
575 				USB_DEVICE_ID_TRUST_PANORA_TABLET) },
576 	{ HID_USB_DEVICE(USB_VENDOR_ID_UCLOGIC,
577 				USB_DEVICE_ID_HUION_TABLET) },
578 	{ HID_USB_DEVICE(USB_VENDOR_ID_UCLOGIC,
579 				USB_DEVICE_ID_YIYNOVA_TABLET) },
580 	{ HID_USB_DEVICE(USB_VENDOR_ID_UCLOGIC,
581 				USB_DEVICE_ID_UCLOGIC_UGEE_TABLET_81) },
582 	{ HID_USB_DEVICE(USB_VENDOR_ID_UCLOGIC,
583 				USB_DEVICE_ID_UCLOGIC_UGEE_TABLET_45) },
584 	{ HID_USB_DEVICE(USB_VENDOR_ID_UCLOGIC,
585 				USB_DEVICE_ID_UCLOGIC_UGEE_TABLET_47) },
586 	{ HID_USB_DEVICE(USB_VENDOR_ID_UCLOGIC,
587 				USB_DEVICE_ID_UCLOGIC_DRAWIMAGE_G3) },
588 	{ HID_USB_DEVICE(USB_VENDOR_ID_UGTIZER,
589 				USB_DEVICE_ID_UGTIZER_TABLET_GP0610) },
590 	{ HID_USB_DEVICE(USB_VENDOR_ID_UGTIZER,
591 				USB_DEVICE_ID_UGTIZER_TABLET_GT5040) },
592 	{ HID_USB_DEVICE(USB_VENDOR_ID_UGEE,
593 				USB_DEVICE_ID_UGEE_PARBLO_A610_PRO) },
594 	{ HID_USB_DEVICE(USB_VENDOR_ID_UGEE,
595 				USB_DEVICE_ID_UGEE_TABLET_G5) },
596 	{ HID_USB_DEVICE(USB_VENDOR_ID_UGEE,
597 				USB_DEVICE_ID_UGEE_TABLET_EX07S) },
598 	{ HID_USB_DEVICE(USB_VENDOR_ID_UGEE,
599 				USB_DEVICE_ID_UGEE_TABLET_RAINBOW_CV720) },
600 	{ HID_USB_DEVICE(USB_VENDOR_ID_UGEE,
601 				USB_DEVICE_ID_UGEE_XPPEN_TABLET_G540) },
602 	{ HID_USB_DEVICE(USB_VENDOR_ID_UGEE,
603 				USB_DEVICE_ID_UGEE_XPPEN_TABLET_G640) },
604 	{ HID_USB_DEVICE(USB_VENDOR_ID_UGEE,
605 				USB_DEVICE_ID_UGEE_XPPEN_TABLET_DECO01) },
606 	{ HID_USB_DEVICE(USB_VENDOR_ID_UGEE,
607 				USB_DEVICE_ID_UGEE_XPPEN_TABLET_DECO01_V2) },
608 	{ HID_USB_DEVICE(USB_VENDOR_ID_UGEE,
609 				USB_DEVICE_ID_UGEE_XPPEN_TABLET_DECO_L) },
610 	{ HID_USB_DEVICE(USB_VENDOR_ID_UGEE,
611 				USB_DEVICE_ID_UGEE_XPPEN_TABLET_DECO_PRO_MW),
612 		.driver_data = UCLOGIC_MOUSE_FRAME_QUIRK | UCLOGIC_BATTERY_QUIRK },
613 	{ HID_USB_DEVICE(USB_VENDOR_ID_UGEE,
614 				USB_DEVICE_ID_UGEE_XPPEN_TABLET_DECO_PRO_S) },
615 	{ HID_USB_DEVICE(USB_VENDOR_ID_UGEE,
616 				USB_DEVICE_ID_UGEE_XPPEN_TABLET_DECO_PRO_SW),
617 		.driver_data = UCLOGIC_MOUSE_FRAME_QUIRK | UCLOGIC_BATTERY_QUIRK },
618 	{ HID_USB_DEVICE(USB_VENDOR_ID_UGEE,
619 				USB_DEVICE_ID_UGEE_XPPEN_TABLET_STAR06) },
620 	{ HID_USB_DEVICE(USB_VENDOR_ID_UGEE,
621 				USB_DEVICE_ID_UGEE_XPPEN_TABLET_22R_PRO) },
622 	{ HID_USB_DEVICE(USB_VENDOR_ID_UGEE,
623 				USB_DEVICE_ID_UGEE_XPPEN_TABLET_24_PRO) },
624 	{ }
625 };
626 MODULE_DEVICE_TABLE(hid, uclogic_devices);
627 
628 static struct hid_driver uclogic_driver = {
629 	.name = "uclogic",
630 	.id_table = uclogic_devices,
631 	.probe = uclogic_probe,
632 	.remove = uclogic_remove,
633 	.report_fixup = uclogic_report_fixup,
634 	.raw_event = uclogic_raw_event,
635 	.input_mapping = uclogic_input_mapping,
636 	.input_configured = uclogic_input_configured,
637 	.resume	          = pm_ptr(uclogic_resume),
638 	.reset_resume     = pm_ptr(uclogic_resume),
639 };
640 module_hid_driver(uclogic_driver);
641 
642 MODULE_AUTHOR("Martin Rusko");
643 MODULE_AUTHOR("Nikolai Kondrashov");
644 MODULE_DESCRIPTION("HID driver for UC-Logic devices not fully compliant with HID standard");
645 MODULE_LICENSE("GPL");
646 MODULE_DESCRIPTION("HID driver for UC-Logic devices not fully compliant with HID standard");
647 
648 #ifdef CONFIG_HID_KUNIT_TEST
649 #include "hid-uclogic-core-test.c"
650 #endif
651