xref: /linux/drivers/hid/hid-uclogic-core.c (revision b61104e7a6349bd2c2b3e2fb3260d87f15eda8f4)
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 #ifdef CONFIG_PM
272 static int uclogic_resume(struct hid_device *hdev)
273 {
274 	int rc;
275 	struct uclogic_params params;
276 
277 	/* Re-initialize the device, but discard parameters */
278 	rc = uclogic_params_init(&params, hdev);
279 	if (rc != 0)
280 		hid_err(hdev, "failed to re-initialize the device\n");
281 	else
282 		uclogic_params_cleanup(&params);
283 
284 	return rc;
285 }
286 #endif
287 
288 /**
289  * uclogic_exec_event_hook - if the received event is hooked schedules the
290  * associated work.
291  *
292  * @p:		Tablet interface report parameters.
293  * @event:	Raw event.
294  * @size:	The size of event.
295  *
296  * Returns:
297  *	Whether the event was hooked or not.
298  */
299 static bool uclogic_exec_event_hook(struct uclogic_params *p, u8 *event, int size)
300 {
301 	struct uclogic_raw_event_hook *curr;
302 
303 	if (!p->event_hooks)
304 		return false;
305 
306 	list_for_each_entry(curr, &p->event_hooks->list, list) {
307 		if (curr->size == size && memcmp(curr->event, event, size) == 0) {
308 			schedule_work(&curr->work);
309 			return true;
310 		}
311 	}
312 
313 	return false;
314 }
315 
316 /**
317  * uclogic_raw_event_pen - handle raw pen events (pen HID reports).
318  *
319  * @drvdata:	Driver data.
320  * @data:	Report data buffer, can be modified.
321  * @size:	Report data size, bytes.
322  *
323  * Returns:
324  *	Negative value on error (stops event delivery), zero for success.
325  */
326 static int uclogic_raw_event_pen(struct uclogic_drvdata *drvdata,
327 					u8 *data, int size)
328 {
329 	struct uclogic_params_pen *pen = &drvdata->params.pen;
330 
331 	WARN_ON(drvdata == NULL);
332 	WARN_ON(data == NULL && size != 0);
333 
334 	/* If in-range reports are inverted */
335 	if (pen->inrange ==
336 		UCLOGIC_PARAMS_PEN_INRANGE_INVERTED) {
337 		/* Invert the in-range bit */
338 		data[1] ^= 0x40;
339 	}
340 	/*
341 	 * If report contains fragmented high-resolution pen
342 	 * coordinates
343 	 */
344 	if (size >= 10 && pen->fragmented_hires) {
345 		u8 pressure_low_byte;
346 		u8 pressure_high_byte;
347 
348 		/* Lift pressure bytes */
349 		pressure_low_byte = data[6];
350 		pressure_high_byte = data[7];
351 		/*
352 		 * Move Y coord to make space for high-order X
353 		 * coord byte
354 		 */
355 		data[6] = data[5];
356 		data[5] = data[4];
357 		/* Move high-order X coord byte */
358 		data[4] = data[8];
359 		/* Move high-order Y coord byte */
360 		data[7] = data[9];
361 		/* Place pressure bytes */
362 		data[8] = pressure_low_byte;
363 		data[9] = pressure_high_byte;
364 	}
365 	if (size == 12 && pen->fragmented_hires2) {
366 		// 00 00 when on the left side, 01 00 in the right
367 		// we move these to the end of the x coord (u16) to create a correct x coord (u32)
368 		u8 lsb_low_byte = data[10];
369 		u8 lsb_high_byte = data[11];
370 
371 		// shift everything right by 2 bytes, to make space for the moved lsb
372 		data[11] = data[9];
373 		data[10] = data[8];
374 		data[9] = data[7];
375 		data[8] = data[6];
376 		data[7] = data[5];
377 		data[6] = data[4];
378 
379 		data[4] = lsb_low_byte;
380 		data[5] = lsb_high_byte;
381 	}
382 	/* If we need to emulate in-range detection */
383 	if (pen->inrange == UCLOGIC_PARAMS_PEN_INRANGE_NONE) {
384 		/* Set in-range bit */
385 		data[1] |= 0x40;
386 		/* (Re-)start in-range timeout */
387 		mod_timer(&drvdata->inrange_timer,
388 				jiffies + msecs_to_jiffies(100));
389 	}
390 	/* If we report tilt and Y direction is flipped */
391 	if (size >= 12 && pen->tilt_y_flipped)
392 		data[11] = -data[11];
393 
394 	return 0;
395 }
396 
397 /**
398  * uclogic_raw_event_frame - handle raw frame events (frame HID reports).
399  *
400  * @drvdata:	Driver data.
401  * @frame:	The parameters of the frame controls to handle.
402  * @data:	Report data buffer, can be modified.
403  * @size:	Report data size, bytes.
404  *
405  * Returns:
406  *	Negative value on error (stops event delivery), zero for success.
407  */
408 static int uclogic_raw_event_frame(
409 		struct uclogic_drvdata *drvdata,
410 		const struct uclogic_params_frame *frame,
411 		u8 *data, int size)
412 {
413 	WARN_ON(drvdata == NULL);
414 	WARN_ON(data == NULL && size != 0);
415 
416 	/* If need to, and can, set pad device ID for Wacom drivers */
417 	if (frame->dev_id_byte > 0 && frame->dev_id_byte < size) {
418 		/* If we also have a touch ring and the finger left it */
419 		if (frame->touch_byte > 0 && frame->touch_byte < size &&
420 		    data[frame->touch_byte] == 0) {
421 			data[frame->dev_id_byte] = 0;
422 		} else {
423 			data[frame->dev_id_byte] = 0xf;
424 		}
425 	}
426 
427 	/* If need to, and can, read rotary encoder state change */
428 	if (frame->re_lsb > 0 && frame->re_lsb / 8 < size) {
429 		unsigned int byte = frame->re_lsb / 8;
430 		unsigned int bit = frame->re_lsb % 8;
431 
432 		u8 change;
433 		u8 prev_state = drvdata->re_state;
434 		/* Read Gray-coded state */
435 		u8 state = (data[byte] >> bit) & 0x3;
436 		/* Encode state change into 2-bit signed integer */
437 		if ((prev_state == 1 && state == 0) ||
438 		    (prev_state == 2 && state == 3)) {
439 			change = 1;
440 		} else if ((prev_state == 2 && state == 0) ||
441 			   (prev_state == 1 && state == 3)) {
442 			change = 3;
443 		} else {
444 			change = 0;
445 		}
446 		/* Write change */
447 		data[byte] = (data[byte] & ~((u8)3 << bit)) |
448 				(change << bit);
449 		/* Remember state */
450 		drvdata->re_state = state;
451 	}
452 
453 	/* If need to, and can, transform the touch ring reports */
454 	if (frame->touch_byte > 0 && frame->touch_byte < size) {
455 		__s8 value = data[frame->touch_byte];
456 
457 		if (value != 0) {
458 			if (frame->touch_flip_at != 0) {
459 				value = frame->touch_flip_at - value;
460 				if (value <= 0)
461 					value = frame->touch_max + value;
462 			}
463 			data[frame->touch_byte] = value - 1;
464 		}
465 	}
466 
467 	/* If need to, and can, transform the bitmap dial reports */
468 	if (frame->bitmap_dial_byte > 0 && frame->bitmap_dial_byte < size) {
469 		switch (data[frame->bitmap_dial_byte]) {
470 		case 2:
471 			data[frame->bitmap_dial_byte] = -1;
472 			break;
473 
474 		/* Everything below here is for tablets that shove multiple dials into 1 byte */
475 		case 16:
476 			data[frame->bitmap_dial_byte] = 0;
477 			data[frame->bitmap_second_dial_destination_byte] = 1;
478 			break;
479 
480 		case 32:
481 			data[frame->bitmap_dial_byte] = 0;
482 			data[frame->bitmap_second_dial_destination_byte] = -1;
483 			break;
484 		}
485 	}
486 
487 	return 0;
488 }
489 
490 static int uclogic_raw_event(struct hid_device *hdev,
491 				struct hid_report *report,
492 				u8 *data, int size)
493 {
494 	unsigned int report_id = report->id;
495 	struct uclogic_drvdata *drvdata = hid_get_drvdata(hdev);
496 	struct uclogic_params *params = &drvdata->params;
497 	struct uclogic_params_pen_subreport *subreport;
498 	struct uclogic_params_pen_subreport *subreport_list_end;
499 	size_t i;
500 
501 	/* Do not handle anything but input reports */
502 	if (report->type != HID_INPUT_REPORT)
503 		return 0;
504 
505 	if (uclogic_exec_event_hook(params, data, size))
506 		return 0;
507 
508 	while (true) {
509 		/* Tweak pen reports, if necessary */
510 		if ((report_id == params->pen.id) && (size >= 2)) {
511 			subreport_list_end =
512 				params->pen.subreport_list +
513 				ARRAY_SIZE(params->pen.subreport_list);
514 			/* Try to match a subreport */
515 			for (subreport = params->pen.subreport_list;
516 			     subreport < subreport_list_end; subreport++) {
517 				if (subreport->value != 0 &&
518 				    subreport->value == data[1]) {
519 					break;
520 				}
521 			}
522 			/* If a subreport matched */
523 			if (subreport < subreport_list_end) {
524 				/* Change to subreport ID, and restart */
525 				report_id = data[0] = subreport->id;
526 				continue;
527 			} else {
528 				return uclogic_raw_event_pen(drvdata, data, size);
529 			}
530 		}
531 
532 		/* Tweak frame control reports, if necessary */
533 		for (i = 0; i < ARRAY_SIZE(params->frame_list); i++) {
534 			if (report_id == params->frame_list[i].id) {
535 				return uclogic_raw_event_frame(
536 					drvdata, &params->frame_list[i],
537 					data, size);
538 			}
539 		}
540 
541 		break;
542 	}
543 
544 	return 0;
545 }
546 
547 static void uclogic_remove(struct hid_device *hdev)
548 {
549 	struct uclogic_drvdata *drvdata = hid_get_drvdata(hdev);
550 
551 	timer_delete_sync(&drvdata->inrange_timer);
552 	hid_hw_stop(hdev);
553 	kfree(drvdata->desc_ptr);
554 	uclogic_params_cleanup(&drvdata->params);
555 }
556 
557 static const struct hid_device_id uclogic_devices[] = {
558 	{ HID_USB_DEVICE(USB_VENDOR_ID_UCLOGIC,
559 				USB_DEVICE_ID_UCLOGIC_TABLET_PF1209) },
560 	{ HID_USB_DEVICE(USB_VENDOR_ID_UCLOGIC,
561 				USB_DEVICE_ID_UCLOGIC_TABLET_WP4030U) },
562 	{ HID_USB_DEVICE(USB_VENDOR_ID_UCLOGIC,
563 				USB_DEVICE_ID_UCLOGIC_TABLET_WP5540U) },
564 	{ HID_USB_DEVICE(USB_VENDOR_ID_UCLOGIC,
565 				USB_DEVICE_ID_UCLOGIC_TABLET_WP8060U) },
566 	{ HID_USB_DEVICE(USB_VENDOR_ID_UCLOGIC,
567 				USB_DEVICE_ID_UCLOGIC_TABLET_WP1062) },
568 	{ HID_USB_DEVICE(USB_VENDOR_ID_UCLOGIC,
569 				USB_DEVICE_ID_UCLOGIC_WIRELESS_TABLET_TWHL850) },
570 	{ HID_USB_DEVICE(USB_VENDOR_ID_UCLOGIC,
571 				USB_DEVICE_ID_UCLOGIC_TABLET_TWHA60) },
572 	{ HID_USB_DEVICE(USB_VENDOR_ID_HUION,
573 				USB_DEVICE_ID_HUION_TABLET) },
574 	{ HID_USB_DEVICE(USB_VENDOR_ID_HUION,
575 				USB_DEVICE_ID_HUION_TABLET2) },
576 	{ HID_USB_DEVICE(USB_VENDOR_ID_TRUST,
577 				USB_DEVICE_ID_TRUST_PANORA_TABLET) },
578 	{ HID_USB_DEVICE(USB_VENDOR_ID_UCLOGIC,
579 				USB_DEVICE_ID_HUION_TABLET) },
580 	{ HID_USB_DEVICE(USB_VENDOR_ID_UCLOGIC,
581 				USB_DEVICE_ID_YIYNOVA_TABLET) },
582 	{ HID_USB_DEVICE(USB_VENDOR_ID_UCLOGIC,
583 				USB_DEVICE_ID_UCLOGIC_UGEE_TABLET_81) },
584 	{ HID_USB_DEVICE(USB_VENDOR_ID_UCLOGIC,
585 				USB_DEVICE_ID_UCLOGIC_UGEE_TABLET_45) },
586 	{ HID_USB_DEVICE(USB_VENDOR_ID_UCLOGIC,
587 				USB_DEVICE_ID_UCLOGIC_UGEE_TABLET_47) },
588 	{ HID_USB_DEVICE(USB_VENDOR_ID_UCLOGIC,
589 				USB_DEVICE_ID_UCLOGIC_DRAWIMAGE_G3) },
590 	{ HID_USB_DEVICE(USB_VENDOR_ID_UGTIZER,
591 				USB_DEVICE_ID_UGTIZER_TABLET_GP0610) },
592 	{ HID_USB_DEVICE(USB_VENDOR_ID_UGTIZER,
593 				USB_DEVICE_ID_UGTIZER_TABLET_GT5040) },
594 	{ HID_USB_DEVICE(USB_VENDOR_ID_UGEE,
595 				USB_DEVICE_ID_UGEE_PARBLO_A610_PRO) },
596 	{ HID_USB_DEVICE(USB_VENDOR_ID_UGEE,
597 				USB_DEVICE_ID_UGEE_TABLET_G5) },
598 	{ HID_USB_DEVICE(USB_VENDOR_ID_UGEE,
599 				USB_DEVICE_ID_UGEE_TABLET_EX07S) },
600 	{ HID_USB_DEVICE(USB_VENDOR_ID_UGEE,
601 				USB_DEVICE_ID_UGEE_TABLET_RAINBOW_CV720) },
602 	{ HID_USB_DEVICE(USB_VENDOR_ID_UGEE,
603 				USB_DEVICE_ID_UGEE_XPPEN_TABLET_G540) },
604 	{ HID_USB_DEVICE(USB_VENDOR_ID_UGEE,
605 				USB_DEVICE_ID_UGEE_XPPEN_TABLET_G640) },
606 	{ HID_USB_DEVICE(USB_VENDOR_ID_UGEE,
607 				USB_DEVICE_ID_UGEE_XPPEN_TABLET_DECO01) },
608 	{ HID_USB_DEVICE(USB_VENDOR_ID_UGEE,
609 				USB_DEVICE_ID_UGEE_XPPEN_TABLET_DECO01_V2) },
610 	{ HID_USB_DEVICE(USB_VENDOR_ID_UGEE,
611 				USB_DEVICE_ID_UGEE_XPPEN_TABLET_DECO_L) },
612 	{ HID_USB_DEVICE(USB_VENDOR_ID_UGEE,
613 				USB_DEVICE_ID_UGEE_XPPEN_TABLET_DECO_PRO_MW),
614 		.driver_data = UCLOGIC_MOUSE_FRAME_QUIRK | UCLOGIC_BATTERY_QUIRK },
615 	{ HID_USB_DEVICE(USB_VENDOR_ID_UGEE,
616 				USB_DEVICE_ID_UGEE_XPPEN_TABLET_DECO_PRO_S) },
617 	{ HID_USB_DEVICE(USB_VENDOR_ID_UGEE,
618 				USB_DEVICE_ID_UGEE_XPPEN_TABLET_DECO_PRO_SW),
619 		.driver_data = UCLOGIC_MOUSE_FRAME_QUIRK | UCLOGIC_BATTERY_QUIRK },
620 	{ HID_USB_DEVICE(USB_VENDOR_ID_UGEE,
621 				USB_DEVICE_ID_UGEE_XPPEN_TABLET_STAR06) },
622 	{ HID_USB_DEVICE(USB_VENDOR_ID_UGEE,
623 				USB_DEVICE_ID_UGEE_XPPEN_TABLET_22R_PRO) },
624 	{ HID_USB_DEVICE(USB_VENDOR_ID_UGEE,
625 				USB_DEVICE_ID_UGEE_XPPEN_TABLET_24_PRO) },
626 	{ }
627 };
628 MODULE_DEVICE_TABLE(hid, uclogic_devices);
629 
630 static struct hid_driver uclogic_driver = {
631 	.name = "uclogic",
632 	.id_table = uclogic_devices,
633 	.probe = uclogic_probe,
634 	.remove = uclogic_remove,
635 	.report_fixup = uclogic_report_fixup,
636 	.raw_event = uclogic_raw_event,
637 	.input_mapping = uclogic_input_mapping,
638 	.input_configured = uclogic_input_configured,
639 #ifdef CONFIG_PM
640 	.resume	          = uclogic_resume,
641 	.reset_resume     = uclogic_resume,
642 #endif
643 };
644 module_hid_driver(uclogic_driver);
645 
646 MODULE_AUTHOR("Martin Rusko");
647 MODULE_AUTHOR("Nikolai Kondrashov");
648 MODULE_DESCRIPTION("HID driver for UC-Logic devices not fully compliant with HID standard");
649 MODULE_LICENSE("GPL");
650 MODULE_DESCRIPTION("HID driver for UC-Logic devices not fully compliant with HID standard");
651 
652 #ifdef CONFIG_HID_KUNIT_TEST
653 #include "hid-uclogic-core-test.c"
654 #endif
655