Skip to content

Commit 9207fe7

Browse files
committed
Merge tag 'hid-for-linus-2024021501' of git://git.kernel.org/pub/scm/linux/kernel/git/hid/hid
Pull HID fixes from Jiri Kosina: - fix for 'MSC_SERIAL = 0' corner case handling in wacom driver (Jason Gerecke) - ACPI S3 suspend/resume fix for intel-ish-hid (Even Xu) - race condition fix preventing Wacom driver from losing events shortly after initialization (Jason Gerecke) - fix preventing certain Logitech HID++ devices from spamming kernel log (Oleksandr Natalenko) * tag 'hid-for-linus-2024021501' of git://git.kernel.org/pub/scm/linux/kernel/git/hid/hid: HID: wacom: generic: Avoid reporting a serial of '0' to userspace HID: Intel-ish-hid: Ishtp: Fix sensor reads after ACPI S3 suspend HID: multitouch: Add required quirk for Synaptics 0xcddc device HID: wacom: Do not register input devices until after hid_hw_start HID: logitech-hidpp: Do not flood kernel log
2 parents 8d3dea2 + ab41a31 commit 9207fe7

File tree

6 files changed

+70
-25
lines changed

6 files changed

+70
-25
lines changed

drivers/hid/hid-logitech-hidpp.c

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -203,6 +203,8 @@ struct hidpp_device {
203203
struct hidpp_scroll_counter vertical_wheel_counter;
204204

205205
u8 wireless_feature_index;
206+
207+
bool connected_once;
206208
};
207209

208210
/* HID++ 1.0 error codes */
@@ -988,8 +990,13 @@ static int hidpp_root_get_protocol_version(struct hidpp_device *hidpp)
988990
hidpp->protocol_minor = response.rap.params[1];
989991

990992
print_version:
991-
hid_info(hidpp->hid_dev, "HID++ %u.%u device connected.\n",
992-
hidpp->protocol_major, hidpp->protocol_minor);
993+
if (!hidpp->connected_once) {
994+
hid_info(hidpp->hid_dev, "HID++ %u.%u device connected.\n",
995+
hidpp->protocol_major, hidpp->protocol_minor);
996+
hidpp->connected_once = true;
997+
} else
998+
hid_dbg(hidpp->hid_dev, "HID++ %u.%u device connected.\n",
999+
hidpp->protocol_major, hidpp->protocol_minor);
9931000
return 0;
9941001
}
9951002

