* [PATCH 1/2] Introduces Plantronics driver to fix errant mouse events.
@ 2014-10-31 19:20 Cole, JD
2014-10-31 23:53 ` dmitry.torokhov
2014-11-01 2:12 ` Benjamin Tissoires
0 siblings, 2 replies; 6+ messages in thread
From: Cole, JD @ 2014-10-31 19:20 UTC (permalink / raw)
To: linux-input@vger.kernel.org
Cc: jkosina@suse.cz, dmitry.torokhov@gmail.com, bleung@chromium.org,
Junge, Terry, Dsouza, Sunil, Wesselman, Tom
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: JD Cole <jd.cole@plantronics.com>
---
drivers/hid/Kconfig | 7 ++++
drivers/hid/Makefile | 1 +
drivers/hid/hid-core.c | 1 +
drivers/hid/hid-ids.h | 2 ++
drivers/hid/hid-plantronics.c | 78 +++++++++++++++++++++++++++++++++++++++++
include/linux/hid.h | 3 ++
6 files changed, 92 insertions(+)
create mode 100644 drivers/hid/hid-plantronics.c
diff --git a/drivers/hid/Kconfig b/drivers/hid/Kconfig
index f42df4d..bf1c74e 100644
--- a/drivers/hid/Kconfig
+++ b/drivers/hid/Kconfig
@@ -613,6 +613,13 @@ config HID_PICOLCD_CIR
---help---
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
tristate "Primax non-fully HID-compliant devices"
depends on HID
diff --git a/drivers/hid/Makefile b/drivers/hid/Makefile
index e2850d8..5e7ac59 100644
--- a/drivers/hid/Makefile
+++ b/drivers/hid/Makefile
@@ -94,6 +94,7 @@ ifdef CONFIG_DEBUG_FS
hid-picolcd-y += hid-picolcd_debugfs.o
endif
+obj-$(CONFIG_HID_PLANTRONICS) += hid-plantronics.o
obj-$(CONFIG_HID_PRIMAX) += hid-primax.o
obj-$(CONFIG_HID_ROCCAT) += hid-roccat.o hid-roccat-common.o \
hid-roccat-arvo.o hid-roccat-isku.o hid-roccat-kone.o \
diff --git a/drivers/hid/hid-core.c b/drivers/hid/hid-core.c
index 73bd9e2..d50313c 100644
--- a/drivers/hid/hid-core.c
+++ b/drivers/hid/hid-core.c
@@ -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_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_PLANTRONICS, HID_ANY_ID) },
{ HID_USB_DEVICE(USB_VENDOR_ID_PRIMAX, USB_DEVICE_ID_PRIMAX_KEYBOARD) },
#if IS_ENABLED(CONFIG_HID_ROCCAT)
{ HID_USB_DEVICE(USB_VENDOR_ID_ROCCAT, USB_DEVICE_ID_ROCCAT_ARVO) },
diff --git a/drivers/hid/hid-ids.h b/drivers/hid/hid-ids.h
index e23ab8b..f9f476d 100644
--- a/drivers/hid/hid-ids.h
+++ b/drivers/hid/hid-ids.h
@@ -715,6 +715,8 @@
#define USB_DEVICE_ID_ORTEK_PKB1700 0x1700
#define USB_DEVICE_ID_ORTEK_WKB2000 0x2000
+#define USB_VENDOR_ID_PLANTRONICS 0x047f
+
#define USB_VENDOR_ID_PANASONIC 0x04da
#define USB_DEVICE_ID_PANABOARD_UBT780 0x1044
#define USB_DEVICE_ID_PANABOARD_UBT880 0x104d
diff --git a/drivers/hid/hid-plantronics.c b/drivers/hid/hid-plantronics.c
new file mode 100644
index 0000000..215cdbd
--- /dev/null
+++ b/drivers/hid/hid-plantronics.c
@@ -0,0 +1,78 @@
+/*
+ * 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");
diff --git a/include/linux/hid.h b/include/linux/hid.h
index 78ea9bf..a63f2aa 100644
--- a/include/linux/hid.h
+++ b/include/linux/hid.h
@@ -234,6 +234,9 @@ struct hid_item {
#define HID_DG_BARRELSWITCH 0x000d0044
#define HID_DG_ERASER 0x000d0045
#define HID_DG_TABLETPICK 0x000d0046
+
+#define HID_CP_CONSUMERCONTROL 0x000c0001
+
#define HID_DG_CONFIDENCE 0x000d0047
#define HID_DG_WIDTH 0x000d0048
#define HID_DG_HEIGHT 0x000d0049
--
1.7.9.5
________________________________
CONFIDENTIALITY NOTICE: This e-mail transmission, and any documents, files or previous e-mail messages attached to it, may contain information that is confidential and/or legally privileged. If you are not the intended recipient, or a person responsible for delivering it to the intended recipient, please DO NOT disclose the contents to another person, store or copy the information in any medium, or use any of the information contained in or attached to this transmission for any purpose. If you have received this transmission in error, please immediately notify the sender by reply email or at privacy@plantronics.com, and destroy the original transmission and its attachments without reading or saving in any manner.
For further information about Plantronics - the Company, its products, brands, partners, please visit our website www.plantronics.com.
^ permalink raw reply related [flat|nested] 6+ messages in thread
* Re: [PATCH 1/2] Introduces Plantronics driver to fix errant mouse events.
2014-10-31 19:20 [PATCH 1/2] Introduces Plantronics driver to fix errant mouse events Cole, JD
@ 2014-10-31 23:53 ` dmitry.torokhov
2014-11-01 0:34 ` JD Cole
2014-11-01 2:12 ` Benjamin Tissoires
1 sibling, 1 reply; 6+ messages in thread
From: dmitry.torokhov @ 2014-10-31 23:53 UTC (permalink / raw)
To: Cole, JD
Cc: linux-input@vger.kernel.org, jkosina@suse.cz, bleung@chromium.org,
Junge, Terry, Dsouza, Sunil, Wesselman, Tom
Hi JD,
On Fri, Oct 31, 2014 at 07:20:13PM +0000, Cole, JD wrote:
> 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: JD Cole <jd.cole@plantronics.com>
> ---
> drivers/hid/Kconfig | 7 ++++
> drivers/hid/Makefile | 1 +
> drivers/hid/hid-core.c | 1 +
> drivers/hid/hid-ids.h | 2 ++
> drivers/hid/hid-plantronics.c | 78 +++++++++++++++++++++++++++++++++++++++++
> include/linux/hid.h | 3 ++
> 6 files changed, 92 insertions(+)
> create mode 100644 drivers/hid/hid-plantronics.c
>
> diff --git a/drivers/hid/Kconfig b/drivers/hid/Kconfig
> index f42df4d..bf1c74e 100644
> --- a/drivers/hid/Kconfig
> +++ b/drivers/hid/Kconfig
> @@ -613,6 +613,13 @@ config HID_PICOLCD_CIR
> ---help---
> 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.
> +
It looks like your MUA or MTA converted all TABs into spaces. Could you
please try resending?
Thanks!
--
Dmitry
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH 1/2] Introduces Plantronics driver to fix errant mouse events.
2014-10-31 23:53 ` dmitry.torokhov
@ 2014-11-01 0:34 ` JD Cole
2014-11-01 0:42 ` Dmitry Torokhov
0 siblings, 1 reply; 6+ messages in thread
From: JD Cole @ 2014-11-01 0:34 UTC (permalink / raw)
To: dmitry.torokhov
Cc: linux-input@vger.kernel.org, jkosina@suse.cz, bleung@chromium.org,
Junge, Terry, Dsouza, Sunil, Wesselman, Tom
Dmitry,
On Oct 31, 2014, at 4:53 PM, dmitry.torokhov@gmail.com wrote:
> Hi JD,
>
> On Fri, Oct 31, 2014 at 07:20:13PM +0000, Cole, JD wrote:
>> 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: JD Cole <jd.cole@plantronics.com>
>> ---
>> drivers/hid/Kconfig | 7 ++++
>> drivers/hid/Makefile | 1 +
> It looks like your MUA or MTA converted all TABs into spaces. Could you
> please try resending?
I’ll update the second patch once the formatting is known good.
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: JD Cole <jd.cole@plantronics.com>
---
drivers/hid/Kconfig | 7 ++++
drivers/hid/Makefile | 1 +
drivers/hid/hid-core.c | 1 +
drivers/hid/hid-ids.h | 2 ++
drivers/hid/hid-plantronics.c | 78 +++++++++++++++++++++++++++++++++++++++++
include/linux/hid.h | 3 ++
6 files changed, 92 insertions(+)
create mode 100644 drivers/hid/hid-plantronics.c
diff --git a/drivers/hid/Kconfig b/drivers/hid/Kconfig
index f42df4d..bf1c74e 100644
--- a/drivers/hid/Kconfig
+++ b/drivers/hid/Kconfig
@@ -613,6 +613,13 @@ config HID_PICOLCD_CIR
---help---
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
tristate "Primax non-fully HID-compliant devices"
depends on HID
diff --git a/drivers/hid/Makefile b/drivers/hid/Makefile
index e2850d8..5e7ac59 100644
--- a/drivers/hid/Makefile
+++ b/drivers/hid/Makefile
@@ -94,6 +94,7 @@ ifdef CONFIG_DEBUG_FS
hid-picolcd-y += hid-picolcd_debugfs.o
endif
+obj-$(CONFIG_HID_PLANTRONICS) += hid-plantronics.o
obj-$(CONFIG_HID_PRIMAX) += hid-primax.o
obj-$(CONFIG_HID_ROCCAT) += hid-roccat.o hid-roccat-common.o \
hid-roccat-arvo.o hid-roccat-isku.o hid-roccat-kone.o \
diff --git a/drivers/hid/hid-core.c b/drivers/hid/hid-core.c
index 73bd9e2..d50313c 100644
--- a/drivers/hid/hid-core.c
+++ b/drivers/hid/hid-core.c
@@ -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_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_PLANTRONICS, HID_ANY_ID) },
{ HID_USB_DEVICE(USB_VENDOR_ID_PRIMAX, USB_DEVICE_ID_PRIMAX_KEYBOARD) },
#if IS_ENABLED(CONFIG_HID_ROCCAT)
{ HID_USB_DEVICE(USB_VENDOR_ID_ROCCAT, USB_DEVICE_ID_ROCCAT_ARVO) },
diff --git a/drivers/hid/hid-ids.h b/drivers/hid/hid-ids.h
index e23ab8b..f9f476d 100644
--- a/drivers/hid/hid-ids.h
+++ b/drivers/hid/hid-ids.h
@@ -715,6 +715,8 @@
#define USB_DEVICE_ID_ORTEK_PKB1700 0x1700
#define USB_DEVICE_ID_ORTEK_WKB2000 0x2000
+#define USB_VENDOR_ID_PLANTRONICS 0x047f
+
#define USB_VENDOR_ID_PANASONIC 0x04da
#define USB_DEVICE_ID_PANABOARD_UBT780 0x1044
#define USB_DEVICE_ID_PANABOARD_UBT880 0x104d
diff --git a/drivers/hid/hid-plantronics.c b/drivers/hid/hid-plantronics.c
new file mode 100644
index 0000000..215cdbd
--- /dev/null
+++ b/drivers/hid/hid-plantronics.c
@@ -0,0 +1,78 @@
+/*
+ * 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");
diff --git a/include/linux/hid.h b/include/linux/hid.h
index 78ea9bf..a63f2aa 100644
--- a/include/linux/hid.h
+++ b/include/linux/hid.h
@@ -234,6 +234,9 @@ struct hid_item {
#define HID_DG_BARRELSWITCH 0x000d0044
#define HID_DG_ERASER 0x000d0045
#define HID_DG_TABLETPICK 0x000d0046
+
+#define HID_CP_CONSUMERCONTROL 0x000c0001
+
#define HID_DG_CONFIDENCE 0x000d0047
#define HID_DG_WIDTH 0x000d0048
#define HID_DG_HEIGHT 0x000d0049
--
1.7.9.5
--
To unsubscribe from this list: send the line "unsubscribe linux-input" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply related [flat|nested] 6+ messages in thread
* Re: [PATCH 1/2] Introduces Plantronics driver to fix errant mouse events.
2014-11-01 0:34 ` JD Cole
@ 2014-11-01 0:42 ` Dmitry Torokhov
0 siblings, 0 replies; 6+ messages in thread
From: Dmitry Torokhov @ 2014-11-01 0:42 UTC (permalink / raw)
To: JD Cole
Cc: linux-input@vger.kernel.org, jkosina@suse.cz, bleung@chromium.org,
Junge, Terry, Dsouza, Sunil, Wesselman, Tom
On Fri, Oct 31, 2014 at 05:34:42PM -0700, JD Cole wrote:
> Dmitry,
>
> On Oct 31, 2014, at 4:53 PM, dmitry.torokhov@gmail.com wrote:
>
> > Hi JD,
> >
> > On Fri, Oct 31, 2014 at 07:20:13PM +0000, Cole, JD wrote:
> >> 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: JD Cole <jd.cole@plantronics.com>
> >> ---
> >> drivers/hid/Kconfig | 7 ++++
> >> drivers/hid/Makefile | 1 +
> > It looks like your MUA or MTA converted all TABs into spaces. Could you
> > please try resending?
>
> I’ll update the second patch once the formatting is known good.
>
>
> 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: JD Cole <jd.cole@plantronics.com>
This looks good to me.
Reviewed-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
> ---
> drivers/hid/Kconfig | 7 ++++
> drivers/hid/Makefile | 1 +
> drivers/hid/hid-core.c | 1 +
> drivers/hid/hid-ids.h | 2 ++
> drivers/hid/hid-plantronics.c | 78 +++++++++++++++++++++++++++++++++++++++++
> include/linux/hid.h | 3 ++
> 6 files changed, 92 insertions(+)
> create mode 100644 drivers/hid/hid-plantronics.c
>
> diff --git a/drivers/hid/Kconfig b/drivers/hid/Kconfig
> index f42df4d..bf1c74e 100644
> --- a/drivers/hid/Kconfig
> +++ b/drivers/hid/Kconfig
> @@ -613,6 +613,13 @@ config HID_PICOLCD_CIR
> ---help---
> 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
> tristate "Primax non-fully HID-compliant devices"
> depends on HID
> diff --git a/drivers/hid/Makefile b/drivers/hid/Makefile
> index e2850d8..5e7ac59 100644
> --- a/drivers/hid/Makefile
> +++ b/drivers/hid/Makefile
> @@ -94,6 +94,7 @@ ifdef CONFIG_DEBUG_FS
> hid-picolcd-y += hid-picolcd_debugfs.o
> endif
>
> +obj-$(CONFIG_HID_PLANTRONICS) += hid-plantronics.o
> obj-$(CONFIG_HID_PRIMAX) += hid-primax.o
> obj-$(CONFIG_HID_ROCCAT) += hid-roccat.o hid-roccat-common.o \
> hid-roccat-arvo.o hid-roccat-isku.o hid-roccat-kone.o \
> diff --git a/drivers/hid/hid-core.c b/drivers/hid/hid-core.c
> index 73bd9e2..d50313c 100644
> --- a/drivers/hid/hid-core.c
> +++ b/drivers/hid/hid-core.c
> @@ -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_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_PLANTRONICS, HID_ANY_ID) },
> { HID_USB_DEVICE(USB_VENDOR_ID_PRIMAX, USB_DEVICE_ID_PRIMAX_KEYBOARD) },
> #if IS_ENABLED(CONFIG_HID_ROCCAT)
> { HID_USB_DEVICE(USB_VENDOR_ID_ROCCAT, USB_DEVICE_ID_ROCCAT_ARVO) },
> diff --git a/drivers/hid/hid-ids.h b/drivers/hid/hid-ids.h
> index e23ab8b..f9f476d 100644
> --- a/drivers/hid/hid-ids.h
> +++ b/drivers/hid/hid-ids.h
> @@ -715,6 +715,8 @@
> #define USB_DEVICE_ID_ORTEK_PKB1700 0x1700
> #define USB_DEVICE_ID_ORTEK_WKB2000 0x2000
>
> +#define USB_VENDOR_ID_PLANTRONICS 0x047f
> +
> #define USB_VENDOR_ID_PANASONIC 0x04da
> #define USB_DEVICE_ID_PANABOARD_UBT780 0x1044
> #define USB_DEVICE_ID_PANABOARD_UBT880 0x104d
> diff --git a/drivers/hid/hid-plantronics.c b/drivers/hid/hid-plantronics.c
> new file mode 100644
> index 0000000..215cdbd
> --- /dev/null
> +++ b/drivers/hid/hid-plantronics.c
> @@ -0,0 +1,78 @@
> +/*
> + * 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");
> diff --git a/include/linux/hid.h b/include/linux/hid.h
> index 78ea9bf..a63f2aa 100644
> --- a/include/linux/hid.h
> +++ b/include/linux/hid.h
> @@ -234,6 +234,9 @@ struct hid_item {
> #define HID_DG_BARRELSWITCH 0x000d0044
> #define HID_DG_ERASER 0x000d0045
> #define HID_DG_TABLETPICK 0x000d0046
> +
> +#define HID_CP_CONSUMERCONTROL 0x000c0001
> +
> #define HID_DG_CONFIDENCE 0x000d0047
> #define HID_DG_WIDTH 0x000d0048
> #define HID_DG_HEIGHT 0x000d0049
> --
> 1.7.9.5
>
--
Dmitry
--
To unsubscribe from this list: send the line "unsubscribe linux-input" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH 1/2] Introduces Plantronics driver to fix errant mouse events.
2014-10-31 19:20 [PATCH 1/2] Introduces Plantronics driver to fix errant mouse events Cole, JD
2014-10-31 23:53 ` dmitry.torokhov
@ 2014-11-01 2:12 ` Benjamin Tissoires
2014-11-03 13:22 ` Jiri Kosina
1 sibling, 1 reply; 6+ messages in thread
From: Benjamin Tissoires @ 2014-11-01 2:12 UTC (permalink / raw)
To: Cole, JD
Cc: linux-input@vger.kernel.org, jkosina@suse.cz,
dmitry.torokhov@gmail.com, bleung@chromium.org, Junge, Terry,
Dsouza, Sunil, Wesselman, Tom
On Fri, Oct 31, 2014 at 3:20 PM, Cole, JD <JD.Cole@plantronics.com> wrote:
> 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: JD Cole <jd.cole@plantronics.com>
> ---
> drivers/hid/Kconfig | 7 ++++
> drivers/hid/Makefile | 1 +
> drivers/hid/hid-core.c | 1 +
> drivers/hid/hid-ids.h | 2 ++
> drivers/hid/hid-plantronics.c | 78 +++++++++++++++++++++++++++++++++++++++++
> include/linux/hid.h | 3 ++
> 6 files changed, 92 insertions(+)
> create mode 100644 drivers/hid/hid-plantronics.c
>
> diff --git a/drivers/hid/Kconfig b/drivers/hid/Kconfig
> index f42df4d..bf1c74e 100644
> --- a/drivers/hid/Kconfig
> +++ b/drivers/hid/Kconfig
> @@ -613,6 +613,13 @@ config HID_PICOLCD_CIR
> ---help---
> 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
> tristate "Primax non-fully HID-compliant devices"
> depends on HID
> diff --git a/drivers/hid/Makefile b/drivers/hid/Makefile
> index e2850d8..5e7ac59 100644
> --- a/drivers/hid/Makefile
> +++ b/drivers/hid/Makefile
> @@ -94,6 +94,7 @@ ifdef CONFIG_DEBUG_FS
> hid-picolcd-y += hid-picolcd_debugfs.o
> endif
>
> +obj-$(CONFIG_HID_PLANTRONICS) += hid-plantronics.o
> obj-$(CONFIG_HID_PRIMAX) += hid-primax.o
> obj-$(CONFIG_HID_ROCCAT) += hid-roccat.o hid-roccat-common.o \
> hid-roccat-arvo.o hid-roccat-isku.o hid-roccat-kone.o \
> diff --git a/drivers/hid/hid-core.c b/drivers/hid/hid-core.c
> index 73bd9e2..d50313c 100644
> --- a/drivers/hid/hid-core.c
> +++ b/drivers/hid/hid-core.c
> @@ -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_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_PLANTRONICS, HID_ANY_ID) },
> { HID_USB_DEVICE(USB_VENDOR_ID_PRIMAX, USB_DEVICE_ID_PRIMAX_KEYBOARD) },
> #if IS_ENABLED(CONFIG_HID_ROCCAT)
> { HID_USB_DEVICE(USB_VENDOR_ID_ROCCAT, USB_DEVICE_ID_ROCCAT_ARVO) },
> diff --git a/drivers/hid/hid-ids.h b/drivers/hid/hid-ids.h
> index e23ab8b..f9f476d 100644
> --- a/drivers/hid/hid-ids.h
> +++ b/drivers/hid/hid-ids.h
> @@ -715,6 +715,8 @@
> #define USB_DEVICE_ID_ORTEK_PKB1700 0x1700
> #define USB_DEVICE_ID_ORTEK_WKB2000 0x2000
>
> +#define USB_VENDOR_ID_PLANTRONICS 0x047f
> +
> #define USB_VENDOR_ID_PANASONIC 0x04da
> #define USB_DEVICE_ID_PANABOARD_UBT780 0x1044
> #define USB_DEVICE_ID_PANABOARD_UBT880 0x104d
> diff --git a/drivers/hid/hid-plantronics.c b/drivers/hid/hid-plantronics.c
> new file mode 100644
> index 0000000..215cdbd
> --- /dev/null
> +++ b/drivers/hid/hid-plantronics.c
> @@ -0,0 +1,78 @@
> +/*
> + * 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;
> +}
Actually, in your case, you can even remove the probe function.
hid-core will do open the report and start the hardware for you.
Cheers,
Benjamin
> +
> +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");
> diff --git a/include/linux/hid.h b/include/linux/hid.h
> index 78ea9bf..a63f2aa 100644
> --- a/include/linux/hid.h
> +++ b/include/linux/hid.h
> @@ -234,6 +234,9 @@ struct hid_item {
> #define HID_DG_BARRELSWITCH 0x000d0044
> #define HID_DG_ERASER 0x000d0045
> #define HID_DG_TABLETPICK 0x000d0046
> +
> +#define HID_CP_CONSUMERCONTROL 0x000c0001
> +
> #define HID_DG_CONFIDENCE 0x000d0047
> #define HID_DG_WIDTH 0x000d0048
> #define HID_DG_HEIGHT 0x000d0049
> --
> 1.7.9.5
>
>
>
> ________________________________
>
> CONFIDENTIALITY NOTICE: This e-mail transmission, and any documents, files or previous e-mail messages attached to it, may contain information that is confidential and/or legally privileged. If you are not the intended recipient, or a person responsible for delivering it to the intended recipient, please DO NOT disclose the contents to another person, store or copy the information in any medium, or use any of the information contained in or attached to this transmission for any purpose. If you have received this transmission in error, please immediately notify the sender by reply email or at privacy@plantronics.com, and destroy the original transmission and its attachments without reading or saving in any manner.
>
> For further information about Plantronics - the Company, its products, brands, partners, please visit our website www.plantronics.com.
> --
> To unsubscribe from this list: send the line "unsubscribe linux-input" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH 1/2] Introduces Plantronics driver to fix errant mouse events.
2014-11-01 2:12 ` Benjamin Tissoires
@ 2014-11-03 13:22 ` Jiri Kosina
0 siblings, 0 replies; 6+ messages in thread
From: Jiri Kosina @ 2014-11-03 13:22 UTC (permalink / raw)
To: Benjamin Tissoires
Cc: Cole, JD, linux-input@vger.kernel.org, dmitry.torokhov@gmail.com,
bleung@chromium.org, Junge, Terry, Dsouza, Sunil, Wesselman, Tom
On Fri, 31 Oct 2014, Benjamin Tissoires wrote:
> > +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;
> > +}
>
> Actually, in your case, you can even remove the probe function.
> hid-core will do open the report and start the hardware for you.
Good catch, thanks. I have removed the superfluous .probe() and applied
(with Dmitry's Reviewed-by: added to patch no .1).
Thanks,
--
Jiri Kosina
SUSE Labs
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2014-11-03 13:22 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-10-31 19:20 [PATCH 1/2] Introduces Plantronics driver to fix errant mouse events Cole, JD
2014-10-31 23:53 ` dmitry.torokhov
2014-11-01 0:34 ` JD Cole
2014-11-01 0:42 ` Dmitry Torokhov
2014-11-01 2:12 ` Benjamin Tissoires
2014-11-03 13:22 ` Jiri Kosina
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).