Skip to content

Commit 69ecd44

Browse files
committed
HID: multitouch: add support for the Smart Tech panel
This panel is not very friendly to us: it exposes multiple multitouch collections, some of them being of logical application stylus. Usually, a device has only one report per application, and that is what I assumed in commit 8dfe14b ("HID: multitouch: ditch mt_report_id") To avoid breaking all working device, add a new class and a new quirk for that situation. Reported-and-tested-by: Matthias Fend <[email protected]> Signed-off-by: Benjamin Tissoires <[email protected]>
1 parent c23e204 commit 69ecd44

File tree

1 file changed

+28
-6
lines changed

1 file changed

+28
-6
lines changed

drivers/hid/hid-multitouch.c

Lines changed: 28 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,7 @@ MODULE_LICENSE("GPL");
6868
#define MT_QUIRK_STICKY_FINGERS BIT(16)
6969
#define MT_QUIRK_ASUS_CUSTOM_UP BIT(17)
7070
#define MT_QUIRK_WIN8_PTP_BUTTONS BIT(18)
71+
#define MT_QUIRK_SEPARATE_APP_REPORT BIT(19)
7172

7273
#define MT_INPUTMODE_TOUCHSCREEN 0x02
7374
#define MT_INPUTMODE_TOUCHPAD 0x03
@@ -103,6 +104,7 @@ struct mt_usages {
103104
struct mt_application {
104105
struct list_head list;
105106
unsigned int application;
107+
unsigned int report_id;
106108
struct list_head mt_usages; /* mt usages list */
107109

108110
__s32 quirks;
@@ -203,6 +205,7 @@ static void mt_post_parse(struct mt_device *td, struct mt_application *app);
203205
#define MT_CLS_VTL 0x0110
204206
#define MT_CLS_GOOGLE 0x0111
205207
#define MT_CLS_RAZER_BLADE_STEALTH 0x0112
208+
#define MT_CLS_SMART_TECH 0x0113
206209

207210
#define MT_DEFAULT_MAXCONTACT 10
208211
#define MT_MAX_MAXCONTACT 250
@@ -354,6 +357,12 @@ static const struct mt_class mt_classes[] = {
354357
MT_QUIRK_CONTACT_CNT_ACCURATE |
355358
MT_QUIRK_WIN8_PTP_BUTTONS,
356359
},
360+
{ .name = MT_CLS_SMART_TECH,
361+
.quirks = MT_QUIRK_ALWAYS_VALID |
362+
MT_QUIRK_IGNORE_DUPLICATES |
363+
MT_QUIRK_CONTACT_CNT_ACCURATE |
364+
MT_QUIRK_SEPARATE_APP_REPORT,
365+
},
357366
{ }
358367
};
359368

@@ -510,8 +519,9 @@ static struct mt_usages *mt_allocate_usage(struct hid_device *hdev,
510519
}
511520

512521
static struct mt_application *mt_allocate_application(struct mt_device *td,
513-
unsigned int application)
522+
struct hid_report *report)
514523
{
524+
unsigned int application = report->application;
515525
struct mt_application *mt_application;
516526

517527
mt_application = devm_kzalloc(&td->hdev->dev, sizeof(*mt_application),
@@ -536,26 +546,31 @@ static struct mt_application *mt_allocate_application(struct mt_device *td,
536546
mt_application->scantime = DEFAULT_ZERO;
537547
mt_application->raw_cc = DEFAULT_ZERO;
538548
mt_application->quirks = td->mtclass.quirks;
549+
mt_application->report_id = report->id;
539550

540551
list_add_tail(&mt_application->list, &td->applications);
541552

542553
return mt_application;
543554
}
544555

545556
static struct mt_application *mt_find_application(struct mt_device *td,
546-
unsigned int application)
557+
struct hid_report *report)
547558
{
559+
unsigned int application = report->application;
548560
struct mt_application *tmp, *mt_application = NULL;
549561

550562
list_for_each_entry(tmp, &td->applications, list) {
551563
if (application == tmp->application) {
552-
mt_application = tmp;
553-
break;
564+
if (!(td->mtclass.quirks & MT_QUIRK_SEPARATE_APP_REPORT) ||
565+
tmp->report_id == report->id) {
566+
mt_application = tmp;
567+
break;
568+
}
554569
}
555570
}
556571

557572
if (!mt_application)
558-
mt_application = mt_allocate_application(td, application);
573+
mt_application = mt_allocate_application(td, report);
559574

560575
return mt_application;
561576
}
@@ -572,7 +587,7 @@ static struct mt_report_data *mt_allocate_report_data(struct mt_device *td,
572587
return NULL;
573588

574589
rdata->report = report;
575-
rdata->application = mt_find_application(td, report->application);
590+
rdata->application = mt_find_application(td, report);
576591

577592
if (!rdata->application) {
578593
devm_kfree(&td->hdev->dev, rdata);
@@ -1562,6 +1577,9 @@ static int mt_input_configured(struct hid_device *hdev, struct hid_input *hi)
15621577
case HID_VD_ASUS_CUSTOM_MEDIA_KEYS:
15631578
suffix = "Custom Media Keys";
15641579
break;
1580+
case HID_DG_PEN:
1581+
suffix = "Stylus";
1582+
break;
15651583
default:
15661584
suffix = "UNKNOWN";
15671585
break;
@@ -2023,6 +2041,10 @@ static const struct hid_device_id mt_devices[] = {
20232041
HID_DEVICE(BUS_I2C, HID_GROUP_MULTITOUCH_WIN_8,
20242042
USB_VENDOR_ID_SYNAPTICS, 0x8323) },
20252043

2044+
/* Smart Tech panels */
2045+
{ .driver_data = MT_CLS_SMART_TECH,
2046+
MT_USB_DEVICE(0x0b8c, 0x0092)},
2047+
20262048
/* Stantum panels */
20272049
{ .driver_data = MT_CLS_CONFIDENCE,
20282050
MT_USB_DEVICE(USB_VENDOR_ID_STANTUM_STM,

0 commit comments

Comments
 (0)