Skip to content

Commit 8ed8662

Browse files
committed
Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/hid/hid
Pull HID fixes from Jiri Kosina: - build dependency fix for hid-asus from Arnd Bergmann - addition of omitted mapping of _ASSISTANT key from Dmitry Torokhov - race condition fix in hid-debug inftastructure from He, Bo - fixed support for devices with big maximum report size from Kai-Heng Feng - deadlock fix in hid-steam from Rodrigo Rivas Costa - quite a few device-specific quirks * 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/hid/hid: HID: input: add mapping for Assistant key HID: i2c-hid: Disable runtime PM on Synaptics touchpad HID: quirks: Fix keyboard + touchpad on Lenovo Miix 630 HID: logitech: Handle 0 scroll events for the m560 HID: debug: fix race condition with between rdesc_show() and device removal HID: logitech: check the return value of create_singlethread_workqueue HID: Increase maximum report size allowed by hid_field_extract() HID: steam: fix deadlock with input devices. HID: uclogic: remove redudant duplicated null check on ver_ptr HID: quirks: Drop misused kernel-doc annotation HID: hid-asus: select CONFIG_POWER_SUPPLY HID: quirks: use correct format chars in dbg_hid
2 parents a816fd6 + ce85663 commit 8ed8662

File tree

10 files changed

+49
-21
lines changed

10 files changed

+49
-21
lines changed

drivers/hid/Kconfig

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -150,6 +150,7 @@ config HID_ASUS
150150
tristate "Asus"
151151
depends on LEDS_CLASS
152152
depends on ASUS_WMI || ASUS_WMI=n
153+
select POWER_SUPPLY
153154
---help---
154155
Support for Asus notebook built-in keyboard and touchpad via i2c, and
155156
the Asus Republic of Gamers laptop keyboard special keys.

drivers/hid/hid-core.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1301,10 +1301,10 @@ static u32 __extract(u8 *report, unsigned offset, int n)
13011301
u32 hid_field_extract(const struct hid_device *hid, u8 *report,
13021302
unsigned offset, unsigned n)
13031303
{
1304-
if (n > 32) {
1305-
hid_warn(hid, "hid_field_extract() called with n (%d) > 32! (%s)\n",
1304+
if (n > 256) {
1305+
hid_warn(hid, "hid_field_extract() called with n (%d) > 256! (%s)\n",
13061306
n, current->comm);
1307-
n = 32;
1307+
n = 256;
13081308
}
13091309

13101310
return __extract(report, offset, n);

drivers/hid/hid-debug.c

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1060,10 +1060,15 @@ static int hid_debug_rdesc_show(struct seq_file *f, void *p)
10601060
seq_printf(f, "\n\n");
10611061

10621062
/* dump parsed data and input mappings */
1063+
if (down_interruptible(&hdev->driver_input_lock))
1064+
return 0;
1065+
10631066
hid_dump_device(hdev, f);
10641067
seq_printf(f, "\n");
10651068
hid_dump_input_mapping(hdev, f);
10661069

1070+
up(&hdev->driver_input_lock);
1071+
10671072
return 0;
10681073
}
10691074

drivers/hid/hid-ids.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1083,6 +1083,7 @@
10831083
#define USB_DEVICE_ID_SYNAPTICS_HD 0x0ac3
10841084
#define USB_DEVICE_ID_SYNAPTICS_QUAD_HD 0x1ac3
10851085
#define USB_DEVICE_ID_SYNAPTICS_TP_V103 0x5710
1086+
#define I2C_DEVICE_ID_SYNAPTICS_7E7E 0x7e7e
10861087

10871088
#define USB_VENDOR_ID_TEXAS_INSTRUMENTS 0x2047
10881089
#define USB_DEVICE_ID_TEXAS_INSTRUMENTS_LENOVO_YOGA 0x0855

drivers/hid/hid-input.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -998,6 +998,7 @@ static void hidinput_configure_usage(struct hid_input *hidinput, struct hid_fiel
998998
case 0x1b8: map_key_clear(KEY_VIDEO); break;
999999
case 0x1bc: map_key_clear(KEY_MESSENGER); break;
10001000
case 0x1bd: map_key_clear(KEY_INFO); break;
1001+
case 0x1cb: map_key_clear(KEY_ASSISTANT); break;
10011002
case 0x201: map_key_clear(KEY_NEW); break;
10021003
case 0x202: map_key_clear(KEY_OPEN); break;
10031004
case 0x203: map_key_clear(KEY_CLOSE); break;

drivers/hid/hid-logitech-hidpp.c

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2111,6 +2111,13 @@ static int hidpp_ff_init(struct hidpp_device *hidpp, u8 feature_index)
21112111
kfree(data);
21122112
return -ENOMEM;
21132113
}
2114+
data->wq = create_singlethread_workqueue("hidpp-ff-sendqueue");
2115+
if (!data->wq) {
2116+
kfree(data->effect_ids);
2117+
kfree(data);
2118+
return -ENOMEM;
2119+
}
2120+
21142121
data->hidpp = hidpp;
21152122
data->feature_index = feature_index;
21162123
data->version = version;
@@ -2155,7 +2162,6 @@ static int hidpp_ff_init(struct hidpp_device *hidpp, u8 feature_index)
21552162
/* ignore boost value at response.fap.params[2] */
21562163

21572164
/* init the hardware command queue */
2158-
data->wq = create_singlethread_workqueue("hidpp-ff-sendqueue");
21592165
atomic_set(&data->workqueue_size, 0);
21602166

21612167
/* initialize with zero autocenter to get wheel in usable state */
@@ -2608,8 +2614,9 @@ static int m560_raw_event(struct hid_device *hdev, u8 *data, int size)
26082614
input_report_rel(mydata->input, REL_Y, v);
26092615

26102616
v = hid_snto32(data[6], 8);
2611-
hidpp_scroll_counter_handle_scroll(
2612-
&hidpp->vertical_wheel_counter, v);
2617+
if (v != 0)
2618+
hidpp_scroll_counter_handle_scroll(
2619+
&hidpp->vertical_wheel_counter, v);
26132620

26142621
input_sync(mydata->input);
26152622
}

drivers/hid/hid-quirks.c

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -715,7 +715,6 @@ static const struct hid_device_id hid_ignore_list[] = {
715715
{ HID_USB_DEVICE(USB_VENDOR_ID_DEALEXTREAME, USB_DEVICE_ID_DEALEXTREAME_RADIO_SI4701) },
716716
{ HID_USB_DEVICE(USB_VENDOR_ID_DELORME, USB_DEVICE_ID_DELORME_EARTHMATE) },
717717
{ HID_USB_DEVICE(USB_VENDOR_ID_DELORME, USB_DEVICE_ID_DELORME_EM_LT20) },
718-
{ HID_I2C_DEVICE(USB_VENDOR_ID_ELAN, 0x0400) },
719718
{ HID_USB_DEVICE(USB_VENDOR_ID_ESSENTIAL_REALITY, USB_DEVICE_ID_ESSENTIAL_REALITY_P5) },
720719
{ HID_USB_DEVICE(USB_VENDOR_ID_ETT, USB_DEVICE_ID_TC5UH) },
721720
{ HID_USB_DEVICE(USB_VENDOR_ID_ETT, USB_DEVICE_ID_TC4UM) },
@@ -855,7 +854,7 @@ static const struct hid_device_id hid_ignore_list[] = {
855854
{ }
856855
};
857856

858-
/**
857+
/*
859858
* hid_mouse_ignore_list - mouse devices which should not be handled by the hid layer
860859
*
861860
* There are composite devices for which we want to ignore only a certain
@@ -996,6 +995,10 @@ bool hid_ignore(struct hid_device *hdev)
996995
if (hdev->product == 0x0401 &&
997996
strncmp(hdev->name, "ELAN0800", 8) != 0)
998997
return true;
998+
/* Same with product id 0x0400 */
999+
if (hdev->product == 0x0400 &&
1000+
strncmp(hdev->name, "QTEC0001", 8) != 0)
1001+
return true;
9991002
break;
10001003
}
10011004

@@ -1042,7 +1045,7 @@ static struct hid_device_id *hid_exists_dquirk(const struct hid_device *hdev)
10421045
}
10431046

10441047
if (bl_entry != NULL)
1045-
dbg_hid("Found dynamic quirk 0x%lx for HID device 0x%hx:0x%hx\n",
1048+
dbg_hid("Found dynamic quirk 0x%lx for HID device 0x%04x:0x%04x\n",
10461049
bl_entry->driver_data, bl_entry->vendor,
10471050
bl_entry->product);
10481051

@@ -1209,7 +1212,7 @@ static unsigned long hid_gets_squirk(const struct hid_device *hdev)
12091212
quirks |= bl_entry->driver_data;
12101213

12111214
if (quirks)
1212-
dbg_hid("Found squirk 0x%lx for HID device 0x%hx:0x%hx\n",
1215+
dbg_hid("Found squirk 0x%lx for HID device 0x%04x:0x%04x\n",
12131216
quirks, hdev->vendor, hdev->product);
12141217
return quirks;
12151218
}

drivers/hid/hid-steam.c

Lines changed: 19 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -499,6 +499,7 @@ static void steam_battery_unregister(struct steam_device *steam)
499499
static int steam_register(struct steam_device *steam)
500500
{
501501
int ret;
502+
bool client_opened;
502503

503504
/*
504505
* This function can be called several times in a row with the
@@ -511,9 +512,11 @@ static int steam_register(struct steam_device *steam)
511512
* Unlikely, but getting the serial could fail, and it is not so
512513
* important, so make up a serial number and go on.
513514
*/
515+
mutex_lock(&steam->mutex);
514516
if (steam_get_serial(steam) < 0)
515517
strlcpy(steam->serial_no, "XXXXXXXXXX",
516518
sizeof(steam->serial_no));
519+
mutex_unlock(&steam->mutex);
517520

518521
hid_info(steam->hdev, "Steam Controller '%s' connected",
519522
steam->serial_no);
@@ -528,13 +531,15 @@ static int steam_register(struct steam_device *steam)
528531
}
529532

530533
mutex_lock(&steam->mutex);
531-
if (!steam->client_opened) {
534+
client_opened = steam->client_opened;
535+
if (!client_opened)
532536
steam_set_lizard_mode(steam, lizard_mode);
537+
mutex_unlock(&steam->mutex);
538+
539+
if (!client_opened)
533540
ret = steam_input_register(steam);
534-
} else {
541+
else
535542
ret = 0;
536-
}
537-
mutex_unlock(&steam->mutex);
538543

539544
return ret;
540545
}
@@ -630,14 +635,21 @@ static void steam_client_ll_close(struct hid_device *hdev)
630635
{
631636
struct steam_device *steam = hdev->driver_data;
632637

638+
unsigned long flags;
639+
bool connected;
640+
641+
spin_lock_irqsave(&steam->lock, flags);
642+
connected = steam->connected;
643+
spin_unlock_irqrestore(&steam->lock, flags);
644+
633645
mutex_lock(&steam->mutex);
634646
steam->client_opened = false;
647+
if (connected)
648+
steam_set_lizard_mode(steam, lizard_mode);
635649
mutex_unlock(&steam->mutex);
636650

637-
if (steam->connected) {
638-
steam_set_lizard_mode(steam, lizard_mode);
651+
if (connected)
639652
steam_input_register(steam);
640-
}
641653
}
642654

643655
static int steam_client_ll_raw_request(struct hid_device *hdev,

drivers/hid/hid-uclogic-params.c

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -735,10 +735,6 @@ static int uclogic_params_huion_init(struct uclogic_params *params,
735735
goto cleanup;
736736
}
737737
rc = usb_string(udev, 201, ver_ptr, ver_len);
738-
if (ver_ptr == NULL) {
739-
rc = -ENOMEM;
740-
goto cleanup;
741-
}
742738
if (rc == -EPIPE) {
743739
*ver_ptr = '\0';
744740
} else if (rc < 0) {

drivers/hid/i2c-hid/i2c-hid-core.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -184,6 +184,8 @@ static const struct i2c_hid_quirks {
184184
I2C_HID_QUIRK_NO_RUNTIME_PM },
185185
{ USB_VENDOR_ID_ELAN, HID_ANY_ID,
186186
I2C_HID_QUIRK_BOGUS_IRQ },
187+
{ USB_VENDOR_ID_SYNAPTICS, I2C_DEVICE_ID_SYNAPTICS_7E7E,
188+
I2C_HID_QUIRK_NO_RUNTIME_PM },
187189
{ 0, 0 }
188190
};
189191

0 commit comments

Comments
 (0)