From: Dmitry Torokhov <dtor_core@ameritech.net>
To: Vojtech Pavlik <vojtech@suse.cz>
Cc: LKML <linux-kernel@vger.kernel.org>
Subject: [PATCH 7/8] Separate PS2PP protocol handling
Date: Wed, 29 Sep 2004 01:46:36 -0500 [thread overview]
Message-ID: <200409290146.38929.dtor_core@ameritech.net> (raw)
In-Reply-To: <200409290145.39919.dtor_core@ameritech.net>
===================================================================
ChangeSet@1.1953, 2004-09-29 01:06:41-05:00, dtor_core@ameritech.net
Input: psmouse - make logips2pp fully decode its protocol packets
and not rely on generic handler to finish job.
Signed-off-by: Dmitry Torokhov <dtor@mail.ru>
logips2pp.c | 43 +++++++++++++++++++++++++++++++++----------
logips2pp.h | 1 -
psmouse-base.c | 7 -------
3 files changed, 33 insertions(+), 18 deletions(-)
===================================================================
diff -Nru a/drivers/input/mouse/logips2pp.c b/drivers/input/mouse/logips2pp.c
--- a/drivers/input/mouse/logips2pp.c 2004-09-29 01:23:24 -05:00
+++ b/drivers/input/mouse/logips2pp.c 2004-09-29 01:23:24 -05:00
@@ -38,13 +38,23 @@
* Process a PS2++ or PS2T++ packet.
*/
-void ps2pp_process_packet(struct psmouse *psmouse)
+static psmouse_ret_t ps2pp_process_byte(struct psmouse *psmouse, struct pt_regs *regs)
{
struct input_dev *dev = &psmouse->dev;
- unsigned char *packet = psmouse->packet;
+ unsigned char *packet = psmouse->packet;
+
+ if (psmouse->pktcnt < 3)
+ return PSMOUSE_GOOD_DATA;
+
+/*
+ * Full packet accumulated, process it
+ */
+
+ input_regs(dev, regs);
if ((packet[0] & 0x48) == 0x48 && (packet[1] & 0x02) == 0x02) {
+ /* Logitech extended packet */
switch ((packet[1] >> 4) | (packet[0] & 0x30)) {
case 0x0d: /* Mouse extra info */
@@ -79,11 +89,20 @@
(packet[1] >> 4) | (packet[0] & 0x30));
#endif
}
-
- packet[0] &= 0x0f;
- packet[1] = 0;
- packet[2] = 0;
+ } else {
+ /* Standard PS/2 motion data */
+ input_report_rel(dev, REL_X, packet[1] ? (int) packet[1] - (int) ((packet[0] << 4) & 0x100) : 0);
+ input_report_rel(dev, REL_Y, packet[2] ? (int) ((packet[0] << 3) & 0x100) - (int) packet[2] : 0);
}
+
+ input_report_key(dev, BTN_LEFT, packet[0] & 1);
+ input_report_key(dev, BTN_MIDDLE, (packet[0] >> 2) & 1);
+ input_report_key(dev, BTN_RIGHT, (packet[0] >> 1) & 1);
+
+ input_sync(dev);
+
+ return PSMOUSE_FULL_PACKET;
+
}
/*
@@ -334,11 +353,15 @@
psmouse->vendor = "Logitech";
psmouse->model = model;
- if (use_ps2pp && model_info->kind != PS2PP_KIND_TP3) {
- psmouse->set_resolution = ps2pp_set_resolution;
- psmouse->disconnect = ps2pp_disconnect;
+ if (use_ps2pp) {
+ psmouse->protocol_handler = ps2pp_process_byte;
+
+ if (model_info->kind != PS2PP_KIND_TP3) {
+ psmouse->set_resolution = ps2pp_set_resolution;
+ psmouse->disconnect = ps2pp_disconnect;
- device_create_file(&psmouse->ps2dev.serio->dev, &psmouse_attr_smartscroll);
+ device_create_file(&psmouse->ps2dev.serio->dev, &psmouse_attr_smartscroll);
+ }
}
if (buttons < 3)
diff -Nru a/drivers/input/mouse/logips2pp.h b/drivers/input/mouse/logips2pp.h
--- a/drivers/input/mouse/logips2pp.h 2004-09-29 01:23:24 -05:00
+++ b/drivers/input/mouse/logips2pp.h 2004-09-29 01:23:24 -05:00
@@ -11,7 +11,6 @@
#ifndef _LOGIPS2PP_H
#define _LOGIPS2PP_H
-void ps2pp_process_packet(struct psmouse *psmouse);
int ps2pp_init(struct psmouse *psmouse, int set_properties);
#endif
diff -Nru a/drivers/input/mouse/psmouse-base.c b/drivers/input/mouse/psmouse-base.c
--- a/drivers/input/mouse/psmouse-base.c 2004-09-29 01:23:24 -05:00
+++ b/drivers/input/mouse/psmouse-base.c 2004-09-29 01:23:24 -05:00
@@ -84,13 +84,6 @@
input_regs(dev, regs);
/*
- * The PS2++ protocol is a little bit complex
- */
-
- if (psmouse->type == PSMOUSE_PS2PP)
- ps2pp_process_packet(psmouse);
-
-/*
* Scroll wheel on IntelliMice, scroll buttons on NetMice
*/
next prev parent reply other threads:[~2004-09-29 6:55 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2004-09-29 6:40 [PATCH 0/8] Set of input (psmouse) patches Dmitry Torokhov
2004-09-29 6:41 ` [PATCH 1/8] New ALPS signature Dmitry Torokhov
2004-09-29 6:42 ` [PATCH 2/8] Psmouse rate and resolution handlers Dmitry Torokhov
2004-09-29 6:43 ` [PATCH 3/8] Guest protocol switch in synaptics Dmitry Torokhov
2004-09-29 6:44 ` [PATCH 4/8] Psmouse probe fixes Dmitry Torokhov
2004-09-29 6:44 ` [PATCH 5/8] Export psmouse parameters via sysfs Dmitry Torokhov
2004-09-29 6:45 ` [PATCH 6/8] Drop PS2TPP protocol identifier Dmitry Torokhov
2004-09-29 6:46 ` Dmitry Torokhov [this message]
2004-09-29 6:47 ` [PATCH 7/8] Psmouse - add packet size Dmitry Torokhov
2004-09-29 7:15 ` Vojtech Pavlik
2004-09-29 7:29 ` Dmitry Torokhov
2004-09-29 9:31 ` Vojtech Pavlik
2004-09-29 13:24 ` Dmitry Torokhov
2004-09-29 13:38 ` Vojtech Pavlik
2004-09-30 6:43 ` Dmitry Torokhov
2004-09-30 7:55 ` Vojtech Pavlik
2004-09-30 10:34 ` Jan-Benedict Glaw
2004-09-29 7:11 ` [PATCH 0/8] Set of input (psmouse) patches Vojtech Pavlik
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=200409290146.38929.dtor_core@ameritech.net \
--to=dtor_core@ameritech.net \
--cc=linux-kernel@vger.kernel.org \
--cc=vojtech@suse.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox