Skip to content
This repository was archived by the owner on Nov 8, 2023. It is now read-only.

Commit 1fa959e

Browse files
WadeWangHPgregkh
authored andcommitted
HID: plantronics: Workaround for an unexcepted opposite volume key
commit 87b6962 upstream. Some Plantronics headset as the below send an unexcept opposite volume key's HID report for each volume key press after 200ms, like unecepted Volume Up Key following Volume Down key pressed by user. This patch adds a quirk to hid-plantronics for these devices, which will ignore the second unexcepted opposite volume key if it happens within 220ms from the last one that was handled. Plantronics EncorePro 500 Series (047f:431e) Plantronics Blackwire_3325 Series (047f:430c) The patch was tested on the mentioned model, it shouldn't affect other models, however, this quirk might be needed for them too. Auto-repeat (when a key is held pressed) is not affected per test result. Cc: [email protected] Signed-off-by: Wade Wang <[email protected]> Signed-off-by: Jiri Kosina <[email protected]> Signed-off-by: Greg Kroah-Hartman <[email protected]>
1 parent c1846e0 commit 1fa959e

File tree

2 files changed

+25
-0
lines changed

2 files changed

+25
-0
lines changed

drivers/hid/hid-ids.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1033,6 +1033,8 @@
10331033
#define USB_DEVICE_ID_PLANTRONICS_BLACKWIRE_3220_SERIES 0xc056
10341034
#define USB_DEVICE_ID_PLANTRONICS_BLACKWIRE_3215_SERIES 0xc057
10351035
#define USB_DEVICE_ID_PLANTRONICS_BLACKWIRE_3225_SERIES 0xc058
1036+
#define USB_DEVICE_ID_PLANTRONICS_BLACKWIRE_3325_SERIES 0x430c
1037+
#define USB_DEVICE_ID_PLANTRONICS_ENCOREPRO_500_SERIES 0x431e
10361038

10371039
#define USB_VENDOR_ID_PANASONIC 0x04da
10381040
#define USB_DEVICE_ID_PANABOARD_UBT780 0x1044

drivers/hid/hid-plantronics.c

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,8 +38,10 @@
3838
(usage->hid & HID_USAGE_PAGE) == HID_UP_CONSUMER)
3939

4040
#define PLT_QUIRK_DOUBLE_VOLUME_KEYS BIT(0)
41+
#define PLT_QUIRK_FOLLOWED_OPPOSITE_VOLUME_KEYS BIT(1)
4142

4243
#define PLT_DOUBLE_KEY_TIMEOUT 5 /* ms */
44+
#define PLT_FOLLOWED_OPPOSITE_KEY_TIMEOUT 220 /* ms */
4345

4446
struct plt_drv_data {
4547
unsigned long device_type;
@@ -137,6 +139,21 @@ static int plantronics_event(struct hid_device *hdev, struct hid_field *field,
137139

138140
drv_data->last_volume_key_ts = cur_ts;
139141
}
142+
if (drv_data->quirks & PLT_QUIRK_FOLLOWED_OPPOSITE_VOLUME_KEYS) {
143+
unsigned long prev_ts, cur_ts;
144+
145+
/* Usages are filtered in plantronics_usages. */
146+
147+
if (!value) /* Handle key presses only. */
148+
return 0;
149+
150+
prev_ts = drv_data->last_volume_key_ts;
151+
cur_ts = jiffies;
152+
if (jiffies_to_msecs(cur_ts - prev_ts) <= PLT_FOLLOWED_OPPOSITE_KEY_TIMEOUT)
153+
return 1; /* Ignore the followed opposite volume key. */
154+
155+
drv_data->last_volume_key_ts = cur_ts;
156+
}
140157

141158
return 0;
142159
}
@@ -210,6 +227,12 @@ static const struct hid_device_id plantronics_devices[] = {
210227
{ HID_USB_DEVICE(USB_VENDOR_ID_PLANTRONICS,
211228
USB_DEVICE_ID_PLANTRONICS_BLACKWIRE_3225_SERIES),
212229
.driver_data = PLT_QUIRK_DOUBLE_VOLUME_KEYS },
230+
{ HID_USB_DEVICE(USB_VENDOR_ID_PLANTRONICS,
231+
USB_DEVICE_ID_PLANTRONICS_BLACKWIRE_3325_SERIES),
232+
.driver_data = PLT_QUIRK_FOLLOWED_OPPOSITE_VOLUME_KEYS },
233+
{ HID_USB_DEVICE(USB_VENDOR_ID_PLANTRONICS,
234+
USB_DEVICE_ID_PLANTRONICS_ENCOREPRO_500_SERIES),
235+
.driver_data = PLT_QUIRK_FOLLOWED_OPPOSITE_VOLUME_KEYS },
213236
{ HID_USB_DEVICE(USB_VENDOR_ID_PLANTRONICS, HID_ANY_ID) },
214237
{ }
215238
};

0 commit comments

Comments
 (0)