Skip to contentSkip to conversation

Synaptics: support reconnect keeping the same input device

PATCH In review Dmitry Torokhov 3 participants 3 messages Aug 23, 2003 – Aug 26, 2003 Input drivers

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 Synaptics: support reconnect keeping the same input device

Here is the update to the Synaptics touchpad driver. It is supposed to go on top of patches form Peter Osterlund site:
(http://w1.894.telia.com/~u89404340/patches/touchpad/2.6.0-test2/v1/)
and on top of 3 serio patches I posted earlier.

The changes are:
1. Support for pass-through port moved from Synaptics driver to psmouse itself, it is cleaner and should allow using it in other drivers if needed.
2. The driver makes use of new reconnect functionality in serio. It will try to keep the same input device after resume or when it resets itself.
3. If mouse is disconnected or other mouse plugged in while sleeping the driver should correctly recognize that and create a new serio/input device.

I also have patch against vanilla 2.6.0-test4 incorporating all patches mentioned above at:
http://www.geocities.com/dt_or/synaptics/synaptics-reconnect-full-2.6.0-t4.patch.gz

Dmitry

drivers/input/mouse/logips2pp.c +1 -0
diff -urN --exclude-from=/usr/src/exclude 2.6.0-test4/drivers/input/mouse/logips2pp.c linux-2.6.0-test4/drivers/input/mouse/logips2pp.c
@@ -10,6 +10,7 @@
  */
 
 #include <linux/input.h>
+#include <linux/serio.h>
 #include "psmouse.h"
 #include "logips2pp.h"
 
drivers/input/mouse/psmouse-base.c +84 -37

181 lines not on this page · raw message

drivers/input/mouse/psmouse.h +13 -0
diff -urN --exclude-from=/usr/src/exclude 2.6.0-test4/drivers/input/mouse/psmouse.h linux-2.6.0-test4/drivers/input/mouse/psmouse.h
@@ -22,10 +22,20 @@
 #define PSMOUSE_ACTIVATED	1
 #define PSMOUSE_IGNORE		2
 
+struct psmouse;
+
+struct psmouse_ptport {
+	struct serio serio;
+
+	void (*activate)(struct psmouse *parent);
+	void (*deactivate)(struct psmouse *parent);
+};
+
 struct psmouse {
 	void *private;
 	struct input_dev dev;
 	struct serio *serio;
+	struct psmouse_ptport *ptport;
 	char *vendor;
 	char *name;
 	unsigned char cmdbuf[8];
@@ -41,6 +51,9 @@
 	char error;
 	char devname[64];
 	char phys[32];
+	
+	int (*reconnect)(struct psmouse *psmouse);
+	void (*disconnect)(struct psmouse *psmouse);
 };
 
 #define PSMOUSE_PS2		1
drivers/input/mouse/synaptics.c +163 -115

397 lines not on this page · raw message

drivers/input/mouse/synaptics.h +0 -5
diff -urN --exclude-from=/usr/src/exclude 2.6.0-test4/drivers/input/mouse/synaptics.h linux-2.6.0-test4/drivers/input/mouse/synaptics.h
@@ -9,11 +9,8 @@
 #ifndef _SYNAPTICS_H
 #define _SYNAPTICS_H
 
-
 extern void synaptics_process_byte(struct psmouse *psmouse, struct pt_regs *regs);
 extern int synaptics_init(struct psmouse *psmouse);
-extern int synaptics_pt_init(struct psmouse *psmouse);
-extern void synaptics_disconnect(struct psmouse *psmouse);
 
 /* synaptics queries */
 #define SYN_QUE_IDENTIFY		0x00
@@ -105,8 +102,6 @@
 	/* Data for normal processing */
 	unsigned int out_of_sync;		/* # of packets out of sync */
 	int old_w;				/* Previous w value */
-	
-	struct serio *ptport;			/* pass-through port */
 };
 
 #endif /* _SYNAPTICS_H */
#1 lore raw
Quoted 8 lines · Dmitry Torokhov

Here is the update to the Synaptics touchpad driver. It is supposed to go on top of patches form Peter Osterlund site:

