[6/6] Input: psmouse - limit protocols that we try on passthrough ports
diff mbox

Message ID 1448774036-39040-7-git-send-email-dmitry.torokhov@gmail.com
State Accepted
Headers show

Commit Message

Dmitry Torokhov Nov. 29, 2015, 5:13 a.m. UTC
PS/2 protocol is slow, and using it with pass-through port (where we
encapsulate PS/2 into PS/2) is slower yet so it takes quite a bit of time
to do full protocol discovery for device attached to a pass-through port.
However, so far we have not see anything but trackpoints or basic PS/2
mice on pass-through ports, so let's limit protocols that we probe there
to Trackpoint, IntelliMouse Explorer, IntelliMouse, and bare PS/2 protocol,
and avoid other extended protocols, such as Synaptics, ALPS, etc.

Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
---
 drivers/input/mouse/psmouse-base.c | 10 ++++++++++
 1 file changed, 10 insertions(+)

Comments

Hans de Goede Dec. 2, 2015, 3:21 p.m. UTC | #1
Hi,

On 29-11-15 06:13, Dmitry Torokhov wrote:
> PS/2 protocol is slow, and using it with pass-through port (where we
> encapsulate PS/2 into PS/2) is slower yet so it takes quite a bit of time
> to do full protocol discovery for device attached to a pass-through port.
> However, so far we have not see anything but trackpoints or basic PS/2
> mice on pass-through ports, so let's limit protocols that we probe there
> to Trackpoint, IntelliMouse Explorer, IntelliMouse, and bare PS/2 protocol,
> and avoid other extended protocols, such as Synaptics, ALPS, etc.
>
> Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>

Reviewed-by: Hans de Goede <hdegoede@redhat.com>

Regards,

Hans


> ---
>   drivers/input/mouse/psmouse-base.c | 10 ++++++++++
>   1 file changed, 10 insertions(+)
>
> diff --git a/drivers/input/mouse/psmouse-base.c b/drivers/input/mouse/psmouse-base.c
> index ee59b0e..e909c6e 100644
> --- a/drivers/input/mouse/psmouse-base.c
> +++ b/drivers/input/mouse/psmouse-base.c
> @@ -119,6 +119,7 @@ struct psmouse_protocol {
>   	enum psmouse_type type;
>   	bool maxproto;
>   	bool ignore_parity; /* Protocol should ignore parity errors from KBC */
> +	bool try_passthru; /* Try protocol also on passthrough ports */
>   	const char *name;
>   	const char *alias;
>   	int (*detect)(struct psmouse *, bool);
> @@ -691,6 +692,7 @@ static const struct psmouse_protocol psmouse_protocols[] = {
>   		.maxproto	= true,
>   		.ignore_parity	= true,
>   		.detect		= ps2bare_detect,
> +		.try_passthru	= true,
>   	},
>   #ifdef CONFIG_MOUSE_PS2_LOGIPS2PP
>   	{
> @@ -728,6 +730,7 @@ static const struct psmouse_protocol psmouse_protocols[] = {
>   		.maxproto	= true,
>   		.ignore_parity	= true,
>   		.detect		= intellimouse_detect,
> +		.try_passthru	= true,
>   	},
>   	{
>   		.type		= PSMOUSE_IMEX,
> @@ -736,6 +739,7 @@ static const struct psmouse_protocol psmouse_protocols[] = {
>   		.maxproto	= true,
>   		.ignore_parity	= true,
>   		.detect		= im_explorer_detect,
> +		.try_passthru	= true,
>   	},
>   #ifdef CONFIG_MOUSE_PS2_SYNAPTICS
>   	{
> @@ -777,6 +781,7 @@ static const struct psmouse_protocol psmouse_protocols[] = {
>   		.name		= "TPPS/2",
>   		.alias		= "trackpoint",
>   		.detect		= trackpoint_detect,
> +		.try_passthru	= true,
>   	},
>   #endif
>   #ifdef CONFIG_MOUSE_PS2_TOUCHKIT
> @@ -933,6 +938,11 @@ static bool psmouse_try_protocol(struct psmouse *psmouse,
>   	if (!proto)
>   		return false;
>
> +	if (psmouse->ps2dev.serio->id.type == SERIO_PS_PSTHRU &&
> +	    !proto->try_passthru) {
> +		return false;
> +	}
> +
>   	if (set_properties)
>   		psmouse_apply_defaults(psmouse);
>
>
--
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
Pali Rohár Dec. 11, 2015, 11:50 a.m. UTC | #2
On Saturday 28 November 2015 21:13:56 Dmitry Torokhov wrote:
> PS/2 protocol is slow, and using it with pass-through port (where we
> encapsulate PS/2 into PS/2) is slower yet so it takes quite a bit of time
> to do full protocol discovery for device attached to a pass-through port.
> However, so far we have not see anything but trackpoints or basic PS/2
> mice on pass-through ports, so let's limit protocols that we probe there
> to Trackpoint, IntelliMouse Explorer, IntelliMouse, and bare PS/2 protocol,
> and avoid other extended protocols, such as Synaptics, ALPS, etc.
> 
> Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>

Reviewed-by: Pali Rohár <pali.rohar@gmail.com>

Thanks for this patch series!

Patch
diff mbox

diff --git a/drivers/input/mouse/psmouse-base.c b/drivers/input/mouse/psmouse-base.c
index ee59b0e..e909c6e 100644
--- a/drivers/input/mouse/psmouse-base.c
+++ b/drivers/input/mouse/psmouse-base.c
@@ -119,6 +119,7 @@  struct psmouse_protocol {
 	enum psmouse_type type;
 	bool maxproto;
 	bool ignore_parity; /* Protocol should ignore parity errors from KBC */
+	bool try_passthru; /* Try protocol also on passthrough ports */
 	const char *name;
 	const char *alias;
 	int (*detect)(struct psmouse *, bool);
@@ -691,6 +692,7 @@  static const struct psmouse_protocol psmouse_protocols[] = {
 		.maxproto	= true,
 		.ignore_parity	= true,
 		.detect		= ps2bare_detect,
+		.try_passthru	= true,
 	},
 #ifdef CONFIG_MOUSE_PS2_LOGIPS2PP
 	{
@@ -728,6 +730,7 @@  static const struct psmouse_protocol psmouse_protocols[] = {
 		.maxproto	= true,
 		.ignore_parity	= true,
 		.detect		= intellimouse_detect,
+		.try_passthru	= true,
 	},
 	{
 		.type		= PSMOUSE_IMEX,
@@ -736,6 +739,7 @@  static const struct psmouse_protocol psmouse_protocols[] = {
 		.maxproto	= true,
 		.ignore_parity	= true,
 		.detect		= im_explorer_detect,
+		.try_passthru	= true,
 	},
 #ifdef CONFIG_MOUSE_PS2_SYNAPTICS
 	{
@@ -777,6 +781,7 @@  static const struct psmouse_protocol psmouse_protocols[] = {
 		.name		= "TPPS/2",
 		.alias		= "trackpoint",
 		.detect		= trackpoint_detect,
+		.try_passthru	= true,
 	},
 #endif
 #ifdef CONFIG_MOUSE_PS2_TOUCHKIT
@@ -933,6 +938,11 @@  static bool psmouse_try_protocol(struct psmouse *psmouse,
 	if (!proto)
 		return false;
 
+	if (psmouse->ps2dev.serio->id.type == SERIO_PS_PSTHRU &&
+	    !proto->try_passthru) {
+		return false;
+	}
+
 	if (set_properties)
 		psmouse_apply_defaults(psmouse);