Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 1a3f83f6 authored by JD Cole's avatar JD Cole Committed by Jiri Kosina
Browse files

HID: plantronics: fix errant mouse events



This version of the driver prevents Telephony pages which are not mapped as
Consumer Control applications AND are not on the Consumer Page from being
registered by the hid-input driver.

Signed-off-by: default avatarJD Cole <jd.cole@plantronics.com>
Reviewed-by: default avatarDmitry Torokhov <dmitry.torokhov@gmail.com>
Signed-off-by: default avatarJiri Kosina <jkosina@suse.cz>
parent 7f474df0
Loading
Loading
Loading
Loading
+7 −0
Original line number Original line Diff line number Diff line
@@ -613,6 +613,13 @@ config HID_PICOLCD_CIR
	---help---
	---help---
	  Provide access to PicoLCD's CIR interface via remote control (LIRC).
	  Provide access to PicoLCD's CIR interface via remote control (LIRC).


config HID_PLANTRONICS
	tristate "Plantronics USB HID Driver"
	default !EXPERT
	depends on HID
	---help---
	Provides HID support for Plantronics telephony devices.

config HID_PRIMAX
config HID_PRIMAX
	tristate "Primax non-fully HID-compliant devices"
	tristate "Primax non-fully HID-compliant devices"
	depends on HID
	depends on HID
+1 −0
Original line number Original line Diff line number Diff line
@@ -94,6 +94,7 @@ ifdef CONFIG_DEBUG_FS
hid-picolcd-y			+= hid-picolcd_debugfs.o
hid-picolcd-y			+= hid-picolcd_debugfs.o
endif
endif


obj-$(CONFIG_HID_PLANTRONICS)	+= hid-plantronics.o
obj-$(CONFIG_HID_PRIMAX)	+= hid-primax.o
obj-$(CONFIG_HID_PRIMAX)	+= hid-primax.o
obj-$(CONFIG_HID_ROCCAT)	+= hid-roccat.o hid-roccat-common.o \
obj-$(CONFIG_HID_ROCCAT)	+= hid-roccat.o hid-roccat-common.o \
	hid-roccat-arvo.o hid-roccat-isku.o hid-roccat-kone.o \
	hid-roccat-arvo.o hid-roccat-isku.o hid-roccat-kone.o \
+1 −0
Original line number Original line Diff line number Diff line
@@ -1886,6 +1886,7 @@ static const struct hid_device_id hid_have_special_driver[] = {
	{ HID_USB_DEVICE(USB_VENDOR_ID_ORTEK, USB_DEVICE_ID_ORTEK_WKB2000) },
	{ HID_USB_DEVICE(USB_VENDOR_ID_ORTEK, USB_DEVICE_ID_ORTEK_WKB2000) },
	{ HID_USB_DEVICE(USB_VENDOR_ID_PENMOUNT, USB_DEVICE_ID_PENMOUNT_6000) },
	{ HID_USB_DEVICE(USB_VENDOR_ID_PENMOUNT, USB_DEVICE_ID_PENMOUNT_6000) },
	{ HID_USB_DEVICE(USB_VENDOR_ID_PETALYNX, USB_DEVICE_ID_PETALYNX_MAXTER_REMOTE) },
	{ HID_USB_DEVICE(USB_VENDOR_ID_PETALYNX, USB_DEVICE_ID_PETALYNX_MAXTER_REMOTE) },
	{ HID_USB_DEVICE(USB_VENDOR_ID_PLANTRONICS, HID_ANY_ID) },
	{ HID_USB_DEVICE(USB_VENDOR_ID_PRIMAX, USB_DEVICE_ID_PRIMAX_KEYBOARD) },
	{ HID_USB_DEVICE(USB_VENDOR_ID_PRIMAX, USB_DEVICE_ID_PRIMAX_KEYBOARD) },
#if IS_ENABLED(CONFIG_HID_ROCCAT)
#if IS_ENABLED(CONFIG_HID_ROCCAT)
	{ HID_USB_DEVICE(USB_VENDOR_ID_ROCCAT, USB_DEVICE_ID_ROCCAT_ARVO) },
	{ HID_USB_DEVICE(USB_VENDOR_ID_ROCCAT, USB_DEVICE_ID_ROCCAT_ARVO) },
+2 −0
Original line number Original line Diff line number Diff line
@@ -715,6 +715,8 @@
#define USB_DEVICE_ID_ORTEK_PKB1700	0x1700
#define USB_DEVICE_ID_ORTEK_PKB1700	0x1700
#define USB_DEVICE_ID_ORTEK_WKB2000	0x2000
#define USB_DEVICE_ID_ORTEK_WKB2000	0x2000


#define USB_VENDOR_ID_PLANTRONICS	0x047f

#define USB_VENDOR_ID_PANASONIC		0x04da
#define USB_VENDOR_ID_PANASONIC		0x04da
#define USB_DEVICE_ID_PANABOARD_UBT780	0x1044
#define USB_DEVICE_ID_PANABOARD_UBT780	0x1044
#define USB_DEVICE_ID_PANABOARD_UBT880	0x104d
#define USB_DEVICE_ID_PANABOARD_UBT880	0x104d
+78 −0
Original line number Original line Diff line number Diff line
/*
 *  Plantronics USB HID Driver
 *
 *  Copyright (c) 2014 JD Cole <jd.cole@plantronics.com>
 *  Copyright (c) 2014 Terry Junge <terry.junge@plantronics.com>
 */

/*
 * This program is free software; you can redistribute it and/or modify it
 * under the terms of the GNU General Public License as published by the Free
 * Software Foundation; either version 2 of the License, or (at your option)
 * any later version.
 */

#include "hid-ids.h"

#include <linux/hid.h>
#include <linux/module.h>

static int plantronics_input_mapping(struct hid_device *hdev,
				     struct hid_input *hi,
				     struct hid_field *field,
				     struct hid_usage *usage,
				     unsigned long **bit, int *max)
{
	if (field->application == HID_CP_CONSUMERCONTROL
	    && (usage->hid & HID_USAGE_PAGE) == HID_UP_CONSUMER) {
		hid_dbg(hdev, "usage: %08x (appl: %08x) - defaulted\n",
			 usage->hid, field->application);
		return 0;
	}

	hid_dbg(hdev, "usage: %08x (appl: %08x) - ignored\n",
		usage->hid, field->application);

	return -1;
}

static int plantronics_probe(struct hid_device *hdev,
			     const struct hid_device_id *id)
{
	int ret;

	ret = hid_parse(hdev);
	if (ret) {
		hid_err(hdev, "parse failed\n");
		goto err;
	}

	ret = hid_hw_start(hdev, HID_CONNECT_DEFAULT);
	if (ret) {
		hid_err(hdev, "hw start failed\n");
		goto err;
	}

	return 0;
 err:
	return ret;
}

static const struct hid_device_id plantronics_devices[] = {
	{ HID_USB_DEVICE(USB_VENDOR_ID_PLANTRONICS, HID_ANY_ID) },
	{ }
};
MODULE_DEVICE_TABLE(hid, plantronics_devices);

static struct hid_driver plantronics_driver = {
	.name = "plantronics",
	.id_table = plantronics_devices,
	.input_mapping = plantronics_input_mapping,
	.probe = plantronics_probe,
};
module_hid_driver(plantronics_driver);

MODULE_AUTHOR("JD Cole <jd.cole@plantronics.com>");
MODULE_AUTHOR("Terry Junge <terry.junge@plantronics.com>");
MODULE_DESCRIPTION("Plantronics USB HID Driver");
MODULE_LICENSE("GPL");
Loading