drivers/input/mouse/synaptics.c +1 -0
+	if (SYN_CAP_MULTI_BUTTON_NO(priv->ext_cap)) {
 		switch (SYN_CAP_MULTI_BUTTON_NO(priv->ext_cap) & ~0x01) {
 		default:
 			printk(KERN_ERR "This touchpad reports more than 8 multi-buttons, don't know how to handle.\n");
 		case 8:

...

Review

Quoted 4 lines
(quoted diff) +0 -0
 		case 6:
 		case 4:
 		case 2:
 		}

I think a break is needed after the default case as the documentation says "If nExtBtm is greater than 8 ... nExtbtm should be considered to be invalid and treated as zero."

Peter

#2 lore raw
In reply to Dmitry Torokhov
Quoted 4 lines · Dmitry Torokhov

Here is the update to the Synaptics touchpad driver. It is supposed to go on top of patches form Peter Osterlund site:
(http://w1.894.telia.com/~u89404340/patches/touchpad/2.6.0-test2/v1/)
and on top of 3 serio patches I posted earlier.

I have uploaded a new patch set to my web site:

http://w1.894.telia.com/~u89404340/patches/touchpad/2.6.0-test4/v1/

It contains this patch and some other patches from you with some modifications:

* I got a kernel panic in synaptics_process_byte() because my touchpad doesn't have a pass through port. Fixed by making sure ptport is non-NULL before dereferencing it.
* While tracking down the panic, I split this patch in two. One cleanup patch and one patch that implements the reconnect changes.
* Peter Berg Larsen mentioned that we need to detect synaptics devices even if they don't want to use absolute mode, so I changed the code to do that.

The reconnect patch now looks like this, but it can only be applied on top of the other patches from my web site:

 linux-petero/drivers/input/mouse/logips2pp.c    |    1 
 linux-petero/drivers/input/mouse/psmouse-base.c |   96 +++++++++++---
 linux-petero/drivers/input/mouse/psmouse.h      |   13 ++
 linux-petero/drivers/input/mouse/synaptics.c    |  156 ++++++++++++++----------
 linux-petero/drivers/input/mouse/synaptics.h    |    4 
 5 files changed, 188 insertions(+), 82 deletions(-)
drivers/input/mouse/logips2pp.c renamed from drivers/input/mouse/logips2pp.c~synaptics-reconnect +1 -0
diff -puN drivers/input/mouse/logips2pp.c~synaptics-reconnect drivers/input/mouse/logips2pp.c
@@ -10,6 +10,7 @@
  */
 
 #include <linux/input.h>
+#include <linux/serio.h>
 #include "psmouse.h"
 #include "logips2pp.h"
 
drivers/input/mouse/psmouse-base.c renamed from drivers/input/mouse/psmouse-base.c~synaptics-reconnect +77 -19

143 lines not on this page · raw message

drivers/input/mouse/psmouse.h renamed from drivers/input/mouse/psmouse.h~synaptics-reconnect +13 -0
diff -puN drivers/input/mouse/psmouse.h~synaptics-reconnect drivers/input/mouse/psmouse.h
@@ -22,10 +22,20 @@
 #define PSMOUSE_ACTIVATED	1
 #define PSMOUSE_IGNORE		2
 
+struct psmouse;
+
+struct psmouse_ptport {
+	struct serio serio;
+
+	void (*activate)(struct psmouse *parent);
+	void (*deactivate)(struct psmouse *parent);
+};
+
 struct psmouse {
 	void *private;
 	struct input_dev dev;
 	struct serio *serio;
+	struct psmouse_ptport *ptport;
 	char *vendor;
 	char *name;
 	unsigned char cmdbuf[8];
@@ -41,6 +51,9 @@ struct psmouse {
 	char error;
 	char devname[64];
 	char phys[32];
+
+	int (*reconnect)(struct psmouse *psmouse);
+	void (*disconnect)(struct psmouse *psmouse);
 };
 
 #define PSMOUSE_PS2		1
drivers/input/mouse/synaptics.c renamed from drivers/input/mouse/synaptics.c~synaptics-reconnect +97 -59

224 lines not on this page · raw message

drivers/input/mouse/synaptics.h renamed from drivers/input/mouse/synaptics.h~synaptics-reconnect +0 -4
diff -puN drivers/input/mouse/synaptics.h~synaptics-reconnect drivers/input/mouse/synaptics.h
@@ -12,8 +12,6 @@
 
 extern void synaptics_process_byte(struct psmouse *psmouse, struct pt_regs *regs);
 extern int synaptics_init(struct psmouse *psmouse);
-extern int synaptics_pt_init(struct psmouse *psmouse);
-extern void synaptics_disconnect(struct psmouse *psmouse);
 
 /* synaptics queries */
 #define SYN_QUE_IDENTIFY		0x00
@@ -105,8 +103,6 @@ struct synaptics_data {
 	/* Data for normal processing */
 	unsigned int out_of_sync;		/* # of packets out of sync */
 	int old_w;				/* Previous w value */
-
-	struct serio *ptport;			/* pass-through port */
 };
 
 #endif /* _SYNAPTICS_H */

_

Signature · 2 lines
Peter Osterlund - [email protected]
http://w1.894.telia.com/~u89404340