@@ -4184,7 +4191,7 @@ static void hidpp_connect_event(struct work_struct *work)
41844191
/* Get device version to check if it is connected */
41854192
ret = hidpp_root_get_protocol_version(hidpp);
41864193
if (ret) {
4187-
hid_info(hidpp->hid_dev, "Disconnected\n");
4194+
hid_dbg(hidpp->hid_dev, "Disconnected\n");
41884195
if (hidpp->battery.ps) {
41894196
hidpp->battery.online = false;
41904197
hidpp->battery.status = POWER_SUPPLY_STATUS_UNKNOWN;

drivers/hid/hid-multitouch.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2151,6 +2151,10 @@ static const struct hid_device_id mt_devices[] = {
21512151
HID_DEVICE(BUS_I2C, HID_GROUP_MULTITOUCH_WIN_8,
21522152
USB_VENDOR_ID_SYNAPTICS, 0xcd7e) },
21532153

2154+
{ .driver_data = MT_CLS_WIN_8_FORCE_MULTI_INPUT,
2155+
HID_DEVICE(BUS_I2C, HID_GROUP_MULTITOUCH_WIN_8,
2156+
USB_VENDOR_ID_SYNAPTICS, 0xcddc) },
2157+
21542158
{ .driver_data = MT_CLS_WIN_8_FORCE_MULTI_INPUT,
21552159
HID_DEVICE(BUS_I2C, HID_GROUP_MULTITOUCH_WIN_8,
21562160
USB_VENDOR_ID_SYNAPTICS, 0xce08) },

drivers/hid/intel-ish-hid/ishtp/bus.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -722,6 +722,8 @@ void ishtp_bus_remove_all_clients(struct ishtp_device *ishtp_dev,
722722
spin_lock_irqsave(&ishtp_dev->cl_list_lock, flags);
723723
list_for_each_entry(cl, &ishtp_dev->cl_list, link) {
724724
cl->state = ISHTP_CL_DISCONNECTED;
725+
if (warm_reset && cl->device->reference_count)
726+
continue;
725727

726728
/*
727729
* Wake any pending process. The waiter would check dev->state

drivers/hid/intel-ish-hid/ishtp/client.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,9 @@ static void ishtp_read_list_flush(struct ishtp_cl *cl)
4949
list_for_each_entry_safe(rb, next, &cl->dev->read_list.list, list)
5050
if (rb->cl && ishtp_cl_cmp_id(cl, rb->cl)) {
5151
list_del(&rb->list);
52-
ishtp_io_rb_free(rb);
52+
spin_lock(&cl->free_list_spinlock);
53+
list_add_tail(&rb->list, &cl->free_rb_list.list);
54+
spin_unlock(&cl->free_list_spinlock);
5355
}
5456
spin_unlock_irqrestore(&cl->dev->read_list_spinlock, flags);
5557
}

drivers/hid/wacom_sys.c

Lines changed: 43 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -2087,7 +2087,7 @@ static int wacom_allocate_inputs(struct wacom *wacom)
20872087
return 0;
20882088
}
20892089

2090-
static int wacom_register_inputs(struct wacom *wacom)
2090+
static int wacom_setup_inputs(struct wacom *wacom)
20912091
{
20922092
struct input_dev *pen_input_dev, *touch_input_dev, *pad_input_dev;
20932093
struct wacom_wac *wacom_wac = &(wacom->wacom_wac);
@@ -2106,10 +2106,6 @@ static int wacom_register_inputs(struct wacom *wacom)
21062106
input_free_device(pen_input_dev);
21072107
wacom_wac->pen_input = NULL;
21082108
pen_input_dev = NULL;
2109-
} else {
2110-
error = input_register_device(pen_input_dev);
2111-
if (error)
2112-
goto fail;
21132109
}
21142110

21152111
error = wacom_setup_touch_input_capabilities(touch_input_dev, wacom_wac);
@@ -2118,10 +2114,6 @@ static int wacom_register_inputs(struct wacom *wacom)
21182114
input_free_device(touch_input_dev);
21192115
wacom_wac->touch_input = NULL;
21202116
touch_input_dev = NULL;
2121-
} else {
2122-
error = input_register_device(touch_input_dev);
2123-
if (error)
2124-
goto fail;
21252117
}
21262118

21272119
error = wacom_setup_pad_input_capabilities(pad_input_dev, wacom_wac);
@@ -2130,7 +2122,34 @@ static int wacom_register_inputs(struct wacom *wacom)
21302122
input_free_device(pad_input_dev);
21312123
wacom_wac->pad_input = NULL;
21322124
pad_input_dev = NULL;
2133-
} else {
2125+
}
2126+
2127+
return 0;
2128+
}
2129+
2130+
static int wacom_register_inputs(struct wacom *wacom)
2131+
{
2132+
struct input_dev *pen_input_dev, *touch_input_dev, *pad_input_dev;
2133+
struct wacom_wac *wacom_wac = &(wacom->wacom_wac);
2134+
int error = 0;
2135+
2136+
pen_input_dev = wacom_wac->pen_input;
2137+
touch_input_dev = wacom_wac->touch_input;
2138+
pad_input_dev = wacom_wac->pad_input;
2139+
2140+
if (pen_input_dev) {
2141+
error = input_register_device(pen_input_dev);
2142+
if (error)
2143+
goto fail;
2144+
}
2145+
2146+
if (touch_input_dev) {
2147+
error = input_register_device(touch_input_dev);
2148+
if (error)
2149+
goto fail;
2150+
}
2151+
2152+
if (pad_input_dev) {
21342153
error = input_register_device(pad_input_dev);
21352154
if (error)
21362155
goto fail;
@@ -2383,6 +2402,20 @@ static int wacom_parse_and_register(struct wacom *wacom, bool wireless)
23832402
if (error)
23842403
goto fail;
23852404

2405+
error = wacom_setup_inputs(wacom);
2406+
if (error)
2407+
goto fail;
2408+
2409+
if (features->type == HID_GENERIC)
2410+
connect_mask |= HID_CONNECT_DRIVER;
2411+
2412+
/* Regular HID work starts now */
2413+
error = hid_hw_start(hdev, connect_mask);
2414+
if (error) {
2415+
hid_err(hdev, "hw start failed\n");
2416+
goto fail;
2417+
}
2418+
23862419
error = wacom_register_inputs(wacom);
23872420
if (error)
23882421
goto fail;
@@ -2397,16 +2430,6 @@ static int wacom_parse_and_register(struct wacom *wacom, bool wireless)
23972430
goto fail;
23982431
}
23992432

2400-
if (features->type == HID_GENERIC)
2401-
connect_mask |= HID_CONNECT_DRIVER;
2402-
2403-
/* Regular HID work starts now */
2404-
error = hid_hw_start(hdev, connect_mask);
2405-
if (error) {
2406-
hid_err(hdev, "hw start failed\n");
2407-
goto fail;
2408-
}
2409-
24102433
if (!wireless) {
24112434
/* Note that if query fails it is not a hard failure */
24122435
wacom_query_tablet_data(wacom);

drivers/hid/wacom_wac.c

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2575,7 +2575,14 @@ static void wacom_wac_pen_report(struct hid_device *hdev,
25752575
wacom_wac->hid_data.tipswitch);
25762576
input_report_key(input, wacom_wac->tool[0], sense);
25772577
if (wacom_wac->serial[0]) {
2578-
input_event(input, EV_MSC, MSC_SERIAL, wacom_wac->serial[0]);
2578+
/*
2579+
* xf86-input-wacom does not accept a serial number
2580+
* of '0'. Report the low 32 bits if possible, but
2581+
* if they are zero, report the upper ones instead.
2582+
*/
2583+
__u32 serial_lo = wacom_wac->serial[0] & 0xFFFFFFFFu;
2584+
__u32 serial_hi = wacom_wac->serial[0] >> 32;
2585+
input_event(input, EV_MSC, MSC_SERIAL, (int)(serial_lo ? serial_lo : serial_hi));
25792586
input_report_abs(input, ABS_MISC, sense ? id : 0);
25802587
}
25812588

0 commit comments

Comments
 (0)