* [git pull] Input updates for 3.18-rc0
From: Dmitry Torokhov @ 2014-10-31 23:48 UTC (permalink / raw)
To: Linus Torvalds; +Cc: linux-kernel, linux-input, Jiri Kosina
Hi Linus,
Please pull from:
git://git.kernel.org/pub/scm/linux/kernel/git/dtor/input.git for-linus
or
master.kernel.org:/pub/scm/linux/kernel/git/dtor/input.git for-linus
to receive updates for the input subsystem. You will get a bunch of
fixes for minor defects reported by Coverity, a few driver fixups and
revert of i8042.nomux change so that we are once again enable active MUX
mode if box claims to support it.
Changelog:
---------
Alexandre Courbot (1):
Input: soc_button_array - update calls to gpiod_get*()
Dmitry Eremin-Solenikov (1):
Input: wm97xx - adapt parameters to tosa touchscreen.
Dmitry Torokhov (6):
Input: opencores-kbd - fix error handling
Input: ims-pcu - fix dead code in ims_pcu_ofn_reg_addr_store()
Input: vsxxxaa - fix code dropping bytes from queue
Input: psmouse - remove unneeded check in psmouse_reconnect()
Input: max77693-haptic - fix potential overflow
Revert "Input: i8042 - disable active multiplexing by default"
Hans de Goede (1):
Input: i8042 - quirks for Fujitsu Lifebook A544 and Lifebook AH544
Linus Walleij (1):
Input: stmpe-keypad - fix valid key line bitmask
Tobias Klauser (2):
Input: altera_ps2 - write to correct register when disabling interrupts
Input: altera_ps2 - use correct type for irq return value
Diffstat:
--------
Documentation/kernel-parameters.txt | 2 +-
drivers/input/keyboard/opencores-kbd.c | 2 +-
drivers/input/keyboard/stmpe-keypad.c | 2 +-
drivers/input/misc/ims-pcu.c | 2 +-
drivers/input/misc/max77693-haptic.c | 5 +-
drivers/input/misc/soc_button_array.c | 2 +-
drivers/input/mouse/psmouse-base.c | 7 -
drivers/input/mouse/vsxxxaa.c | 2 +-
drivers/input/serio/altera_ps2.c | 4 +-
drivers/input/serio/i8042-x86ia64io.h | 297 +++++++++++++++++++++++++++++++-
drivers/input/serio/i8042.c | 2 +-
drivers/input/touchscreen/wm97xx-core.c | 4 +-
12 files changed, 302 insertions(+), 29 deletions(-)
--
Dmitry
^ permalink raw reply
* Re: [PATCH 1/2] Introduces Plantronics driver to fix errant mouse events.
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
In-Reply-To: <512A3191-0BAA-4E92-A863-66AFD2A16422@plantronics.com>
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
* Re: [PATCH 1/2] Introduces Plantronics driver to fix errant mouse events.
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
In-Reply-To: <20141031235342.GA11631@dtor-ws>
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
* Re: [PATCH 1/2] Introduces Plantronics driver to fix errant mouse events.
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
In-Reply-To: <2DDA39F7-7F05-474E-BA9C-106B53006953@jdc.me>
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
* Re: [PATCH 2/2] Added missing HID Consumer Page identifiers, for completeness.
From: JD Cole @ 2014-11-01 0:44 UTC (permalink / raw)
To: linux-input@vger.kernel.org
Cc: jkosina@suse.cz, dmitry.torokhov@gmail.com, bleung@chromium.org,
Junge, Terry, Wesselman, Tom, Dsouza, Sunil
In-Reply-To: <899CD57B-10D4-4AB1-B006-50572BCD6871@plantronics.com>
On Oct 31, 2014, at 12:23 PM, Cole, JD <JD.Cole@plantronics.com> wrote:
> Adds CA and NAry usage type identifiers.
>
> Signed-off-by: JD Cole <jd.cole@plantronics.com>
> ---
> include/linux/hid.h | 24 ++++++++++++++++++++++++
> 1 file changed, 24 insertions(+)
>
> diff --git a/include/linux/hid.h b/include/linux/hid.h
Tabs fixed.
Adds CA and NAry usage type identifiers.
Signed-off-by: JD Cole <jd.cole@plantronics.com>
---
include/linux/hid.h | 24 ++++++++++++++++++++++++
1 file changed, 24 insertions(+)
diff --git a/include/linux/hid.h b/include/linux/hid.h
index a63f2aa..58a89ed 100644
--- a/include/linux/hid.h
+++ b/include/linux/hid.h
@@ -236,6 +236,30 @@ struct hid_item {
#define HID_DG_TABLETPICK 0x000d0046
#define HID_CP_CONSUMERCONTROL 0x000c0001
+#define HID_CP_NUMERICKEYPAD 0x000c0002
+#define HID_CP_PROGRAMMABLEBUTTONS 0x000c0003
+#define HID_CP_MICROPHONE 0x000c0004
+#define HID_CP_HEADPHONE 0x000c0005
+#define HID_CP_GRAPHICEQUALIZER 0x000c0006
+#define HID_CP_FUNCTIONBUTTONS 0x000c0036
+#define HID_CP_SELECTION 0x000c0080
+#define HID_CP_MEDIASELECTION 0x000c0087
+#define HID_CP_SELECTDISC 0x000c00ba
+#define HID_CP_PLAYBACKSPEED 0x000c00f1
+#define HID_CP_PROXIMITY 0x000c0109
+#define HID_CP_SPEAKERSYSTEM 0x000c0160
+#define HID_CP_CHANNELLEFT 0x000c0161
+#define HID_CP_CHANNELRIGHT 0x000c0162
+#define HID_CP_CHANNELCENTER 0x000c0163
+#define HID_CP_CHANNELFRONT 0x000c0164
+#define HID_CP_CHANNELCENTERFRONT 0x000c0165
+#define HID_CP_CHANNELSIDE 0x000c0166
+#define HID_CP_CHANNELSURROUND 0x000c0167
+#define HID_CP_CHANNELLOWFREQUENCYENHANCEMENT 0x000c0168
+#define HID_CP_CHANNELTOP 0x000c0169
+#define HID_CP_CHANNELUNKNOWN 0x000c016a
+#define HID_CP_APPLICATIONLAUNCHBUTTONS 0x000c0180
+#define HID_CP_GENERICGUIAPPLICATIONCONTROLS 0x000c0200
#define HID_DG_CONFIDENCE 0x000d0047
#define HID_DG_WIDTH 0x000d0048
--
1.7.9.5
^ permalink raw reply related
* Re: [PATCH 1/2] Introduces Plantronics driver to fix errant mouse events.
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
In-Reply-To: <512A3191-0BAA-4E92-A863-66AFD2A16422@plantronics.com>
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
* Re: [PATCH v2] Input: i8042 - add mux quirk for HP EliteBook
From: Dmitry Torokhov @ 2014-11-01 2:57 UTC (permalink / raw)
To: Luis Henriques; +Cc: linux-input, linux-kernel
In-Reply-To: <20141028230841.GB19675@dtor-ws>
On Tue, Oct 28, 2014 at 04:08:41PM -0700, Dmitry Torokhov wrote:
> On Tue, Oct 28, 2014 at 10:27:12PM +0000, Luis Henriques wrote:
> > This laptop requires active multiplexing to be enabled in order to be able
> > to separate the PS/2 mouse and the touchpad.
> >
> > Signed-off-by: Luis Henriques <luis.henriques@canonical.com>
>
> Applied, thank you.
Actually I am reverting the nomux patch, so unapplied ;)
--
Dmitry
^ permalink raw reply
* Re: [PATCH 11/15] sound: soc: poodle: make use of new locomo GPIO interface
From: Alexandre Courbot @ 2014-11-01 5:42 UTC (permalink / raw)
To: Dmitry Eremin-Solenikov
Cc: Linus Walleij, Mark Brown, linux-arm-kernel@lists.infradead.org,
linux-gpio@vger.kernel.org, Linux Input,
linux-leds@vger.kernel.org, linux-spi@vger.kernel.org,
linux-fbdev@vger.kernel.org, alsa-devel@alsa-project.org,
Andrea Adami, Russell King, Daniel Mack, Haojian Zhuang,
Robert Jarzmik, Dmitry Torokhov, Bryan Wu, Richard Purdie,
Samuel Ortiz, Lee Jones, Ji
In-Reply-To: <CALT56yP6K-sXOGM4z-WRsvFVjOi-13wM+Ewqn6WpDmNB4xcOEg@mail.gmail.com>
On Fri, Oct 31, 2014 at 6:58 PM, Dmitry Eremin-Solenikov
<dbaryshkov@gmail.com> wrote:
> 2014-10-31 12:52 GMT+03:00 Linus Walleij <linus.walleij@linaro.org>:
>> On Wed, Oct 29, 2014 at 4:03 AM, Alexandre Courbot <gnurou@gmail.com> wrote:
>>> On Tue, Oct 28, 2014 at 11:58 PM, Mark Brown <broonie@kernel.org> wrote:
>>>> On Tue, Oct 28, 2014 at 03:02:04AM +0300, Dmitry Eremin-Solenikov wrote:
>>>>> Since LoCoMo driver has been converted to provide proper gpiolib
>>>>> interface, make poodle ASoC platform driver use gpiolib API.
>>>>
>>>> Please use subject lines matching the style for the subsystem.
>>>>
>>>>> + ret = gpio_request_array(poodle_gpios, ARRAY_SIZE(poodle_gpios));
>>>>> + if (ret) {
>>>>> + dev_err(&pdev->dev, "gpio_request_array() failed: %d\n",
>>>>> + ret);
>>>>> + return ret;
>>>>> + }
>>>>
>>>> I sense a need for devm_gpio_request_array() here. Otherwise this looks
>>>> fine - ideally it'd move to gpiod but moving to gpiolib is a clear win
>>>> so no need to block on this.
>>>
>>> I wish Dmitry took the opportunity to move this driver to the gpiod
>>> API, especially since doing so would be trivial for this driver.
>>
>> +1 on this.
>>
>> However this platform is not device tree, so this implies setting up
>> a descriptor table for the affected driver(s) to work properly.
>> See Documentation/gpio/board.txt
>
> I checked the gpiod interfaces after original suggestion by Alexandre.
>
> Introducing those mapping tables (much like pinctrl tables) look like
> a duplicate effort if Russell will permit adding a DT support. So
> I thought that I will reconsider gpiod/pinctrl/etc after fixing
> LoCoMo, reiterating IRQ patches, possibly switching to COMMON_CLK
> and (finally) thinking about device tree support.
Note that the mapping tables are likely not going to end up being
huge, and taking that step will allow you to convert to the gpiod
interface, something you would probably want to do later when adding
DT support anyway. So at the end of the day there would be very little
wasted effort: once converting to DT, just add the GPIO properties
into the appropriate node, remove the mapping tables, and you're done.
^ permalink raw reply
* Re: Problems with Wacom Intuos PT M (CTH680) on FreeBSD
From: Hans Petter Selasky @ 2014-11-01 7:40 UTC (permalink / raw)
To: Ping Cheng
Cc: Denis Akiyakov, Dmitry Torokhov, linux-input,
nox@jelal.kn-bremen.de >> Juergen Lock
In-Reply-To: <CAF8JNhJ8ZR5vvtcrOvv9-ySzN4aytBziEO90_Kif=Q4q7WgwmA@mail.gmail.com>
On 11/01/14 00:27, Ping Cheng wrote:
> If touch_input is NULL on FreeBSD, you need to figure out the root
> cause. Checking on touch_input itself would not fix the root cause...
Right.
The root cause is that FreeBSD launches two instances of the driver,
running in two different userland processes, for the two different Wacom
interfaces on a common USB device. In Linux the wacom interface drivers
are running from the same kernel, and can share the data in question,
but in FreeBSD's webcamd emulation, this doesn't work. Then the first
wacom probe call would have to grab the second interface.
Technically speaking this is a FreeBSD only problem and I plan to
deliver a patch with the webcamd software to fix this, like already
suggested to you guys. This situation can also happen on Linux in case
of a "BadUSB" device. That's why I think that the NULL check should be
upstreamed.
--HPS
^ permalink raw reply
* [PATCH v4] psmouse: Add some support for the FocalTech PS/2 protocol extensions.
From: Mathias Gottschlag @ 2014-11-01 9:37 UTC (permalink / raw)
To: Dmitry Torokhov, Hans de Goede; +Cc: linux-input, Mathias Gottschlag
Most of the protocol for these touchpads has been reverse engineered. This
commit adds a basic multitouch-capable driver.
A lot of the protocol is still unknown. Especially, we don't know how to
identify the device yet apart from the PNP ID.
The previous workaround for these devices has been left in place in case
the driver is not compiled into the kernel or in case some other device
with the same PNP ID is not recognized by the driver yet still has the same
problems with the device probing code.
Signed-off-by: Mathias Gottschlag <mgottschlag@gmail.com>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
---
Here is v4 of the driver, hopefully without any wrapped lines this time. I've
received further feedback, the size detection code should be correct on Asus
X200 and N550 as well.
drivers/input/mouse/Kconfig | 10 ++
drivers/input/mouse/focaltech.c | 300 ++++++++++++++++++++++++++++++++++++-
drivers/input/mouse/focaltech.h | 60 ++++++++
drivers/input/mouse/psmouse-base.c | 32 ++--
drivers/input/mouse/psmouse.h | 1 +
5 files changed, 386 insertions(+), 17 deletions(-)
diff --git a/drivers/input/mouse/Kconfig b/drivers/input/mouse/Kconfig
index 366fc7a..db973e5 100644
--- a/drivers/input/mouse/Kconfig
+++ b/drivers/input/mouse/Kconfig
@@ -146,6 +146,16 @@ config MOUSE_PS2_OLPC
If unsure, say N.
+config MOUSE_PS2_FOCALTECH
+ bool "FocalTech PS/2 mouse protocol extension" if EXPERT
+ default y
+ depends on MOUSE_PS2
+ help
+ Say Y here if you have a FocalTech PS/2 TouchPad connected to
+ your system.
+
+ If unsure, say Y.
+
config MOUSE_SERIAL
tristate "Serial mouse"
select SERIO
diff --git a/drivers/input/mouse/focaltech.c b/drivers/input/mouse/focaltech.c
index f4d657e..26bc5b7 100644
--- a/drivers/input/mouse/focaltech.c
+++ b/drivers/input/mouse/focaltech.c
@@ -2,6 +2,7 @@
* Focaltech TouchPad PS/2 mouse driver
*
* Copyright (c) 2014 Red Hat Inc.
+ * Copyright (c) 2014 Mathias Gottschlag <mgottschlag@gmail.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
@@ -13,15 +14,14 @@
* Hans de Goede <hdegoede@redhat.com>
*/
-/*
- * The Focaltech PS/2 touchpad protocol is unknown. This drivers deals with
- * detection only, to avoid further detection attempts confusing the touchpad
- * this way it at least works in PS/2 mouse compatibility mode.
- */
#include <linux/device.h>
#include <linux/libps2.h>
+#include <linux/input/mt.h>
+#include <linux/serio.h>
+#include <linux/slab.h>
#include "psmouse.h"
+#include "focaltech.h"
static const char * const focaltech_pnp_ids[] = {
"FLT0101",
@@ -30,6 +30,12 @@ static const char * const focaltech_pnp_ids[] = {
NULL
};
+/*
+ * Even if the kernel is built without support for Focaltech PS/2 touchpads (or
+ * when the real driver fails to recognize the device), we still have to detect
+ * them in order to avoid further detection attempts confusing the touchpad.
+ * This way it at least works in PS/2 mouse compatibility mode.
+ */
int focaltech_detect(struct psmouse *psmouse, bool set_properties)
{
if (!psmouse_matches_pnp_id(psmouse, focaltech_pnp_ids))
@@ -37,16 +43,296 @@ int focaltech_detect(struct psmouse *psmouse, bool set_properties)
if (set_properties) {
psmouse->vendor = "FocalTech";
- psmouse->name = "FocalTech Touchpad in mouse emulation mode";
+ psmouse->name = "FocalTech Touchpad";
}
return 0;
}
-int focaltech_init(struct psmouse *psmouse)
+static void focaltech_reset(struct psmouse *psmouse)
{
ps2_command(&psmouse->ps2dev, NULL, PSMOUSE_CMD_RESET_DIS);
psmouse_reset(psmouse);
+}
+
+#ifdef CONFIG_MOUSE_PS2_FOCALTECH
+
+static void focaltech_report_state(struct psmouse *psmouse)
+{
+ int i;
+ struct focaltech_data *priv = psmouse->private;
+ struct focaltech_hw_state *state = &priv->state;
+ struct input_dev *dev = psmouse->dev;
+ int finger_count = 0;
+
+ for (i = 0; i < FOC_MAX_FINGERS; i++) {
+ struct focaltech_finger_state *finger = &state->fingers[i];
+ int active = finger->active && finger->valid;
+ input_mt_slot(dev, i);
+ input_mt_report_slot_state(dev, MT_TOOL_FINGER, active);
+ if (active) {
+ finger_count++;
+ input_report_abs(dev, ABS_MT_POSITION_X, finger->x);
+ input_report_abs(dev, ABS_MT_POSITION_Y,
+ focaltech_invert_y(finger->y));
+ }
+ }
+ input_mt_report_pointer_emulation(dev, finger_count);
+
+ input_report_key(psmouse->dev, BTN_LEFT, state->pressed);
+ input_sync(psmouse->dev);
+}
+
+static void process_touch_packet(struct focaltech_hw_state *state,
+ unsigned char *packet)
+{
+ int i;
+ unsigned char fingers = packet[1];
+
+ state->pressed = (packet[0] >> 4) & 1;
+ /* the second byte contains a bitmap of all fingers touching the pad */
+ for (i = 0; i < FOC_MAX_FINGERS; i++) {
+ if ((fingers & 0x1) && !state->fingers[i].active) {
+ /* we do not have a valid position for the finger yet */
+ state->fingers[i].valid = 0;
+ }
+ state->fingers[i].active = fingers & 0x1;
+ fingers >>= 1;
+ }
+}
+
+static void process_abs_packet(struct focaltech_hw_state *state,
+ unsigned char *packet)
+{
+ unsigned int finger = (packet[1] >> 4) - 1;
+
+ state->pressed = (packet[0] >> 4) & 1;
+ if (finger >= FOC_MAX_FINGERS)
+ return;
+ /*
+ * packet[5] contains some kind of tool size in the most significant
+ * nibble. 0xff is a special value (latching) that signals a large
+ * contact area.
+ */
+ if (packet[5] == 0xff) {
+ state->fingers[finger].valid = 0;
+ return;
+ }
+ state->fingers[finger].x = ((packet[1] & 0xf) << 8) | packet[2];
+ state->fingers[finger].y = (packet[3] << 8) | packet[4];
+ state->fingers[finger].valid = 1;
+}
+static void process_rel_packet(struct focaltech_hw_state *state,
+ unsigned char *packet)
+{
+ int finger1 = ((packet[0] >> 4) & 0x7) - 1;
+ int finger2 = ((packet[3] >> 4) & 0x7) - 1;
+
+ state->pressed = packet[0] >> 7;
+ if (finger1 < FOC_MAX_FINGERS) {
+ state->fingers[finger1].x += (char)packet[1];
+ state->fingers[finger1].y += (char)packet[2];
+ }
+ /*
+ * If there is an odd number of fingers, the last relative packet only
+ * contains one finger. In this case, the second finger index in the
+ * packet is 0 (we subtract 1 in the lines above to create array
+ * indices).
+ */
+ if (finger2 != -1 && finger2 < FOC_MAX_FINGERS) {
+ state->fingers[finger2].x += (char)packet[4];
+ state->fingers[finger2].y += (char)packet[5];
+ }
+}
+
+static void focaltech_process_packet(struct psmouse *psmouse)
+{
+ struct focaltech_data *priv = psmouse->private;
+ unsigned char *packet = psmouse->packet;
+
+ switch (packet[0] & 0xf) {
+ case FOC_TOUCH:
+ process_touch_packet(&priv->state, packet);
+ break;
+ case FOC_ABS:
+ process_abs_packet(&priv->state, packet);
+ break;
+ case FOC_REL:
+ process_rel_packet(&priv->state, packet);
+ break;
+ default:
+ psmouse_err(psmouse, "Unknown packet type: %02x", packet[0]);
+ break;
+ }
+
+ focaltech_report_state(psmouse);
+}
+
+static psmouse_ret_t focaltech_process_byte(struct psmouse *psmouse)
+{
+ if (psmouse->pktcnt >= 6) { /* Full packet received */
+ focaltech_process_packet(psmouse);
+ return PSMOUSE_FULL_PACKET;
+ }
+ /*
+ * we might want to do some validation of the data here, but we do not
+ * know the protocoll well enough
+ */
+ return PSMOUSE_GOOD_DATA;
+}
+
+static int focaltech_switch_protocol(struct psmouse *psmouse)
+{
+ struct ps2dev *ps2dev = &psmouse->ps2dev;
+ unsigned char param[3];
+
+ param[0] = 0;
+ if (ps2_command(ps2dev, param, 0x10f8))
+ return -EIO;
+ if (ps2_command(ps2dev, param, 0x10f8))
+ return -EIO;
+ if (ps2_command(ps2dev, param, 0x10f8))
+ return -EIO;
+ param[0] = 1;
+ if (ps2_command(ps2dev, param, 0x10f8))
+ return -EIO;
+ if (ps2_command(ps2dev, param, PSMOUSE_CMD_SETSCALE11))
+ return -EIO;
+
+ if (ps2_command(ps2dev, param, PSMOUSE_CMD_ENABLE))
+ return -EIO;
return 0;
}
+
+static void focaltech_disconnect(struct psmouse *psmouse)
+{
+ focaltech_reset(psmouse);
+ kfree(psmouse->private);
+ psmouse->private = NULL;
+}
+
+static int focaltech_reconnect(struct psmouse *psmouse)
+{
+ focaltech_reset(psmouse);
+ if (focaltech_switch_protocol(psmouse)) {
+ psmouse_err(psmouse,
+ "Unable to initialize the device.");
+ return -1;
+ }
+ return 0;
+}
+
+static void set_input_params(struct psmouse *psmouse)
+{
+ struct input_dev *dev = psmouse->dev;
+ struct focaltech_data *priv = psmouse->private;
+
+ __set_bit(EV_ABS, dev->evbit);
+ input_set_abs_params(dev, ABS_MT_POSITION_X, 0, priv->x_max, 0, 0);
+ input_set_abs_params(dev, ABS_MT_POSITION_Y, 0, priv->y_max, 0, 0);
+ input_mt_init_slots(dev, 5, INPUT_MT_POINTER);
+ __clear_bit(EV_REL, dev->evbit);
+ __clear_bit(REL_X, dev->relbit);
+ __clear_bit(REL_Y, dev->relbit);
+ __clear_bit(BTN_RIGHT, dev->keybit);
+ __clear_bit(BTN_MIDDLE, dev->keybit);
+ __set_bit(INPUT_PROP_BUTTONPAD, dev->propbit);
+}
+
+static int focaltech_read_register(struct ps2dev *ps2dev, int reg,
+ unsigned char *param)
+{
+ if (ps2_command(ps2dev, param, PSMOUSE_CMD_SETSCALE11))
+ return -1;
+ param[0] = 0;
+ if (ps2_command(ps2dev, param, PSMOUSE_CMD_SETRES))
+ return -1;
+ if (ps2_command(ps2dev, param, PSMOUSE_CMD_SETRES))
+ return -1;
+ if (ps2_command(ps2dev, param, PSMOUSE_CMD_SETRES))
+ return -1;
+ param[0] = reg;
+ if (ps2_command(ps2dev, param, PSMOUSE_CMD_SETRES))
+ return -1;
+ if (ps2_command(ps2dev, param, PSMOUSE_CMD_GETINFO))
+ return -1;
+ return 0;
+}
+
+static int focaltech_read_size(struct psmouse *psmouse)
+{
+ struct ps2dev *ps2dev = &psmouse->ps2dev;
+ struct focaltech_data *priv = psmouse->private;
+ char param[3];
+
+ if (focaltech_read_register(ps2dev, 2, param))
+ return -EIO;
+ /* not sure whether this is 100% correct */
+ priv->x_max = (unsigned char)param[1] * 128;
+ priv->y_max = (unsigned char)param[2] * 128;
+
+ return 0;
+}
+int focaltech_init(struct psmouse *psmouse)
+{
+ struct focaltech_data *priv;
+ int err;
+
+ psmouse->private = priv = kzalloc(sizeof(struct focaltech_data), GFP_KERNEL);
+ if (!priv)
+ return -ENOMEM;
+
+ focaltech_reset(psmouse);
+ if (focaltech_read_size(psmouse)) {
+ focaltech_reset(psmouse);
+ psmouse_err(psmouse,
+ "Unable to read the size of the touchpad.");
+ err = -ENOSYS;
+ goto fail;
+ }
+ if (focaltech_switch_protocol(psmouse)) {
+ focaltech_reset(psmouse);
+ psmouse_err(psmouse,
+ "Unable to initialize the device.");
+ err = -ENOSYS;
+ goto fail;
+ }
+
+ set_input_params(psmouse);
+
+ psmouse->protocol_handler = focaltech_process_byte;
+ psmouse->pktsize = 6;
+ psmouse->disconnect = focaltech_disconnect;
+ psmouse->reconnect = focaltech_reconnect;
+ psmouse->cleanup = focaltech_reset;
+ /* resync is not supported yet */
+ psmouse->resync_time = 0;
+
+ return 0;
+fail:
+ focaltech_reset(psmouse);
+ kfree(priv);
+ return err;
+}
+
+bool focaltech_supported(void)
+{
+ return true;
+}
+
+#else /* CONFIG_MOUSE_PS2_FOCALTECH */
+
+int focaltech_init(struct psmouse *psmouse)
+{
+ focaltech_reset(psmouse);
+
+ return 0;
+}
+
+bool focaltech_supported(void)
+{
+ return false;
+}
+
+#endif /* CONFIG_MOUSE_PS2_FOCALTECH */
diff --git a/drivers/input/mouse/focaltech.h b/drivers/input/mouse/focaltech.h
index 498650c..68c5cfc 100644
--- a/drivers/input/mouse/focaltech.h
+++ b/drivers/input/mouse/focaltech.h
@@ -2,6 +2,7 @@
* Focaltech TouchPad PS/2 mouse driver
*
* Copyright (c) 2014 Red Hat Inc.
+ * Copyright (c) 2014 Mathias Gottschlag <mgottschlag@gmail.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
@@ -16,7 +17,66 @@
#ifndef _FOCALTECH_H
#define _FOCALTECH_H
+/*
+ * Packet types - the numbers are not consecutive, so we might be missing
+ * something here.
+ */
+#define FOC_TOUCH 0x3 /* bitmap of active fingers */
+#define FOC_ABS 0x6 /* absolute position of one finger */
+#define FOC_REL 0x9 /* relative position of 1-2 fingers */
+
+#define FOC_MAX_FINGERS 5
+
+#define FOC_MAX_X 2431
+#define FOC_MAX_Y 1663
+
+static inline int focaltech_invert_y(int y)
+{
+ return FOC_MAX_Y - y;
+}
+
+/*
+ * Current state of a single finger on the touchpad.
+ */
+struct focaltech_finger_state {
+ /* the touchpad has generated a touch event for the finger */
+ bool active;
+ /*
+ * The touchpad has sent position data for the finger. Touch event
+ * packages reset this flag for new fingers, and there is a time
+ * between the first touch event and the following absolute position
+ * packet for the finger where the touchpad has declared the finger to
+ * be valid, but we do not have any valid position yet.
+ */
+ bool valid;
+ /* absolute position (from the bottom left corner) of the finger */
+ unsigned int x;
+ unsigned int y;
+};
+
+/*
+ * Description of the current state of the touchpad hardware.
+ */
+struct focaltech_hw_state {
+ /*
+ * The touchpad tracks the positions of the fingers for us, the array
+ * indices correspond to the finger indices returned in the report
+ * packages.
+ */
+ struct focaltech_finger_state fingers[FOC_MAX_FINGERS];
+ /*
+ * True if the clickpad has been pressed.
+ */
+ bool pressed;
+};
+
+struct focaltech_data {
+ unsigned int x_max, y_max;
+ struct focaltech_hw_state state;
+};
+
int focaltech_detect(struct psmouse *psmouse, bool set_properties);
int focaltech_init(struct psmouse *psmouse);
+bool focaltech_supported(void);
#endif
diff --git a/drivers/input/mouse/psmouse-base.c b/drivers/input/mouse/psmouse-base.c
index 26994f6..4a9de33 100644
--- a/drivers/input/mouse/psmouse-base.c
+++ b/drivers/input/mouse/psmouse-base.c
@@ -725,16 +725,19 @@ static int psmouse_extensions(struct psmouse *psmouse,
/* Always check for focaltech, this is safe as it uses pnp-id matching */
if (psmouse_do_detect(focaltech_detect, psmouse, set_properties) == 0) {
- if (!set_properties || focaltech_init(psmouse) == 0) {
- /*
- * Not supported yet, use bare protocol.
- * Note that we need to also restrict
- * psmouse_max_proto so that psmouse_initialize()
- * does not try to reset rate and resolution,
- * because even that upsets the device.
- */
- psmouse_max_proto = PSMOUSE_PS2;
- return PSMOUSE_PS2;
+ if (max_proto > PSMOUSE_IMEX) {
+ if (!set_properties || focaltech_init(psmouse) == 0) {
+ if (focaltech_supported())
+ return PSMOUSE_FOCALTECH;
+ /*
+ * Note that we need to also restrict
+ * psmouse_max_proto so that psmouse_initialize()
+ * does not try to reset rate and resolution,
+ * because even that upsets the device.
+ */
+ psmouse_max_proto = PSMOUSE_PS2;
+ return PSMOUSE_PS2;
+ }
}
}
@@ -1063,6 +1066,15 @@ static const struct psmouse_protocol psmouse_protocols[] = {
.alias = "cortps",
.detect = cortron_detect,
},
+#ifdef CONFIG_MOUSE_PS2_FOCALTECH
+ {
+ .type = PSMOUSE_FOCALTECH,
+ .name = "FocalTechPS/2",
+ .alias = "focaltech",
+ .detect = focaltech_detect,
+ .init = focaltech_init,
+ },
+#endif
{
.type = PSMOUSE_AUTO,
.name = "auto",
diff --git a/drivers/input/mouse/psmouse.h b/drivers/input/mouse/psmouse.h
index f4cf664..c2ff137 100644
--- a/drivers/input/mouse/psmouse.h
+++ b/drivers/input/mouse/psmouse.h
@@ -96,6 +96,7 @@ enum psmouse_type {
PSMOUSE_FSP,
PSMOUSE_SYNAPTICS_RELATIVE,
PSMOUSE_CYPRESS,
+ PSMOUSE_FOCALTECH,
PSMOUSE_AUTO /* This one should always be last */
};
--
1.9.1
^ permalink raw reply related
* ASUS X200MA Fn+F5 and Fn+F6 regression in 3.18rc2
From: Дмитрий Тюнин @ 2014-11-01 14:44 UTC (permalink / raw)
To: linux-input
They work in 3.13 but in 3.18rc2
acpi_listen does not show any codes.
^ permalink raw reply
* [PATCH v3 2/4] input: alps: Allow 2 invalid packets without resetting device
From: Pali Rohár @ 2014-11-01 23:25 UTC (permalink / raw)
To: Dmitry Torokhov, Hans de Goede, Yunkang Tang, Tommy Will
Cc: linux-input, linux-kernel, Pali Rohár
In-Reply-To: <1414884310-19842-1-git-send-email-pali.rohar@gmail.com>
On some Dell Latitude laptops ALPS device or Dell EC send one invalid byte in
6 bytes ALPS packet. In this case psmouse driver enter out of sync state. It
looks like that all other bytes in packets are valid and also device working
properly. So there is no need to do full device reset, just need to wait
for byte which match condition for first byte (start of packet). Because ALPS
packets are bigger (6 or 8 bytes) default limit is small.
This patch increase number of invalid bytes to size of 2 ALPS packets which
psmouse driver can drop before do full reset.
Resetting ALPS devices take some time and when doing reset on some Dell laptops
touchpad, trackstick and also keyboard do not respond. So it is better to do it
only if really necessary.
Signed-off-by: Pali Rohár <pali.rohar@gmail.com>
Tested-by: Pali Rohár <pali.rohar@gmail.com>
Cc: stable@vger.kernel.org
---
drivers/input/mouse/alps.c | 3 +++
1 file changed, 3 insertions(+)
diff --git a/drivers/input/mouse/alps.c b/drivers/input/mouse/alps.c
index a772745..7c47e97 100644
--- a/drivers/input/mouse/alps.c
+++ b/drivers/input/mouse/alps.c
@@ -2391,6 +2391,9 @@ int alps_init(struct psmouse *psmouse)
/* We are having trouble resyncing ALPS touchpads so disable it for now */
psmouse->resync_time = 0;
+ /* Allow 2 invalid packets without resetting device */
+ psmouse->resetafter = psmouse->pktsize * 2;
+
return 0;
init_fail:
--
1.7.9.5
^ permalink raw reply related
* [PATCH v3 0/4] Fixes for ALPS driver
From: Pali Rohár @ 2014-11-01 23:25 UTC (permalink / raw)
To: Dmitry Torokhov, Hans de Goede, Yunkang Tang, Tommy Will
Cc: linux-input, linux-kernel, Pali Rohár
In-Reply-To: <1412329392-5580-1-git-send-email-pali.rohar@gmail.com>
This patch series tries to fix problems with ALPS dualpoint devices on Dell
Latitude laptops which are probably caused by bugs in Dell BIOS, Dell EC or
in ALPS touchpad firmware itself.
Root of problems is yet unknown but at least this patch series could eliminate
reporting bogus data to userspace.
Reported bugs:
https://bugs.launchpad.net/ubuntu/+source/linux/+bug/1258837
https://bugs.launchpad.net/ubuntu/+source/linux/+bug/1320022
https://bugs.launchpad.net/ubuntu/+source/linux/+bug/1272624
https://bugzilla.redhat.com/show_bug.cgi?id=1145954
Pali Rohár (4):
input: alps: Do not try to parse data as 3 bytes packet when driver
is out of sync
input: alps: Allow 2 invalid packets without resetting device
input: alps: For protocol V3, do not process data when last packet's
bit7 is set
input: alps: Fix trackstick detection
drivers/input/mouse/alps.c | 113 +++++++++++++++++++++++++++++++-------------
1 file changed, 80 insertions(+), 33 deletions(-)
--
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
* [PATCH v3 3/4] input: alps: For protocol V3, do not process data when last packet's bit7 is set
From: Pali Rohár @ 2014-11-01 23:25 UTC (permalink / raw)
To: Dmitry Torokhov, Hans de Goede, Yunkang Tang, Tommy Will
Cc: linux-input, linux-kernel, Pali Rohár
In-Reply-To: <1414884310-19842-1-git-send-email-pali.rohar@gmail.com>
Sometimes on Dell Latitude laptops psmouse/alps driver receive invalid ALPS
protocol V3 packets with bit7 set in last byte. More often it can be reproduced
on Dell Latitude E6440 or E7440 with closed lid and pushing cover above touchpad.
If bit7 in last packet byte is set then it is not valid ALPS packet. I was told
that ALPS devices never send these packets. It is not know yet who send those
packets, it could be Dell EC, bug in BIOS and also bug in touchpad firmware...
With this patch alps driver does not process those invalid packets and drops it
with PSMOUSE_FULL_PACKET so psmouse driver does not enter to out of sync state.
This patch fix problem when psmouse driver still resetting ALPS device when
laptop lid is closed because of receiving invalid packets in out of sync state.
Signed-off-by: Pali Rohár <pali.rohar@gmail.com>
Tested-by: Pali Rohár <pali.rohar@gmail.com>
Cc: stable@vger.kernel.org
---
drivers/input/mouse/alps.c | 10 ++++++++++
1 file changed, 10 insertions(+)
diff --git a/drivers/input/mouse/alps.c b/drivers/input/mouse/alps.c
index 7c47e97..e802d28 100644
--- a/drivers/input/mouse/alps.c
+++ b/drivers/input/mouse/alps.c
@@ -1181,6 +1181,16 @@ static psmouse_ret_t alps_process_byte(struct psmouse *psmouse)
return PSMOUSE_BAD_DATA;
}
+ if (priv->proto_version == ALPS_PROTO_V3 && psmouse->pktcnt == psmouse->pktsize) {
+ // For protocol V3, do not process data when last packet's bit7 is set
+ if (psmouse->packet[psmouse->pktcnt - 1] & 0x80) {
+ psmouse_dbg(psmouse, "v3 discard packet[%i] = %x\n",
+ psmouse->pktcnt - 1,
+ psmouse->packet[psmouse->pktcnt - 1]);
+ return PSMOUSE_FULL_PACKET;
+ }
+ }
+
/* Bytes 2 - pktsize should have 0 in the highest bit */
if ((priv->proto_version < ALPS_PROTO_V5) &&
psmouse->pktcnt >= 2 && psmouse->pktcnt <= psmouse->pktsize &&
--
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
* [PATCH v3 4/4] input: alps: Fix trackstick detection
From: Pali Rohár @ 2014-11-01 23:25 UTC (permalink / raw)
To: Dmitry Torokhov, Hans de Goede, Yunkang Tang, Tommy Will
Cc: linux-input, linux-kernel, Pali Rohár
In-Reply-To: <1414884310-19842-1-git-send-email-pali.rohar@gmail.com>
On some laptops after starting them from off state (not after reboot), function
alps_probe_trackstick_v3() (called from function alps_identify()) does not
detect trackstick. To fix this problem we need to reset device. But function
alps_identify() is called also from alps_detect() and we do not want to reset
device in detect function because it will slow down initialization of all other
non alps devices.
Current alps device init sequence is:
alps_detect() --> alps_identify() (trackstick not detected)
alps_init() --> psmouse_reset() --> alps_identify() (trackstick detected)
This patch moves initialization code between driver functions so we can remove
alps_identify() call from alps_detect(). Which means that trackstick function
alps_probe_trackstick_v3() will be called only from alps_init() and only after
device reset so it will always return correct information about trackstick
presence. Code for identifying protocol version is moved to alps_init() and
because psmouse-base.c calling alps_detect() and alps_init() consecutively then
detection of both alps and also other non alps devices will not be broken.
First this patch moves code between functions:
* Move calling function alps_probe_trackstick_v3() (for rushmore devices) from
alps_identify() to alps_hw_init_rushmore_v3()
* Move code for checking "E6 report" from alps_identify() to alps_detect()
* Move code for setting correct device name string and model/protocol version
from alps_detect() to alps_init(). To not break psmouse-base.c in function
alps_detect() set only generic name "DualPoint TouchPad".
Next it removes alps_identify() from alps_detect() because it is not needed
anymore (code which use it was moved to alps_init()).
And last this patch fix another code for trackstick detection of protocol V3
devices. In function alps_hw_init_v3() is removed ALPS_DUALPOINT flag from
device if alps_setup_trackstick_v3() or alps_setup_trackstick_v3() returns
-ENODEV (which means trackstick is not present).
Now trackstick detection should work and in function alps_init() is set
correct name and other properties for both input devices.
Side effect of this patch is also faster alps devices initialization because
function alps_identify() is called only once (from alps_init()).
Signed-off-by: Pali Rohár <pali.rohar@gmail.com>
Tested-by: Pali Rohár <pali.rohar@gmail.com>
Cc: stable@vger.kernel.org
---
drivers/input/mouse/alps.c | 96 +++++++++++++++++++++++++++++---------------
1 file changed, 64 insertions(+), 32 deletions(-)
diff --git a/drivers/input/mouse/alps.c b/drivers/input/mouse/alps.c
index e802d28..04161b6 100644
--- a/drivers/input/mouse/alps.c
+++ b/drivers/input/mouse/alps.c
@@ -1732,6 +1732,7 @@ error:
static int alps_hw_init_v3(struct psmouse *psmouse)
{
+ struct alps_data *priv = psmouse->private;
struct ps2dev *ps2dev = &psmouse->ps2dev;
int reg_val;
unsigned char param[4];
@@ -1740,9 +1741,15 @@ static int alps_hw_init_v3(struct psmouse *psmouse)
if (reg_val == -EIO)
goto error;
- if (reg_val == 0 &&
- alps_setup_trackstick_v3(psmouse, ALPS_REG_BASE_PINNACLE) == -EIO)
- goto error;
+ if (reg_val == 0) {
+ reg_val = alps_setup_trackstick_v3(psmouse,
+ ALPS_REG_BASE_PINNACLE);
+ if (reg_val == -EIO)
+ goto error;
+ }
+
+ if (reg_val == -ENODEV)
+ priv->flags &= ~ALPS_DUALPOINT;
if (alps_enter_command_mode(psmouse) ||
alps_absolute_mode_v3(psmouse)) {
@@ -1849,15 +1856,20 @@ static int alps_hw_init_rushmore_v3(struct psmouse *psmouse)
struct ps2dev *ps2dev = &psmouse->ps2dev;
int reg_val, ret = -1;
- if (priv->flags & ALPS_DUALPOINT) {
+ reg_val = alps_probe_trackstick_v3(psmouse, ALPS_REG_BASE_RUSHMORE);
+ if (reg_val == -EIO)
+ goto error;
+
+ if (reg_val == 0) {
reg_val = alps_setup_trackstick_v3(psmouse,
ALPS_REG_BASE_RUSHMORE);
if (reg_val == -EIO)
goto error;
- if (reg_val == -ENODEV)
- priv->flags &= ~ALPS_DUALPOINT;
}
+ if (reg_val == -ENODEV)
+ priv->flags &= ~ALPS_DUALPOINT;
+
if (alps_enter_command_mode(psmouse) ||
alps_command_mode_read_reg(psmouse, 0xc2d9) == -1 ||
alps_command_mode_write_reg(psmouse, 0xc2cb, 0x00))
@@ -2176,20 +2188,15 @@ static int alps_match_table(struct psmouse *psmouse, struct alps_data *priv,
static int alps_identify(struct psmouse *psmouse, struct alps_data *priv)
{
- unsigned char e6[4], e7[4], ec[4];
+ unsigned char e7[4], ec[4];
+ int ret;
/*
* First try "E6 report".
- * ALPS should return 0,0,10 or 0,0,100 if no buttons are pressed.
- * The bits 0-2 of the first byte will be 1s if some buttons are
- * pressed.
*/
- if (alps_rpt_cmd(psmouse, PSMOUSE_CMD_SETRES,
- PSMOUSE_CMD_SETSCALE11, e6))
- return -EIO;
-
- if ((e6[0] & 0xf8) != 0 || e6[1] != 0 || (e6[2] != 10 && e6[2] != 100))
- return -EINVAL;
+ ret = alps_detect(psmouse, false);
+ if (ret < 0)
+ return ret;
/*
* Now get the "E7" and "EC" reports. These will uniquely identify
@@ -2231,12 +2238,6 @@ static int alps_identify(struct psmouse *psmouse, struct alps_data *priv)
priv->y_bits = 12;
priv->flags |= ALPS_IS_RUSHMORE;
- /* hack to make addr_command, nibble_command available */
- psmouse->private = priv;
-
- if (alps_probe_trackstick_v3(psmouse, ALPS_REG_BASE_RUSHMORE))
- priv->flags &= ~ALPS_DUALPOINT;
-
return 0;
} else if (ec[0] == 0x88 && ec[1] == 0x07 &&
ec[2] >= 0x90 && ec[2] <= 0x9d) {
@@ -2370,14 +2371,24 @@ int alps_init(struct psmouse *psmouse)
dev1->keybit[BIT_WORD(BTN_MIDDLE)] |= BIT_MASK(BTN_MIDDLE);
}
+ if (priv->flags & ALPS_DUALPOINT) {
+ /*
+ * format of device name is: "protocol vendor name"
+ * see function psmouse_switch_protocol() in psmouse-base.c
+ */
+ dev2->name = "AlpsPS/2 ALPS DualPoint Stick";
+ dev2->id.product = PSMOUSE_ALPS;
+ dev2->id.version = priv->proto_version;
+ } else {
+ dev2->name = "PS/2 ALPS Mouse";
+ dev2->id.product = PSMOUSE_PS2;
+ dev2->id.version = 0x0000;
+ }
+
snprintf(priv->phys, sizeof(priv->phys), "%s/input1", psmouse->ps2dev.serio->phys);
dev2->phys = priv->phys;
- dev2->name = (priv->flags & ALPS_DUALPOINT) ?
- "DualPoint Stick" : "ALPS PS/2 Device";
dev2->id.bustype = BUS_I8042;
dev2->id.vendor = 0x0002;
- dev2->id.product = PSMOUSE_ALPS;
- dev2->id.version = 0x0000;
dev2->dev.parent = &psmouse->ps2dev.serio->dev;
dev2->evbit[0] = BIT_MASK(EV_KEY) | BIT_MASK(EV_REL);
@@ -2392,6 +2403,10 @@ int alps_init(struct psmouse *psmouse)
if (input_register_device(priv->dev2))
goto init_fail;
+ if (!(priv->flags & ALPS_DUALPOINT))
+ psmouse->name = "GlidePoint TouchPad";
+ psmouse->model = priv->proto_version;
+
psmouse->protocol_handler = alps_process_byte;
psmouse->poll = alps_poll;
psmouse->disconnect = alps_disconnect;
@@ -2416,17 +2431,34 @@ init_fail:
int alps_detect(struct psmouse *psmouse, bool set_properties)
{
- struct alps_data dummy;
+ unsigned char e6[4];
- if (alps_identify(psmouse, &dummy) < 0)
- return -1;
+ /*
+ * Try "E6 report".
+ * ALPS should return 0,0,10 or 0,0,100 if no buttons are pressed.
+ * The bits 0-2 of the first byte will be 1s if some buttons are
+ * pressed.
+ */
+ if (alps_rpt_cmd(psmouse, PSMOUSE_CMD_SETRES,
+ PSMOUSE_CMD_SETSCALE11, e6))
+ return -EIO;
+
+ if ((e6[0] & 0xf8) != 0 || e6[1] != 0 || (e6[2] != 10 && e6[2] != 100))
+ return -EINVAL;
if (set_properties) {
+ /*
+ * NOTE: To detect model and trackstick presence we need to do
+ * full device reset. To speed up detection and prevent
+ * calling duplicate initialization sequence (both in
+ * alps_detect() and alps_init()) we set model/protocol
+ * version and correct name in alps_init() (which will
+ * do full device reset). For now set name to DualPoint.
+ */
psmouse->vendor = "ALPS";
- psmouse->name = dummy.flags & ALPS_DUALPOINT ?
- "DualPoint TouchPad" : "GlidePoint";
- psmouse->model = dummy.proto_version << 8;
+ psmouse->name = "DualPoint TouchPad";
}
+
return 0;
}
--
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
* Re: [PATCH 1/3] input: alps: Reset mouse before identifying it
From: Pali Rohár @ 2014-11-01 23:29 UTC (permalink / raw)
To: Dmitry Torokhov
Cc: Tommy Will, Hans de Goede, Yunkang Tang, linux-input,
linux-kernel
In-Reply-To: <20141023154404.GA18714@dtor-ws>
[-- Attachment #1: Type: Text/Plain, Size: 6080 bytes --]
On Thursday 23 October 2014 17:44:04 Dmitry Torokhov wrote:
> On Sun, Oct 19, 2014 at 01:07:41PM +0200, Pali Rohár wrote:
> > On Wednesday 15 October 2014 20:22:56 Dmitry Torokhov wrote:
> > > On Wed, Oct 15, 2014 at 08:10:39PM +0200, Pali Rohár wrote:
> > > > On Wednesday 15 October 2014 20:00:11 Dmitry Torokhov
wrote:
> > > > > On Wed, Oct 15, 2014 at 07:57:37PM +0200, Pali Rohár
wrote:
> > > > > > On Wednesday 15 October 2014 19:43:15 Dmitry
> > > > > > Torokhov
> >
> > wrote:
> > > > > > > On Wed, Oct 15, 2014 at 02:53:11PM +0200, Pali
> > > > > > > Rohár
> >
> > wrote:
> > > > > > > > On Tuesday 14 October 2014 08:08:34 Dmitry
> > > > > > > > Torokhov
> > > >
> > > > wrote:
> > > > > > > > > On Fri, Oct 03, 2014 at 11:47:59AM +0200, Hans
> > > > > > > > > de Goede
> > > > > >
> > > > > > wrote:
> > > > > > > > > > Hi,
> > > > > > > > > >
> > > > > > > > > > Thanks for working on this!
> > > > > > > > > >
> > > > > > > > > > On 10/03/2014 11:43 AM, Pali Rohár wrote:
> > > > > > > > > > > On some systems after starting computer
> > > > > > > > > > > function alps_identify() does not detect
> > > > > > > > > > > dual ALPS touchpad+trackstick device
> > > > > > > > > > > correctly and detect only touchpad.
> > > > > > > > > > >
> > > > > > > > > > > Resetting ALPS device before identifiying
> > > > > > > > > > > it fixing this problem and both parts
> > > > > > > > > > > touchpad and trackstick are detected.
> > > > > > > > > > >
> > > > > > > > > > > Signed-off-by: Pali Rohár
> > > > > > > > > > > <pali.rohar@gmail.com> Tested-by: Pali
> > > > > > > > > > > Rohár <pali.rohar@gmail.com>
> > > > > > > > > >
> > > > > > > > > > Looks good and seems sensible:
> > > > > > > > > >
> > > > > > > > > > Acked-by: Hans de Goede
> > > > > > > > > > <hdegoede@redhat.com>
> > > > > > > > >
> > > > > > > > > *sigh* I am not really happy about this, as we
> > > > > > > > > making boot longer and longer for people
> > > > > > > > > without ALPS touchpads. It would be better if
> > > > > > > > > we only reset the mouse when we knew we are
> > > > > > > > > dealing with ALPS, and even better if we only
> > > > > > > > > reset it when we suspected that we missed
> > > > > > > > > trackstick. Any chance of doing this?
> > > > > > > > >
> > > > > > > > > Thanks.
> > > > > > > >
> > > > > > > > Dmitry, problem is that function check which
> > > > > > > > detecting trackstick does not working when I
> > > > > > > > start my laptop from power-off state and do not
> > > > > > > > reset PS/2 device. But detecting ALPS touchpad
> > > > > > > > looks like working. So if do not like this
> > > > > > > > idea, what about doing something like this in
> > > > > > > > alps_dectect function?
> > > > > > > >
> > > > > > > > int alps_detect(...)
> > > > > > > > {
> > > > > > > > ...
> > > > > > > > /* detect if device is ALPS */
> > > > > > > > if (alps_identify(...) < 0)
> > > > > > > > return -1;
> > > > > > > > /* now we know that device is ALPS */
> > > > > > > > if (!(flags & ALPS_DUALPOINT)) {
> > > > > > > > /* reset it and identify again, maybe there is
> > > > > > > > trackstick */ psmouse_reset(...);
> > > > > > > > alps_identify(...);
> > > > > > > > }
> > > > > > > > ...
> > > > > > > > }
> > > > > > > >
> > > > > > > > It will does not affect non ALPS devices
> > > > > > > > (because first identify call will fail), but
> > > > > > > > will affect ALPS devices without trackstick
> > > > > > > > (because identify will be called twice and
> > > > > > > > reset too).
> > > > > > >
> > > > > > > I think this is a step in right direction. Do you
> > > > > > > know what exactly fails in alps_identify() on
> > > > > > > your box if you do not call psmouse_reset?
> > > > > > >
> > > > > > > Thanks.
> > > > > >
> > > > > > Yes, I know. It is failing in
> > > > > > alps_probe_trackstick_v3(). It calls
> > > > > > alps_command_mode_read_reg(...) and it returns 0
> > > > > > which means trackstick is not there.
> > > > >
> > > > > OK, so can we try sticking psmouse_reset() there? This
> > > > > will limit the exposure of the new delay.
> > > > >
> > > > > Thanks.
> > > >
> > > > Sorry, but I think this is not safe. Function
> > > > psmouse_reset will reset device (set it to relative
> > > > mode, etc...) and before and after
> > > > alps_probe_trackstick_v3() are called other functions.
> > > > So it could break something else.
> > >
> > > We might need to repeat bits of alps_identify() after
> > > resetting the mouse, you are right. It should still be
> > > doable though.
> >
> > What about checking "E6 report" and if that pass reset
> > device and do full alps_identify? With check for "E6
> > report" we can filter probably all PS/2 devices which are
> > not ALPS.
>
> Why don't you pull alps_probe_trackstick_v3() from
> alps_identify(), rename it into __alps_identify() and then
> have real alps_identify be:
>
> static int alps_identfy(struct psmouse *psmouse, struct
> alps_data *priv) {
> int error;
>
> error = __alps_identify(psmouse, priv);
> if (error)
> return error;
>
> if (priv->proto_version == ALPS_PROTO_V3 &&
> (priv->flags & ALPS_IS_RUSHMORE)) {
> /*
> * Some Dell Lattitudes may not always recognize
> * tracksticks without resetting the device.
> */
> psmouse_reset(psmouse);
>
> error = __alps_identify(psmouse, priv);
> if (error)
> return error;
>
> if (alps_probe_trackstick_v3(psmouse,
> ALPS_REG_BASE_RUSHMORE))
> priv->flags &= ~ALPS_DUALPOINT;
> }
>
> return 0;
> }
>
> This way you minimize number of devices exposed to extra
> reset.
>
> Thanks.
Hello Dmitry,
I sent new patch series v3 with another solution for fixing this
problem. It just effectively move more parts of alps code and
trackstick detection should work. It does not introduce new reset
call (like in this version) so it is better.
--
Pali Rohár
pali.rohar@gmail.com
[-- Attachment #2: This is a digitally signed message part. --]
[-- Type: application/pgp-signature, Size: 198 bytes --]
^ permalink raw reply
* [PATCH v3 1/4] input: alps: Do not try to parse data as 3 bytes packet when driver is out of sync
From: Pali Rohár @ 2014-11-01 23:25 UTC (permalink / raw)
To: Dmitry Torokhov, Hans de Goede, Yunkang Tang, Tommy Will
Cc: linux-input, linux-kernel, Pali Rohár
In-Reply-To: <1414884310-19842-1-git-send-email-pali.rohar@gmail.com>
5th and 6th byte of ALPS trackstick V3 protocol match condition for first byte
of PS/2 3 bytes packet. When driver enters out of sync state and ALPS trackstick
is sending data then driver match 5th, 6th and next 1st bytes as PS/2.
It basically means if user is using trackstick when driver is in out of sync
state driver will never resync. Processing these bytes as 3 bytes PS/2 data
cause total mess (random cursor movements, random clicks) and make trackstick
unusable until psmouse driver decide to do full device reset.
Lot of users reported problems with ALPS devices on Dell Latitude E6440, E6540
and E7440 laptops. ALPS device or Dell EC for unknown reason send some invalid
ALPS PS/2 bytes which cause driver out of sync. It looks like that i8042 and
psmouse/alps driver always receive group of 6 bytes packets so there are no
missing bytes and no bytes were inserted between valid once.
This patch does not fix root of problem with ALPS devices found in Dell Latitude
laptops but it does not allow to process some (invalid) subsequence of 6 bytes
ALPS packets as 3 bytes PS/2 when driver is out of sync.
So with this patch trackstick input device does not report bogus data when
also driver is out of sync, so trackstick should be usable on those machines.
Unknown is also information which ALPS devices send 3 bytes packets and why
ALPS driver needs to handle also bare PS/2 packets. According to git (and plus
historic tree from bitkeeper) code for processing 3 bytes bare PS/2 packets
is there since first version of alps.c existence (since 2.6.9-rc2).
We do not want to break some older ALPS devices. And disabling processing bare
PS/2 packets when driver is out of sync should not break it.
Signed-off-by: Pali Rohár <pali.rohar@gmail.com>
Tested-by: Pali Rohár <pali.rohar@gmail.com>
Cc: stable@vger.kernel.org
---
drivers/input/mouse/alps.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/drivers/input/mouse/alps.c b/drivers/input/mouse/alps.c
index 2b0ae8c..a772745 100644
--- a/drivers/input/mouse/alps.c
+++ b/drivers/input/mouse/alps.c
@@ -1156,7 +1156,9 @@ static psmouse_ret_t alps_process_byte(struct psmouse *psmouse)
{
struct alps_data *priv = psmouse->private;
- if ((psmouse->packet[0] & 0xc8) == 0x08) { /* PS/2 packet */
+ /* FIXME: Could we receive bare PS/2 packets from DualPoint devices?? */
+ if (!psmouse->out_of_sync_cnt &&
+ (psmouse->packet[0] & 0xc8) == 0x08) { /* PS/2 packet */
if (psmouse->pktcnt == 3) {
alps_report_bare_ps2_packet(psmouse, psmouse->packet,
true);
--
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
* Re: [PATCH v3] psmouse: Add some support for the FocalTech PS/2 protocol extensions.
From: Hans de Goede @ 2014-11-02 14:07 UTC (permalink / raw)
To: Mathias Gottschlag, Dmitry Torokhov; +Cc: linux-input, Benjamin Tissoires
In-Reply-To: <545413F5.3030001@gmail.com>
Hi,
On 10/31/2014 11:57 PM, Mathias Gottschlag wrote:
> Am 31.10.2014 um 14:29 schrieb Hans de Goede:
>> Hi Mathias,
>>
>> Thanks for your continued work on this. 3 remarks online + 1 at the bottom.
>>
>> On 10/30/2014 07:33 PM, Mathias Gottschlag wrote:
>>> Most of the protocol for these touchpads has been reverse engineered. This
>>> commit adds a basic multitouch-capable driver.
>>>
>>> A lot of the protocol is still unknown. Especially, we don't know how to
>>> identify the device yet apart from the PNP ID.
>>>
>>> The previous workaround for these devices has been left in place in case
>>> the driver is not compiled into the kernel or in case some other device
>>> with the same PNP ID is not recognized by the driver yet still has the
>>> same
>>> problems with the device probing code.
>> Missing "Signed-off-by: Mathias Gottschlag <mgottschlag@gmail.com>", we need
>> this before this patch can be merged (just put it at the end of the commit
>> message (official end, before the changelog) when you send the next version).
>>
>>
>>> ---
>>>
>>> (Sorry, some serious incompetence caused me to always test an old
>>> version of the module, so I overlooked an embarrasing pagefault right
>>> during initialization, where memory allocation did not happen early
>>> enough)
>>>
>>> Thanks for the first round of review, I hope I addressed all comments.
>>> Changes compared to the last version:
>>> - The detection code does not compare all registers anymore.
>>> - The driver now reads the size of the touchpad during initialization.
>>> This should add support for Asus X450JN, where the touchpad is a bit
>>> wider.
>>> - set_input_params has been simplified.
>>> - fingers are now valid=0 when the touchpad reports a large object.
>>>
>>> drivers/input/mouse/Kconfig | 10 ++
>>> drivers/input/mouse/focaltech.c | 300
>>> ++++++++++++++++++++++++++++++++++++-
>> Your mail client has line-wrapped this line, and many others further below,
>> making it impossible to apply this, please resend using "git send-email" .
>>
>>> drivers/input/mouse/focaltech.h | 60 ++++++++
>>> drivers/input/mouse/psmouse-base.c | 32 ++--
>>> drivers/input/mouse/psmouse.h | 1 +
>>> 5 files changed, 386 insertions(+), 17 deletions(-)
>>>
>>> diff --git a/drivers/input/mouse/Kconfig b/drivers/input/mouse/Kconfig
>>> index 366fc7a..db973e5 100644
>>> --- a/drivers/input/mouse/Kconfig
>>> +++ b/drivers/input/mouse/Kconfig
>>> @@ -146,6 +146,16 @@ config MOUSE_PS2_OLPC
>>> If unsure, say N.
>>> +config MOUSE_PS2_FOCALTECH
>>> + bool "FocalTech PS/2 mouse protocol extension" if EXPERT
>>> + default y
>>> + depends on MOUSE_PS2
>>> + help
>>> + Say Y here if you have a FocalTech PS/2 TouchPad connected to
>>> + your system.
>>> +
>>> + If unsure, say Y.
>>> +
>>> config MOUSE_SERIAL
>>> tristate "Serial mouse"
>>> select SERIO
>>> diff --git a/drivers/input/mouse/focaltech.c
>>> b/drivers/input/mouse/focaltech.c
>>> index f4d657e..26bc5b7 100644
>>> --- a/drivers/input/mouse/focaltech.c
>>> +++ b/drivers/input/mouse/focaltech.c
>>> @@ -2,6 +2,7 @@
>>> * Focaltech TouchPad PS/2 mouse driver
>>> *
>>> * Copyright (c) 2014 Red Hat Inc.
>>> + * Copyright (c) 2014 Mathias Gottschlag <mgottschlag@gmail.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
>>> @@ -13,15 +14,14 @@
>>> * Hans de Goede <hdegoede@redhat.com>
>>> */
>>> -/*
>>> - * The Focaltech PS/2 touchpad protocol is unknown. This drivers
>>> deals with
>>> - * detection only, to avoid further detection attempts confusing the
>>> touchpad
>>> - * this way it at least works in PS/2 mouse compatibility mode.
>>> - */
>>> #include <linux/device.h>
>>> #include <linux/libps2.h>
>>> +#include <linux/input/mt.h>
>>> +#include <linux/serio.h>
>>> +#include <linux/slab.h>
>>> #include "psmouse.h"
>>> +#include "focaltech.h"
>>> static const char * const focaltech_pnp_ids[] = {
>>> "FLT0101",
>>> @@ -30,6 +30,12 @@ static const char * const focaltech_pnp_ids[] = {
>>> NULL
>>> };
>>> +/*
>>> + * Even if the kernel is built without support for Focaltech PS/2
>>> touchpads (or
>>> + * when the real driver fails to recognize the device), we still have
>>> to detect
>>> + * them in order to avoid further detection attempts confusing the
>>> touchpad.
>>> + * This way it at least works in PS/2 mouse compatibility mode.
>>> + */
>>> int focaltech_detect(struct psmouse *psmouse, bool set_properties)
>>> {
>>> if (!psmouse_matches_pnp_id(psmouse, focaltech_pnp_ids))
>>> @@ -37,16 +43,296 @@ int focaltech_detect(struct psmouse *psmouse,
>>> bool set_properties)
>>> if (set_properties) {
>>> psmouse->vendor = "FocalTech";
>>> - psmouse->name = "FocalTech Touchpad in mouse emulation mode";
>>> + psmouse->name = "FocalTech Touchpad";
>>> }
>>> return 0;
>>> }
>>> -int focaltech_init(struct psmouse *psmouse)
>>> +static void focaltech_reset(struct psmouse *psmouse)
>>> {
>>> ps2_command(&psmouse->ps2dev, NULL, PSMOUSE_CMD_RESET_DIS);
>>> psmouse_reset(psmouse);
>>> +}
>>> +
>>> +#ifdef CONFIG_MOUSE_PS2_FOCALTECH
>>> +
>>> +static void focaltech_report_state(struct psmouse *psmouse)
>>> +{
>>> + int i;
>>> + struct focaltech_data *priv = psmouse->private;
>>> + struct focaltech_hw_state *state = &priv->state;
>>> + struct input_dev *dev = psmouse->dev;
>>> + int finger_count = 0;
>>> +
>>> + for (i = 0; i < FOC_MAX_FINGERS; i++) {
>>> + struct focaltech_finger_state *finger = &state->fingers[i];
>>> + int active = finger->active && finger->valid;
>>> + input_mt_slot(dev, i);
>>> + input_mt_report_slot_state(dev, MT_TOOL_FINGER, active);
>>> + if (active) {
>>> + finger_count++;
>>> + input_report_abs(dev, ABS_MT_POSITION_X, finger->x);
>>> + input_report_abs(dev, ABS_MT_POSITION_Y,
>>> + focaltech_invert_y(finger->y));
>>> + }
>>> + }
>>> + input_mt_report_pointer_emulation(dev, finger_count);
>>> +
>>> + input_report_key(psmouse->dev, BTN_LEFT, state->pressed);
>>> + input_sync(psmouse->dev);
>>> +}
>>> +
>>> +static void process_touch_packet(struct focaltech_hw_state *state,
>>> + unsigned char *packet)
>>> +{
>>> + int i;
>>> + unsigned char fingers = packet[1];
>>> +
>>> + state->pressed = (packet[0] >> 4) & 1;
>>> + /* the second byte contains a bitmap of all fingers touching the pad */
>>> + for (i = 0; i < FOC_MAX_FINGERS; i++) {
>>> + if ((fingers & 0x1) && !state->fingers[i].active) {
>>> + /* we do not have a valid position for the finger yet */
>>> + state->fingers[i].valid = 0;
>>> + }
>>> + state->fingers[i].active = fingers & 0x1;
>>> + fingers >>= 1;
>>> + }
>>> +}
>>> +
>>> +static void process_abs_packet(struct focaltech_hw_state *state,
>>> + unsigned char *packet)
>>> +{
>>> + unsigned int finger = (packet[1] >> 4) - 1;
>>> +
>>> + state->pressed = (packet[0] >> 4) & 1;
>>> + if (finger >= FOC_MAX_FINGERS)
>>> + return;
>>> + /*
>>> + * packet[5] contains some kind of tool size in the most significant
>>> + * nibble. 0xff is a special value (latching) that signals a large
>>> + * contact area.
>>> + */
>>> + if (packet[5] == 0xff) {
>>> + state->fingers[finger].valid = 0;
>>> + return;
>>> + }
>>> + state->fingers[finger].x = ((packet[1] & 0xf) << 8) | packet[2];
>>> + state->fingers[finger].y = (packet[3] << 8) | packet[4];
>>> + state->fingers[finger].valid = 1;
>>> +}
>>> +static void process_rel_packet(struct focaltech_hw_state *state,
>>> + unsigned char *packet)
>>> +{
>>> + int finger1 = ((packet[0] >> 4) & 0x7) - 1;
>>> + int finger2 = ((packet[3] >> 4) & 0x7) - 1;
>>> +
>>> + state->pressed = packet[0] >> 7;
>>> + if (finger1 < FOC_MAX_FINGERS) {
>>> + state->fingers[finger1].x += (char)packet[1];
>>> + state->fingers[finger1].y += (char)packet[2];
>>> + }
>>> + /*
>>> + * If there is an odd number of fingers, the last relative packet only
>>> + * contains one finger. In this case, the second finger index in the
>>> + * packet is 0 (we subtract 1 in the lines above to create array
>>> + * indices).
>>> + */
>>> + if (finger2 != -1 && finger2 < FOC_MAX_FINGERS) {
>>> + state->fingers[finger2].x += (char)packet[4];
>>> + state->fingers[finger2].y += (char)packet[5];
>>> + }
>>> +}
>>> +
>>> +static void focaltech_process_packet(struct psmouse *psmouse)
>>> +{
>>> + struct focaltech_data *priv = psmouse->private;
>>> + unsigned char *packet = psmouse->packet;
>>> +
>>> + switch (packet[0] & 0xf) {
>>> + case FOC_TOUCH:
>>> + process_touch_packet(&priv->state, packet);
>>> + break;
>>> + case FOC_ABS:
>>> + process_abs_packet(&priv->state, packet);
>>> + break;
>>> + case FOC_REL:
>>> + process_rel_packet(&priv->state, packet);
>>> + break;
>>> + default:
>>> + psmouse_err(psmouse, "Unknown packet type: %02x", packet[0]);
>>> + break;
>>> + }
>>> +
>>> + focaltech_report_state(psmouse);
>>> +}
>>> +
>>> +static psmouse_ret_t focaltech_process_byte(struct psmouse *psmouse)
>>> +{
>>> + if (psmouse->pktcnt >= 6) { /* Full packet received */
>>> + focaltech_process_packet(psmouse);
>>> + return PSMOUSE_FULL_PACKET;
>>> + }
>>> + /*
>>> + * we might want to do some validation of the data here, but we do not
>>> + * know the protocoll well enough
>>> + */
>>> + return PSMOUSE_GOOD_DATA;
>>> +}
>>> +
>>> +static int focaltech_switch_protocol(struct psmouse *psmouse)
>>> +{
>>> + struct ps2dev *ps2dev = &psmouse->ps2dev;
>>> + unsigned char param[3];
>>> +
>>> + param[0] = 0;
>>> + if (ps2_command(ps2dev, param, 0x10f8))
>>> + return -EIO;
>>> + if (ps2_command(ps2dev, param, 0x10f8))
>>> + return -EIO;
>>> + if (ps2_command(ps2dev, param, 0x10f8))
>>> + return -EIO;
>>> + param[0] = 1;
>>> + if (ps2_command(ps2dev, param, 0x10f8))
>>> + return -EIO;
>>> + if (ps2_command(ps2dev, param, PSMOUSE_CMD_SETSCALE11))
>>> + return -EIO;
>>> +
>>> + if (ps2_command(ps2dev, param, PSMOUSE_CMD_ENABLE))
>>> + return -EIO;
>>> return 0;
>>> }
>>> +
>>> +static void focaltech_disconnect(struct psmouse *psmouse)
>>> +{
>>> + focaltech_reset(psmouse);
>>> + kfree(psmouse->private);
>>> + psmouse->private = NULL;
>>> +}
>>> +
>>> +static int focaltech_reconnect(struct psmouse *psmouse)
>>> +{
>>> + focaltech_reset(psmouse);
>>> + if (focaltech_switch_protocol(psmouse)) {
>>> + psmouse_err(psmouse,
>>> + "Unable to initialize the device.");
>>> + return -1;
>>> + }
>>> + return 0;
>>> +}
>>> +
>>> +static void set_input_params(struct psmouse *psmouse)
>>> +{
>>> + struct input_dev *dev = psmouse->dev;
>>> + struct focaltech_data *priv = psmouse->private;
>>> +
>>> + __set_bit(EV_ABS, dev->evbit);
>>> + input_set_abs_params(dev, ABS_MT_POSITION_X, 0, priv->x_max, 0, 0);
>>> + input_set_abs_params(dev, ABS_MT_POSITION_Y, 0, priv->y_max, 0, 0);
>>> + input_mt_init_slots(dev, 5, INPUT_MT_POINTER);
>>> + __clear_bit(EV_REL, dev->evbit);
>>> + __clear_bit(REL_X, dev->relbit);
>>> + __clear_bit(REL_Y, dev->relbit);
>>> + __clear_bit(BTN_RIGHT, dev->keybit);
>>> + __clear_bit(BTN_MIDDLE, dev->keybit);
>>> + __set_bit(INPUT_PROP_BUTTONPAD, dev->propbit);
>>> +}
>>> +
>>> +static int focaltech_read_register(struct ps2dev *ps2dev, int reg,
>>> + unsigned char *param)
>>> +{
>>> + if (ps2_command(ps2dev, param, PSMOUSE_CMD_SETSCALE11))
>>> + return -1;
>>> + param[0] = 0;
>>> + if (ps2_command(ps2dev, param, PSMOUSE_CMD_SETRES))
>>> + return -1;
>>> + if (ps2_command(ps2dev, param, PSMOUSE_CMD_SETRES))
>>> + return -1;
>>> + if (ps2_command(ps2dev, param, PSMOUSE_CMD_SETRES))
>>> + return -1;
>>> + param[0] = reg;
>>> + if (ps2_command(ps2dev, param, PSMOUSE_CMD_SETRES))
>>> + return -1;
>>> + if (ps2_command(ps2dev, param, PSMOUSE_CMD_GETINFO))
>>> + return -1;
>>> + return 0;
>>> +}
>>> +
>>> +static int focaltech_read_size(struct psmouse *psmouse)
>>> +{
>>> + struct ps2dev *ps2dev = &psmouse->ps2dev;
>>> + struct focaltech_data *priv = psmouse->private;
>>> + char param[3];
>>> +
>>> + if (focaltech_read_register(ps2dev, 2, param))
>>> + return -EIO;
>>> + /* not sure whether this is 100% correct */
>>> + priv->x_max = (unsigned char)param[1] * 128;
>>> + priv->y_max = (unsigned char)param[2] * 128;
>> Hmm, I assume it is 99% correct for the X450 and X550 ? In that case this is
>> good enough for now.
> It seems to be correct for Asus R405LD, X450, K750 (=X750?), UX303. Good
> enough, or should I wait for more feedback?
Sounds good enough to me.
Regards,
Hans
^ permalink raw reply
* Re: [PATCH v3 0/4] Fixes for ALPS driver
From: Hans de Goede @ 2014-11-02 14:14 UTC (permalink / raw)
To: Pali Rohár, Dmitry Torokhov, Yunkang Tang, Tommy Will
Cc: linux-input, linux-kernel
In-Reply-To: <1414884310-19842-1-git-send-email-pali.rohar@gmail.com>
Hi,
On 11/02/2014 12:25 AM, Pali Rohár wrote:
> This patch series tries to fix problems with ALPS dualpoint devices on Dell
> Latitude laptops which are probably caused by bugs in Dell BIOS, Dell EC or
> in ALPS touchpad firmware itself.
>
> Root of problems is yet unknown but at least this patch series could eliminate
> reporting bogus data to userspace.
>
> Reported bugs:
> https://bugs.launchpad.net/ubuntu/+source/linux/+bug/1258837
> https://bugs.launchpad.net/ubuntu/+source/linux/+bug/1320022
> https://bugs.launchpad.net/ubuntu/+source/linux/+bug/1272624
> https://bugzilla.redhat.com/show_bug.cgi?id=1145954
>
> Pali Rohár (4):
> input: alps: Do not try to parse data as 3 bytes packet when driver
> is out of sync
> input: alps: Allow 2 invalid packets without resetting device
> input: alps: For protocol V3, do not process data when last packet's
> bit7 is set
> input: alps: Fix trackstick detection
>
> drivers/input/mouse/alps.c | 113 +++++++++++++++++++++++++++++++-------------
> 1 file changed, 80 insertions(+), 33 deletions(-)
Thanks for working on this, patches 1-3 are:
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
Patch 4 is too much work to review on a Sunday :), so I'll leave
reviewing it to Dmitry.
Regards,
Hans
--
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
* Re: [PATCH v2] Input: i8042 - add mux quirk for HP EliteBook
From: Luis Henriques @ 2014-11-02 15:42 UTC (permalink / raw)
To: Dmitry Torokhov; +Cc: linux-input, linux-kernel
In-Reply-To: <20141101025737.GA20884@dtor-ws>
On Fri, Oct 31, 2014 at 07:57:37PM -0700, Dmitry Torokhov wrote:
> On Tue, Oct 28, 2014 at 04:08:41PM -0700, Dmitry Torokhov wrote:
> > On Tue, Oct 28, 2014 at 10:27:12PM +0000, Luis Henriques wrote:
> > > This laptop requires active multiplexing to be enabled in order to be able
> > > to separate the PS/2 mouse and the touchpad.
> > >
> > > Signed-off-by: Luis Henriques <luis.henriques@canonical.com>
> >
> > Applied, thank you.
>
> Actually I am reverting the nomux patch, so unapplied ;)
That works for me as well :-) Thanks!
Cheers,
--
Luís
--
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
* Supporting U2F over HID on Linux?
From: Andy Lutomirski @ 2014-11-02 18:57 UTC (permalink / raw)
To: Kay Sievers, Greg KH, systemd Mailing List, Jiri Kosina,
linux-input
I want to get U2F (universal second factor, sometimes called "security
key" or even "gnubby") working on Linux. U2F tokens are HID devices
that speak a custom protocol. The intent is that user code will speak
to then using something like HIDAPI.
The trick is that, for HIDAPI to work, something needs to recognize
these devices and get udev to set appropriate device permissions.
My question is: how should this be done? The official way to
enumerate U2F devices is to look for a HID usage page 0xf1d0
containing usage 0x1.
Options include:
- A builtin udev helper that reads the sysfs report_descriptor for
hid or hidraw devices and sets attributes accordingly (either
ID_SECURITY_TOKEN or something more general).
- A udev helper that does this and doesn't live in the systemd tree.
I don't love this option -- I'd prefer for this to be as plug-and-play
as possible.
- HID core code in the kernel to add
HID_USAGES=f1d00001:lots:of:other:things to the uevent (or udev code
to do the same). This might end up producing a rather long string or
some devices.
- An actual kernel driver for U2F devices using the hid group
mechanism for enumeration. This seems overcomplicated.
Concretely, my U2F device is:
/devices/pci0000:00/0000:00:1a.0/usb1/1-1/1-1.2/1-1.2:1.0/0003:1050:0120.0011/hidraw/hidraw0
The 0xf1d0 thing is enumerable on
/devices/pci0000:00/0000:00:1a.0/usb1/1-1/1-1.2/1-1.2:1.0/0003:1050:0120.0011.
Thoughts?
--Andy
_______________________________________________
systemd-devel mailing list
systemd-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/systemd-devel
^ permalink raw reply
* (unknown)
From: MRS GRACE MANDA @ 2014-11-02 19:54 UTC (permalink / raw)
In-Reply-To: <1480763910.146593.1414958012342.JavaMail.yahoo@jws10033.mail.ne1.yahoo.com>
[-- Attachment #1: Type: text/plain, Size: 71 bytes --]
This is Mrs Grace Manda ( Please I need your Help is Urgent).
[-- Attachment #2: Mrs Grace Manda.rtf --]
[-- Type: application/rtf, Size: 35796 bytes --]
^ permalink raw reply
* Re: Supporting U2F over HID on Linux?
From: Jiri Kosina @ 2014-11-02 20:42 UTC (permalink / raw)
To: Andy Lutomirski; +Cc: Kay Sievers, Greg KH, systemd Mailing List, linux-input
In-Reply-To: <CALCETrXKcU1KaEjFUm9QkEhZRh9wFnoR=hV7O9pUJmYRqNCxpg@mail.gmail.com>
On Sun, 2 Nov 2014, Andy Lutomirski wrote:
> I want to get U2F (universal second factor, sometimes called "security
> key" or even "gnubby") working on Linux. U2F tokens are HID devices
> that speak a custom protocol. The intent is that user code will speak
> to then using something like HIDAPI.
>
> The trick is that, for HIDAPI to work, something needs to recognize
> these devices and get udev to set appropriate device permissions.
Just to make sure we are on the same page -- this is really only about
setting proper device node permissions and nothing else, right?
> My question is: how should this be done? The official way to
> enumerate U2F devices is to look for a HID usage page 0xf1d0
> containing usage 0x1.
>
> Options include:
>
> - A builtin udev helper that reads the sysfs report_descriptor for
> hid or hidraw devices and sets attributes accordingly (either
> ID_SECURITY_TOKEN or something more general).
Hmmm ... please keep in mind that report_descriptor is actually in
debugfs, so it's a bit questionable whether you can rely on it being
present on well-defined location on all systems.
You can get it from different other places though, such as libusb (but
then you are limited only to USB HID devices ... which might be enough
in your particular case).
> - A udev helper that does this and doesn't live in the systemd tree.
> I don't love this option -- I'd prefer for this to be as plug-and-play
> as possible.
Agreed.
> - HID core code in the kernel to add
> HID_USAGES=f1d00001:lots:of:other:things to the uevent (or udev code
> to do the same). This might end up producing a rather long string or
> some devices.
We have been thinking about this quite a lot in the past, and decided to
postpone this until there is a very good reason for it to happen.
> - An actual kernel driver for U2F devices using the hid group
> mechanism for enumeration. This seems overcomplicated.
Hmmm ... why do you think so? I believe it actually should be really
super-trivial.
Thanks,
--
Jiri Kosina
SUSE Labs
^ permalink raw reply
* Re: [systemd-devel] Supporting U2F over HID on Linux?
From: Tom Gundersen @ 2014-11-02 20:47 UTC (permalink / raw)
To: Andy Lutomirski
Cc: Kay Sievers, Greg KH, systemd Mailing List, Jiri Kosina,
linux-input@vger.kernel.org
In-Reply-To: <CALCETrXKcU1KaEjFUm9QkEhZRh9wFnoR=hV7O9pUJmYRqNCxpg@mail.gmail.com>
Hi Andy,
On Sun, Nov 2, 2014 at 7:57 PM, Andy Lutomirski <luto@amacapital.net> wrote:
> I want to get U2F (universal second factor, sometimes called "security
> key" or even "gnubby") working on Linux. U2F tokens are HID devices
> that speak a custom protocol. The intent is that user code will speak
> to then using something like HIDAPI.
>
> The trick is that, for HIDAPI to work, something needs to recognize
> these devices and get udev to set appropriate device permissions.
>
> My question is: how should this be done? The official way to
> enumerate U2F devices is to look for a HID usage page 0xf1d0
> containing usage 0x1.
>
> Options include:
>
> - A builtin udev helper that reads the sysfs report_descriptor for
> hid or hidraw devices and sets attributes accordingly (either
> ID_SECURITY_TOKEN or something more general).
I don't think we should have such special-purpose logic in the udev core.
[...]
> - HID core code in the kernel to add
> HID_USAGES=f1d00001:lots:of:other:things to the uevent (or udev code
> to do the same). This might end up producing a rather long string or
> some devices.
This makes the most sense to me. We could put this logic (adapting the
patch you posted) in src/udev/udev-builtin-usb_id.c.
I'll comment on the patch separately.
Cheers,
Tom
^ permalink raw reply
* Re: Supporting U2F over HID on Linux?
From: Andy Lutomirski @ 2014-11-02 21:11 UTC (permalink / raw)
To: Jiri Kosina; +Cc: Kay Sievers, Greg KH, systemd Mailing List, linux-input
In-Reply-To: <alpine.LNX.2.00.1411022134120.19451@pobox.suse.cz>
On Sun, Nov 2, 2014 at 12:42 PM, Jiri Kosina <jkosina@suse.cz> wrote:
> On Sun, 2 Nov 2014, Andy Lutomirski wrote:
>
>> I want to get U2F (universal second factor, sometimes called "security
>> key" or even "gnubby") working on Linux. U2F tokens are HID devices
>> that speak a custom protocol. The intent is that user code will speak
>> to then using something like HIDAPI.
>>
>> The trick is that, for HIDAPI to work, something needs to recognize
>> these devices and get udev to set appropriate device permissions.
>
> Just to make sure we are on the same page -- this is really only about
> setting proper device node permissions and nothing else, right?
Yes.
>
>> My question is: how should this be done? The official way to
>> enumerate U2F devices is to look for a HID usage page 0xf1d0
>> containing usage 0x1.
>>
>> Options include:
>>
>> - A builtin udev helper that reads the sysfs report_descriptor for
>> hid or hidraw devices and sets attributes accordingly (either
>> ID_SECURITY_TOKEN or something more general).
>
> Hmmm ... please keep in mind that report_descriptor is actually in
> debugfs, so it's a bit questionable whether you can rely on it being
> present on well-defined location on all systems.
>
Huh? I have /sys/devices/pci0000:00/0000:00:1a.0/usb1/1-1/1-1.2/1-1.2:1.0/0003:1050:0120.0013/report_descriptor
on my system.
> You can get it from different other places though, such as libusb (but
> then you are limited only to USB HID devices ... which might be enough
> in your particular case).
I have no idea whether there will ever be a bluetooth U2F device.
>
>> - A udev helper that does this and doesn't live in the systemd tree.
>> I don't love this option -- I'd prefer for this to be as plug-and-play
>> as possible.
>
> Agreed.
>
>> - HID core code in the kernel to add
>> HID_USAGES=f1d00001:lots:of:other:things to the uevent (or udev code
>> to do the same). This might end up producing a rather long string or
>> some devices.
>
> We have been thinking about this quite a lot in the past, and decided to
> postpone this until there is a very good reason for it to happen.
I'm not sure that U2F counts as a very good reason.
>
>> - An actual kernel driver for U2F devices using the hid group
>> mechanism for enumeration. This seems overcomplicated.
>
> Hmmm ... why do you think so? I believe it actually should be really
> super-trivial.
The HID group part is trivial, but what interface would the driver
expose? I don't think that a udev rule for hidraw matching the
modalias makes any sense, and, if it were a real driver, what
interface would it expose? Most cross-platform userspace code for U2F
is likely to use HIDAPI.
Admittedly, a U2F driver in the kernel would be slightly nicer from a
multiplexing standpoint than hidraw.
--Andy
^ permalink raw reply
page: next (older) | prev (newer) | latest
- recent:[subjects (threaded)|topics (new)|topics (active)]
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox