All of lore.kernel.org
 help / color / mirror / Atom feed
From: Aristeu Rozanski <arozansk@redhat.com>
To: Dmitry Torokhov <dmitry.torokhov@gmail.com>
Cc: linux-input@atrey.karlin.mff.cuni.cz, Chris Williams <cww@redhat.com>
Subject: Re: [RFC] psmouse: add support for 4th button using the 4th bit
Date: Tue, 8 May 2007 14:53:27 -0400	[thread overview]
Message-ID: <20070508185327.GB4215@redhat.com> (raw)
In-Reply-To: <d120d5000704030805l397a61d5x99b8fdb138b6881d@mail.gmail.com>

Hi Dmitry,
> You'd need to add something like this to psmouse_protocols[]:
> 
>        {
>                .type           = PSMOUSE_CORTRON,
>                .name           = "CortronPS/2",
>                .alias          = "cortps",
>                .detect         = cortron_detect,
>        },
> 
> and then model cortron_detect after ps2bare_detect (where you don't
> actually detect anything, just force protocol).
we asked Cortron again about a possible auto-detection sequence but they
didn't implemented anything in this matter. So I updated the patch
according your recomendations and Chris tested again with the Trackball,
with success. If you're ok with that, I'll resubmit it with proper
description/signed-off-by header.


--- linus-2.6.orig/drivers/input/mouse/psmouse-base.c
+++ linus-2.6/drivers/input/mouse/psmouse-base.c
@@ -177,6 +177,15 @@ static psmouse_ret_t psmouse_process_byt
 	}
 
 /*
+ * Cortron PS2 Trackball reports SIDE button on the 4th bit of the first
+ * byte.
+ */
+	if (psmouse->type == PSMOUSE_CORTRON) {
+		input_report_key(dev, BTN_SIDE, (packet[0] >> 3) & 1);
+		packet[0] |= 0x08;
+	}
+
+/*
  * Generic PS/2 Mouse
  */
 
@@ -538,6 +547,20 @@ static int ps2bare_detect(struct psmouse
 	return 0;
 }
 
+/*
+ * Cortron PS/2 protocol detection. There's no special way to detect it, so it
+ * must be forced by sysfs protocol writing.
+ */
+static int cortron_detect(struct psmouse *psmouse, int set_properties)
+{
+	if (set_properties) {
+		psmouse->vendor = "Cortron";
+		psmouse->name = "PS/2 Trackball";
+		set_bit(BTN_SIDE, psmouse->dev->keybit);
+	}
+
+	return 0;
+}
 
 /*
  * psmouse_extensions() probes for any extensions to the basic PS/2 protocol
@@ -655,6 +678,12 @@ static const struct psmouse_protocol psm
 		.detect		= ps2bare_detect,
 	},
 	{
+		.type		= PSMOUSE_CORTRON,
+		.name		= "CortronPS/2",
+		.alias		= "cortps",
+		.detect		= cortron_detect,
+	},
+	{
 		.type		= PSMOUSE_PS2PP,
 		.name		= "PS2++",
 		.alias		= "logitech",
--- linus-2.6.orig/drivers/input/mouse/psmouse.h
+++ linus-2.6/drivers/input/mouse/psmouse.h
@@ -78,6 +78,7 @@ struct psmouse {
 enum psmouse_type {
 	PSMOUSE_NONE,
 	PSMOUSE_PS2,
+	PSMOUSE_CORTRON,
 	PSMOUSE_PS2PP,
 	PSMOUSE_THINKPS,
 	PSMOUSE_GENPS,

  parent reply	other threads:[~2007-05-08 18:53 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-04-02 20:48 [RFC] psmouse: add support for 4th button using the 4th bit Aristeu Rozanski
2007-04-03 14:39 ` Dmitry Torokhov
2007-04-03 14:42   ` Aristeu Rozanski
2007-04-03 15:05     ` Dmitry Torokhov
2007-04-03 15:23       ` Aristeu Rozanski
2007-05-08 18:53       ` Aristeu Rozanski [this message]
2007-05-09 14:36         ` Dmitry Torokhov
2007-05-09 14:53           ` [PATCH] " Aristeu Rozanski
2007-05-09 15:39             ` Dmitry Torokhov
2007-05-09 15:49               ` Aristeu Rozanski

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20070508185327.GB4215@redhat.com \
    --to=arozansk@redhat.com \
    --cc=cww@redhat.com \
    --cc=dmitry.torokhov@gmail.com \
    --cc=linux-input@atrey.karlin.mff.cuni.cz \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.