linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 2.6.11-rc3] IBM Trackpoint support
@ 2005-02-03 22:43 Stephen Evanchik
  2005-02-04  0:34 ` Dmitry Torokhov
                   ` (2 more replies)
  0 siblings, 3 replies; 24+ messages in thread
From: Stephen Evanchik @ 2005-02-03 22:43 UTC (permalink / raw)
  To: Vojtech Pavlik; +Cc: linux-kernel

Vojtech,

Here is a patch that exposes the IBM TrackPoint's extended properties
as well as scroll wheel emulation.


I would appreciate comments and suggestions to make this more acceptable.


Stephen


diff -uNr a/drivers/input/mouse/Makefile b/drivers/input/mouse/Makefile
--- a/drivers/input/mouse/Makefile	2005-02-03 17:30:40.000000000 -0500
+++ b/drivers/input/mouse/Makefile	2005-02-03 17:29:42.000000000 -0500
@@ -14,4 +14,4 @@
 obj-$(CONFIG_MOUSE_SERIAL)	+= sermouse.o
 obj-$(CONFIG_MOUSE_VSXXXAA)	+= vsxxxaa.o
 
-psmouse-objs  := psmouse-base.o alps.o logips2pp.o synaptics.o
+psmouse-objs  := psmouse-base.o alps.o logips2pp.o synaptics.o trackpoint.o
diff -uNr a/drivers/input/mouse/psmouse-base.c
b/drivers/input/mouse/psmouse-base.c
--- a/drivers/input/mouse/psmouse-base.c	2005-02-03 17:30:40.000000000 -0500
+++ b/drivers/input/mouse/psmouse-base.c	2005-02-03 17:29:42.000000000 -0500
@@ -23,6 +23,7 @@
 #include "psmouse.h"
 #include "synaptics.h"
 #include "logips2pp.h"
+#include "trackpoint.h"
 #include "alps.h"
 
 #define DRIVER_DESC	"PS/2 mouse driver"
@@ -119,6 +120,13 @@
 	}
 
 /*
+ * TrackPoint scroll simulation handler if the BTN_MIDDLE is down
+ */
+
+	if(psmouse->model == PSMOUSE_TRACKPOINT)
+		trackpoint_sim_scroll(psmouse);
+
+/*
  * Generic PS/2 Mouse
  */
 
@@ -482,6 +490,16 @@
 		return PSMOUSE_IMPS;
 
 /*
+ * Try to initialize the IBM TrackPoint
+ */
+	if (max_proto > PSMOUSE_PS2 && trackpoint_init(psmouse) == 0) {
+		psmouse->vendor = "IBM";
+		psmouse->name = "TrackPoint";
+ 
+		return PSMOUSE_PS2;
+	}
+
+/*
  * Okay, all failed, we have a standard mouse here. The number of the buttons
  * is still a question, though. We assume 3.
  */
diff -uNr a/drivers/input/mouse/trackpoint.c b/drivers/input/mouse/trackpoint.c
--- a/drivers/input/mouse/trackpoint.c	1969-12-31 19:00:00.000000000 -0500
+++ b/drivers/input/mouse/trackpoint.c	2005-02-03 17:29:42.000000000 -0500
@@ -0,0 +1,649 @@
+/*
+ * Stephen Evanchik <evanchsa@gmail.com>
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 as published by
+ * the Free Software Foundation.
+ *
+ * Trademarks are the property of their respective owners.
+ *
+ * 29/01/2005 - Fixed UltraNav support
+ *		Moved to libps2 interface
+ *		Renamed internal property variables to be consistent with reference docs
+ *		Fixed negative inertia not being set properly
+ *		Added middle button scroll module parameter
+ *
+ */
+
+#include <linux/delay.h>
+#include <linux/serio.h>
+#include <linux/module.h>
+#include <linux/moduleparam.h>
+#include <linux/input.h>
+#include <linux/libps2.h>
+#include <linux/proc_fs.h>
+#include <asm/uaccess.h>
+#include "psmouse.h"
+#include "trackpoint.h"
+
+
+int tp_sens = TP_DEF_SENS;
+module_param_named(sens, tp_sens, uint, 0);
+MODULE_PARM_DESC(sens, "Sensitivity");
+
+int tp_speed = TP_DEF_SPEED;
+module_param_named(speed, tp_speed, uint, 0);
+MODULE_PARM_DESC(speed, "Speed of pointer");
+
+int tp_reach = TP_DEF_REACH;
+module_param_named(reach, tp_reach, uint, 0);
+MODULE_PARM_DESC(reach, "Backup Range");
+
+int tp_draghys = TP_DEF_DRAGHYS;
+module_param_named(draghys, tp_draghys, uint, 0);
+MODULE_PARM_DESC(draghys, "Resistance to dragging");
+
+int tp_mindrag = TP_DEF_MINDRAG;
+module_param_named(mindrag, tp_mindrag, uint, 0);
+MODULE_PARM_DESC(mindrag, "Drag threshold");
+
+int tp_thresh = TP_DEF_THRESH;
+module_param_named(thresh, tp_thresh, uint, 0);
+MODULE_PARM_DESC(thresh, "Force necessary to trigger a press or release");
+
+int tp_upthresh = TP_UP_THRESH;
+module_param_named(upthresh, tp_upthresh, uint, 0);
+MODULE_PARM_DESC(upthresh, "Force necessary to trigger a click");
+
+int tp_ztime = TP_DEF_Z_TIME;
+module_param_named(ztime, tp_ztime, uint, 0);
+MODULE_PARM_DESC(ztime, "Determines how sharp a press is");
+
+int tp_jenks = TP_DEF_JENKS_CURV;
+module_param_named(jenks, tp_jenks, uint, 0);
+MODULE_PARM_DESC(jenks, "Double click sensitivity");
+
+
+/* Toggles */
+int tp_ptson = TP_DEF_PTSON;
+module_param_named(ptson, tp_ptson, uint, 0);
+MODULE_PARM_DESC(ptson, "Press to Select");
+
+int tp_mb = TP_DEF_MB;
+module_param_named(mb, tp_mb, uint, 0);
+MODULE_PARM_DESC(mb, "Middle button is disabled");
+
+int tp_mb_scroll = TP_DEF_MB_SCROLL;
+module_param_named(mb_scroll, tp_mb_scroll, uint, 0);
+MODULE_PARM_DESC(mb_scroll, "Scroll with middle button");
+
+
+__obsolete_setup("pts=");
+__obsolete_setup("backup=");
+__obsolete_setup("draghyst=");
+
+/*
+ * Device IO: read, write and toggle bit
+ */
+static void trackpoint_command(struct ps2dev *ps2dev, unsigned char cmd)
+{	
+	ps2_command(ps2dev, NULL, MAKE_PS2_CMD(0, 0, TP_COMMAND));
+	ps2_command(ps2dev, NULL, MAKE_PS2_CMD(0, 0, cmd));
+}
+
+static void trackpoint_read(struct ps2dev *ps2dev, unsigned char loc,
unsigned char *results)
+{
+	ps2_command(ps2dev, NULL, MAKE_PS2_CMD(0, 0, TP_COMMAND));
+	ps2_command(ps2dev, results, MAKE_PS2_CMD(0, 1, loc));
+}
+
+static void trackpoint_write(struct ps2dev *ps2dev, unsigned char
loc, unsigned char val)
+{	
+	ps2_command(ps2dev, NULL, MAKE_PS2_CMD(0, 0, TP_COMMAND));
+	ps2_command(ps2dev, NULL, MAKE_PS2_CMD(0, 0, TP_WRITE_MEM));
+	ps2_command(ps2dev, NULL, MAKE_PS2_CMD(0, 0, loc));
+	ps2_command(ps2dev, NULL, MAKE_PS2_CMD(0, 0, val));
+}
+
+static int trackpoint_toggle_bit(struct ps2dev *ps2dev, unsigned char
loc, unsigned char mask)
+{
+	/* Bad things will happen if the loc param isn't in this range */
+	if(loc < 0x20 || loc >= 0x2F)
+		return -1;
+	
+	ps2_command(ps2dev, NULL, MAKE_PS2_CMD(0, 0, TP_COMMAND));
+	ps2_command(ps2dev, NULL, MAKE_PS2_CMD(0, 0, TP_TOGGLE));
+	ps2_command(ps2dev, NULL, MAKE_PS2_CMD(0, 0, loc));
+	ps2_command(ps2dev, NULL, MAKE_PS2_CMD(0, 0, mask));
+	
+	return 0;
+}
+
+
+#ifdef CONFIG_PROC_FS
+
+#define PROC_READ_NAME(name) name##_read_func
+#define PROC_WRITE_NAME(name) name##_write_func
+#define PROC_TOGGLE_NAME(name) name##_toggle_func
+
+#define MAKE_PROC_READ(name, item) \
+	static int name(char* page, char** start, off_t off, int count, int*
eof, void* data) \
+	{ \
+		int len; \
+		struct psmouse *psmouse = (struct psmouse *)data; \
+		struct trackpoint_data *tp = (struct trackpoint_data*)psmouse->private; \
+		len = sprintf(page, "%lu\n", (unsigned long)tp->item); \
+		*eof = 1; \
+		return len; \
+	}
+
+#define MAKE_PROC_WRITE(name, item, command) \
+	static int name(struct file *file, const char __user *buffer,
unsigned long count, void *data) \
+	{ \
+		int len = count; \
+		unsigned char tmp[5]; \
+		struct psmouse *psmouse = (struct psmouse *)data; \
+		struct trackpoint_data *tp = (struct trackpoint_data*)psmouse->private; \
+		if(count > sizeof(tmp) - 1) \
+			len = sizeof(tmp) - 1; \
+		if(copy_from_user(tmp, buffer, len)) \
+			return -EFAULT; \
+		tmp[len] = '\0'; \
+		tp->item = simple_strtoul(tmp, 0, 10); \
+		trackpoint_write(&psmouse->ps2dev, command, tp->item); \
+		return len; \
+	}
+
+#define MAKE_PROC_TOGGLE(name, item, command, mask) \
+	static int name(struct file *file, const char __user *buffer,
unsigned long count, void *data) \
+	{ \
+		int len = count; \
+		unsigned char toggle, tmp[5]; \
+		struct psmouse *psmouse = (struct psmouse *)data; \
+		struct trackpoint_data *tp = (struct trackpoint_data*)psmouse->private; \
+		if(count > sizeof(tmp) - 1) \
+			len = sizeof(tmp) - 1; \
+		if(copy_from_user(tmp, buffer, len)) \
+			return -EFAULT; \
+		tmp[len] = '\0'; \
+		toggle = (tmp[0] == '1') ? 1 : 0; \
+		if( toggle != tp->item) { \
+			tp->item = toggle; \
+			trackpoint_toggle_bit(&psmouse->ps2dev, command, mask); \
+		} \
+		return len; \
+	}
+
+
+MAKE_PROC_WRITE(PROC_WRITE_NAME(sensitivity), sens, TP_SENS);
+MAKE_PROC_READ(PROC_READ_NAME(sensitivity), sens);
+
+MAKE_PROC_WRITE(PROC_WRITE_NAME(speed), speed, TP_SPEED);
+MAKE_PROC_READ(PROC_READ_NAME(speed), speed);
+
+MAKE_PROC_WRITE(PROC_WRITE_NAME(neg_inertia), inertia, TP_INERTIA);
+MAKE_PROC_READ(PROC_READ_NAME(neg_inertia), inertia);
+
+MAKE_PROC_WRITE(PROC_WRITE_NAME(backup), reach, TP_REACH);
+MAKE_PROC_READ(PROC_READ_NAME(backup), reach);
+
+MAKE_PROC_WRITE(PROC_WRITE_NAME(drag_hyst), draghys, TP_DRAGHYS);
+MAKE_PROC_READ(PROC_READ_NAME(drag_hyst), draghys);
+
+MAKE_PROC_WRITE(PROC_WRITE_NAME(min_drag), mindrag, TP_MINDRAG);
+MAKE_PROC_READ(PROC_READ_NAME(min_drag), mindrag);
+
+MAKE_PROC_WRITE(PROC_WRITE_NAME(thresh), thresh, TP_THRESH);
+MAKE_PROC_READ(PROC_READ_NAME(thresh), thresh);
+
+MAKE_PROC_WRITE(PROC_WRITE_NAME(up_thresh), up_thresh, TP_UP_THRESH);
+MAKE_PROC_READ(PROC_READ_NAME(up_thresh), up_thresh);
+
+MAKE_PROC_WRITE(PROC_WRITE_NAME(z_time), z_time, TP_Z_TIME);
+MAKE_PROC_READ(PROC_READ_NAME(z_time), z_time);
+
+MAKE_PROC_WRITE(PROC_WRITE_NAME(jenks_curv), jenks_curv, TP_JENKS_CURV);
+MAKE_PROC_READ(PROC_READ_NAME(jenks_curv), jenks_curv);
+
+MAKE_PROC_TOGGLE(PROC_TOGGLE_NAME(ptson), ptson, TP_TOGGLE_PTSON,
TP_MASK_PTSON);
+MAKE_PROC_READ(PROC_READ_NAME(ptson), ptson);
+
+MAKE_PROC_TOGGLE(PROC_TOGGLE_NAME(skip_back), skipback,
TP_TOGGLE_SKIPBACK, TP_MASK_SKIPBACK);
+MAKE_PROC_READ(PROC_READ_NAME(skip_back), skipback);
+
+MAKE_PROC_TOGGLE(PROC_TOGGLE_NAME(mb), mb, TP_TOGGLE_MB, TP_MASK_MB);
+MAKE_PROC_READ(PROC_READ_NAME(mb), mb);
+
+MAKE_PROC_TOGGLE(PROC_TOGGLE_NAME(ext_dev), ext_dev,
TP_TOGGLE_EXT_DEV, TP_MASK_EXT_DEV);
+MAKE_PROC_READ(PROC_READ_NAME(ext_dev), ext_dev);
+
+/* MAKE_PROC_WRITE( ) for Soft Transparent mode */
+static int transparent_write_func(struct file *file, const char
__user *buffer, unsigned long count, void *data)
+{
+	int len = count;
+	unsigned char command;
+	unsigned char tmp[5];
+	struct psmouse *psmouse = (struct psmouse *)data;
+	struct trackpoint_data *tp = (struct trackpoint_data*)psmouse->private;
+	if(count > sizeof(tmp) - 1)
+		len = sizeof(tmp) - 1;
+	if(copy_from_user(tmp, buffer, len))
+		return -EFAULT;
+	tmp[len] = '\0'; \
+	tp->transparent = simple_strtoul(tmp, 0, 10);
+	command = (tp->transparent) ? TP_SET_SOFT_TRANS : TP_CANCEL_SOFT_TRANS;
+
+	trackpoint_command(&psmouse->ps2dev, command);
+	return len;
+}
+
+MAKE_PROC_READ(PROC_READ_NAME(transparent), transparent);
+
+/* MAKE_PROC_WRITE( ) for Middle Button Scroll mode */
+static int scroll_write_func(struct file *file, const char __user
*buffer, unsigned long count, void *data)
+{
+	int len = count;
+	unsigned char tmp[5];
+	struct psmouse *psmouse = (struct psmouse *)data;
+	struct trackpoint_data *tp = (struct trackpoint_data*)psmouse->private;
+	if(count > sizeof(tmp) - 1)
+		len = sizeof(tmp) - 1;
+	if(copy_from_user(tmp, buffer, len))
+		return -EFAULT;
+	tmp[len] = '\0'; \
+	tp->mb_scroll = simple_strtoul(tmp, 0, 10);
+
+	return len;
+}
+
+MAKE_PROC_READ(PROC_READ_NAME(scroll), mb_scroll);
+
+/* MAKE_PROC_WRITE( ) for delay before scroll */
+static int scroll_delay_write_func(struct file *file, const char
__user *buffer, unsigned long count, void *data)
+{
+        int len = count;
+        unsigned char tmp[5];
+        struct psmouse *psmouse = (struct psmouse *)data;
+        struct trackpoint_data *tp = (struct trackpoint_data*)psmouse->private;
+        if(count > sizeof(tmp) - 1)
+                len = sizeof(tmp) - 1;
+        if(copy_from_user(tmp, buffer, len))
+                return -EFAULT;
+        tmp[len] = '\0'; \
+        tp->scroll_delay = simple_strtoul(tmp, 0, 10);
+
+        return len;
+}
+
+MAKE_PROC_READ(PROC_READ_NAME(scroll_delay), scroll_delay);
+
+
+
+#define NEW_PROC_ENTRY(name) \
+        entry = create_proc_entry(#name, 0644, tp_dir); \
+        if(!entry) \
+                goto no_##name; \
+        entry->owner = THIS_MODULE; \
+        entry->data = psmouse; \
+        entry->read_proc = PROC_READ_NAME(name); \
+        entry->write_proc = PROC_WRITE_NAME(name);
+
+
+#define NEW_PROC_TOGGLE_ENTRY(name) \
+        entry = create_proc_entry(#name, 0644, tp_dir); \
+        if(!entry) \
+                goto no_##name; \
+        entry->owner = THIS_MODULE; \
+        entry->data = psmouse; \
+        entry->read_proc = PROC_READ_NAME(name); \
+        entry->write_proc = PROC_TOGGLE_NAME(name);
+	
+
+
+static struct proc_dir_entry *tp_dir = NULL;
+
+
+static int trackpoint_proc_init(struct psmouse *psmouse) 
+{ 
+	struct proc_dir_entry *entry = NULL;
+
+	tp_dir = proc_mkdir("trackpoint", NULL);
+	if(!tp_dir) 
+		return -ENOMEM;
+
+	tp_dir->owner = THIS_MODULE;
+
+	NEW_PROC_ENTRY(sensitivity);
+	NEW_PROC_ENTRY(speed);
+	NEW_PROC_ENTRY(neg_inertia);
+	NEW_PROC_ENTRY(backup);
+	NEW_PROC_ENTRY(drag_hyst);
+	NEW_PROC_ENTRY(min_drag);
+	NEW_PROC_ENTRY(thresh);
+	NEW_PROC_ENTRY(up_thresh);
+	NEW_PROC_ENTRY(z_time);
+	NEW_PROC_ENTRY(jenks_curv);
+
+	NEW_PROC_TOGGLE_ENTRY(ptson);
+	NEW_PROC_TOGGLE_ENTRY(skip_back);
+	NEW_PROC_TOGGLE_ENTRY(mb);
+	NEW_PROC_TOGGLE_ENTRY(ext_dev);
+
+	/* Soft Transparent mode isn't a toggle or a single
+	 * command used to read/write the value
+	 */
+        entry = create_proc_entry("transparent", 0644, tp_dir);
+        if(!entry)
+                goto no_transparent;
+        entry->owner = THIS_MODULE;
+        entry->data = psmouse;
+        entry->read_proc = transparent_read_func;
+        entry->write_proc = transparent_write_func;
+
+        entry = create_proc_entry("scroll", 0644, tp_dir);
+        if(!entry)
+                goto no_scroll;
+        entry->owner = THIS_MODULE;
+        entry->data = psmouse;
+        entry->read_proc = scroll_read_func;
+        entry->write_proc = scroll_write_func;
+
+        entry = create_proc_entry("scroll_delay", 0644, tp_dir);
+        if(!entry)
+                goto no_scroll_delay;
+        entry->owner = THIS_MODULE;
+        entry->data = psmouse;
+        entry->read_proc = scroll_delay_read_func;
+        entry->write_proc = scroll_delay_write_func;
+
+	return 0;
+
+no_scroll_delay:
+        remove_proc_entry("scroll_delay", tp_dir);
+
+no_scroll:
+	remove_proc_entry("transparent", tp_dir);
+
+no_transparent:
+	remove_proc_entry("ext_dev", tp_dir);
+
+no_ext_dev:
+	remove_proc_entry("mb", tp_dir);
+
+no_mb:
+	remove_proc_entry("skip_back", tp_dir);
+
+no_skip_back:
+	remove_proc_entry("ptson", tp_dir);
+
+no_ptson:
+	remove_proc_entry("jenks_curv", tp_dir);
+
+no_jenks_curv:
+	remove_proc_entry("z_time", tp_dir);
+
+no_z_time:
+	remove_proc_entry("up_thresh", tp_dir);
+
+no_up_thresh:
+	remove_proc_entry("thresh", tp_dir);
+
+no_thresh:
+	remove_proc_entry("min_drag", tp_dir);
+
+no_min_drag:
+	remove_proc_entry("drag_hyst", tp_dir);
+
+no_drag_hyst:
+	remove_proc_entry("backup", tp_dir);
+
+no_backup:
+	remove_proc_entry("neg_inertia", tp_dir);
+
+no_neg_inertia:
+	remove_proc_entry("speed", tp_dir);
+
+no_speed:
+	remove_proc_entry("sensitivity", tp_dir);
+
+no_sensitivity:
+	remove_proc_entry("trackpoint", NULL);
+
+	return -ENOMEM;
+}
+
+static void trackpoint_proc_remove(void)
+{
+        remove_proc_entry("scroll_delay", tp_dir);
+        remove_proc_entry("scroll", tp_dir);
+        remove_proc_entry("transparent", tp_dir);
+        remove_proc_entry("ext_dev", tp_dir);
+        remove_proc_entry("mb", tp_dir);
+        remove_proc_entry("skip_back", tp_dir);
+        remove_proc_entry("ptson", tp_dir);
+        remove_proc_entry("jenks_curv", tp_dir);
+        remove_proc_entry("z_time", tp_dir);
+        remove_proc_entry("up_thresh", tp_dir);
+        remove_proc_entry("thresh", tp_dir);
+        remove_proc_entry("min_drag", tp_dir);
+        remove_proc_entry("drag_hyst", tp_dir);
+        remove_proc_entry("backup", tp_dir);
+        remove_proc_entry("neg_inertia", tp_dir);
+        remove_proc_entry("speed", tp_dir);
+        remove_proc_entry("sensitivity", tp_dir);
+        remove_proc_entry("trackpoint", NULL);
+}
+
+#else
+static int trackpoint_proc_init(struct psmouse *psmouse) { return 0; }
+static void trackpoint_proc_remove(void) { }
+#endif
+
+
+/* This is much cleaner now, it probably could be better.
+ * The only thing left here is to make the scroll feature more gradual.
+ */
+
+void trackpoint_sim_scroll(struct psmouse *psmouse)
+{
+	int diff;
+	struct trackpoint_data *tp = psmouse->private;
+	unsigned char *packet = psmouse->packet;
+
+	if(!tp->mb_scroll)
+		return;
+
+	if( ((packet[0] >> 2) & 1) == 0 ) {
+
+		if(tp->mb_was_down &&
+		   time_after(tp->last_mb_press +
msecs_to_jiffies(tp->scroll_delay), jiffies)) {
+
+			/* This doesn't seem to get processed until the next
+			 * mouse move.
+			 */
+			input_report_key(&psmouse->dev, BTN_MIDDLE, 1);
+
+			input_sync(&psmouse->dev);
+		}
+
+		tp->scrolling = 0;
+		tp->mb_was_down = 0;
+	}
+        else if(tp->scrolling) {
+
+		/* Vertical scrolling */
+		diff = (int) ((packet[0] << 3) & 0x100) - (int) packet[2];
+                if( diff < -2 ) {
+			input_report_rel(&psmouse->dev, REL_WHEEL, 1);
+		}
+		else if(diff > 2) {
+			input_report_rel(&psmouse->dev, REL_WHEEL, -1);
+		}
+
+                /* Horizontal scrolling */
+                diff = (int) packet[1] - (int) ((packet[0] << 4) & 0x100);
+                if( diff < -2) {
+                        input_report_rel(&psmouse->dev, REL_HWHEEL, 1);
+                }
+                else if( diff > 2) {
+                        input_report_rel(&psmouse->dev, REL_HWHEEL, -1);
+                }
+
+		packet[1] &= 0x00;
+		packet[2] &= 0x00;
+	}
+	else {
+                /* Middle button is down, but we aren't scrolling */
+                if( time_after_eq(jiffies, tp->last_mb_press +
msecs_to_jiffies(tp->scroll_delay)) )
+                        tp->scrolling = 1;
+
+                tp->last_mb_press = jiffies;
+                tp->mb_was_down = 1;
+	}
+
+	/* Suppress the key event from entering the queue */
+	packet[0] &= 0xFB;
+}
+
+void trackpoint_disconnect(struct psmouse *psmouse)
+{
+	trackpoint_proc_remove();
+	kfree(psmouse->private);
+}
+
+int trackpoint_reconnect(struct psmouse *psmouse)
+{
+	unsigned char toggle;
+	struct trackpoint_data *tp = psmouse->private;
+
+	/* Push the config to the device */
+	
+	trackpoint_write(&psmouse->ps2dev, TP_SENS, tp->sens);
+	trackpoint_write(&psmouse->ps2dev, TP_INERTIA, tp->inertia);
+	trackpoint_write(&psmouse->ps2dev, TP_SPEED, tp->speed);
+
+	trackpoint_write(&psmouse->ps2dev, TP_REACH, tp->reach);
+	trackpoint_write(&psmouse->ps2dev, TP_DRAGHYS, tp->draghys);
+	trackpoint_write(&psmouse->ps2dev, TP_MINDRAG, tp->mindrag);
+
+	trackpoint_write(&psmouse->ps2dev, TP_THRESH, tp->thresh);
+	trackpoint_write(&psmouse->ps2dev, TP_UP_THRESH, tp->up_thresh);
+
+	trackpoint_write(&psmouse->ps2dev, TP_Z_TIME, tp->z_time);
+	trackpoint_write(&psmouse->ps2dev, TP_JENKS_CURV, tp->jenks_curv);
+
+
+	trackpoint_read(&psmouse->ps2dev, TP_TOGGLE_PTSON, &toggle);
+	if(((toggle & TP_MASK_PTSON) == TP_MASK_PTSON)!= tp->ptson)
+		 trackpoint_toggle_bit(&psmouse->ps2dev, TP_TOGGLE_PTSON, TP_MASK_PTSON);
+
+	trackpoint_read(&psmouse->ps2dev, TP_TOGGLE_MB, &toggle);
+	if(((toggle & TP_MASK_MB) == TP_MASK_MB) != tp->mb)
+		 trackpoint_toggle_bit(&psmouse->ps2dev, TP_TOGGLE_MB, TP_MASK_MB);
+
+	trackpoint_read(&psmouse->ps2dev, TP_TOGGLE_TWOHAND, &toggle);
+	if(((toggle & TP_MASK_TWOHAND) == TP_MASK_TWOHAND) != tp->twohand)
+		trackpoint_toggle_bit(&psmouse->ps2dev, TP_TOGGLE_TWOHAND, TP_MASK_TWOHAND);
+
+	trackpoint_read(&psmouse->ps2dev, TP_TOGGLE_SKIPBACK, &toggle);
+	if(((toggle & TP_MASK_SKIPBACK) == TP_MASK_SKIPBACK) != tp->skipback)
+		trackpoint_toggle_bit(&psmouse->ps2dev, TP_TOGGLE_SKIPBACK,
TP_MASK_SKIPBACK);
+
+	trackpoint_read(&psmouse->ps2dev, TP_TOGGLE_MB, &toggle);
+	if(((toggle & TP_MASK_MB) == TP_MASK_MB) != tp->mb)
+		trackpoint_toggle_bit(&psmouse->ps2dev, TP_TOGGLE_MB, TP_MASK_MB);
+
+	trackpoint_read(&psmouse->ps2dev, TP_TOGGLE_SOURCE_TAG, &toggle);
+	if(((toggle & TP_MASK_SOURCE_TAG) == TP_MASK_SOURCE_TAG) != tp->source_tag)
+		trackpoint_toggle_bit(&psmouse->ps2dev, TP_TOGGLE_SOURCE_TAG,
TP_MASK_SOURCE_TAG);
+
+	trackpoint_read(&psmouse->ps2dev, TP_TOGGLE_EXT_DEV, &toggle);
+	if(((toggle & TP_MASK_EXT_DEV) == TP_MASK_EXT_DEV) != tp->skipback)
+		trackpoint_toggle_bit(&psmouse->ps2dev, TP_TOGGLE_EXT_DEV, TP_MASK_EXT_DEV);
+
+	return 0;
+}
+
+static void trackpoint_defaults(struct trackpoint_data *tp)
+{
+	tp->ptson = tp_ptson;
+	tp->sens = tp_sens;
+	tp->speed = tp_speed;
+	tp->reach = tp_reach;
+
+	tp->draghys = tp_draghys;
+	tp->mindrag = tp_mindrag;
+
+	tp->thresh = tp_thresh;
+	tp->up_thresh = tp_upthresh;
+
+	tp->z_time = tp_ztime;
+	tp->jenks_curv = tp_jenks;
+
+	tp->mb = tp_mb;
+	tp->mb_scroll = tp_mb_scroll;
+
+	/* The following can't be set via module parameters */
+	tp->inertia = TP_DEF_INERTIA;
+	tp->skipback = TP_DEF_SKIPBACK;
+	tp->ext_dev = TP_DEF_EXT_DEV;
+	tp->scroll_delay = TP_DEF_SCROLL_DELAY;
+
+	tp->scrolling = tp->mb_was_down = 0;
+	tp->xacc = tp->yacc = 0;
+}
+
+
+
+int trackpoint_init(struct psmouse *psmouse)
+{
+	unsigned char param[2];
+	struct trackpoint_data *priv;
+	struct ps2dev *ps2dev = &psmouse->ps2dev;
+
+	param[0] = param[1] = 0;
+
+	/* The real driver disables, queries and 
+	   then enables so we'll do that too
+	*/
+	ps2_command(ps2dev, NULL, PSMOUSE_CMD_RESET_DIS);
+
+	ps2_command(ps2dev, NULL, MAKE_PS2_CMD(0, 0, TP_DISABLE));
+	ps2_command(ps2dev, NULL, MAKE_PS2_CMD(0, 0, TP_DISABLE_EXT));
+
+	ps2_command(ps2dev, param, MAKE_PS2_CMD(0, 2, TP_READ_ID));
+
+	if(param[0] != TP_MAGIC_IDENT) 
+		return -1;
+
+	ps2_command(ps2dev, NULL, MAKE_PS2_CMD(0, 0, TP_ENABLE_EXT));
+	ps2_command(ps2dev, NULL, MAKE_PS2_CMD(0, 0, TP_ENABLE));
+
+	psmouse->private = priv = kmalloc(sizeof(struct trackpoint_data), GFP_KERNEL);
+
+	if(!priv) 
+		return -1;
+
+	memset(priv, 0, sizeof(struct trackpoint_data));
+
+	priv->firmware_id = param[1];
+	trackpoint_defaults(priv);
+
+	trackpoint_reconnect(psmouse);
+	trackpoint_proc_init(psmouse);
+
+
+	/* Used to simulate wheel scrolling */
+	set_bit(REL_HWHEEL, psmouse->dev.relbit);
+	set_bit(REL_WHEEL, psmouse->dev.relbit);
+
+	psmouse->model = PSMOUSE_TRACKPOINT;
+
+	psmouse->reconnect = trackpoint_reconnect;
+	psmouse->disconnect = trackpoint_disconnect;
+
+	printk("IBM TrackPoint firmware: 0x%02X\n", param[1]);
+
+	return 0;
+}
+
diff -uNr a/drivers/input/mouse/trackpoint.h b/drivers/input/mouse/trackpoint.h
--- a/drivers/input/mouse/trackpoint.h	1969-12-31 19:00:00.000000000 -0500
+++ b/drivers/input/mouse/trackpoint.h	2005-02-03 17:29:42.000000000 -0500
@@ -0,0 +1,170 @@
+/*
+ * IBM TrackPoint PS/2 mouse driver
+ *
+ * Stephen Evanchik <evanchsa@clarkson.edu>
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 as published by
+ * the Free Software Foundation.
+ */
+
+#ifndef _TRACKPOINT_H
+#define _TRACKPOINT_H
+
+/*
+ * These constants are from the TrackPoint System
+ * Engineering documentation Version 4 from IBM Watson
+ * research:
+ * 	http://wwwcssrv.almaden.ibm.com/trackpoint/download.html
+ */
+
+#define TP_DISABLE	(0xF5)
+#define TP_ENABLE	(0xF4)
+
+#define TP_READ_ID	(0xE1)	/* Sent for device identification */
+#define TP_MAGIC_IDENT	(0x01)	/* Sent after a TP_READ_ID followed */
+				/* by the firmware ID */
+													
+#define TP_COMMAND	(0xE2)	/* Commands start with this */
+
+
+/*
+ * Commands
+ */
+#define TP_RECALIB	(0x51)	/* Recalibrate */
+#define TP_POWER_DOWN	(0x44)	/* Can only be undone through HW reset */
+#define TP_EXT_DEV	(0x21)	/* Determines if external device is connected (RO) */
+#define TP_EXT_BTN	(0x4B)	/* Read extended button status */
+#define TP_POR		(0x7F)	/* Execute Power on Reset */
+#define TP_POR_RESULTS	(0x25)	/* Read Power on Self test results */
+#define TP_DISABLE_EXT	(0x40)	/* Disable external pointing device */
+#define TP_ENABLE_EXT	(0x41)	/* Enable external pointing device */
+
+/*
+ * Mode manipulation
+ */
+#define TP_SET_SOFT_TRANS (0x4E) /* Set mode */
+#define TP_CANCEL_SOFT_TRANS (0xB9) /* Cancel mode */
+#define TP_SET_HARD_TRANS (0x45) /* Mode can only be set */
+
+
+/*
+ * Register oriented commands/properties
+ */
+#define TP_WRITE_MEM	(0x81)
+#define TP_READ_MEM	(0x80)	/* Not used in this implementation */
+
+/*
+* RAM Locations for properties
+ */
+#define TP_SENS		(0x4A)	/* Sensitivity */
+#define TP_MB 		(0x4C)	/* Read Middle Button Status (RO) */
+#define TP_INERTIA	(0x4D)	/* Negative Inertia */
+#define TP_SPEED	(0x60)	/* Speed of TP Cursor */
+#define TP_REACH	(0x57)	/* Backup for Z-axis press */
+#define TP_DRAGHYS	(0x58)	/* Drag Hysteresis */
+				/* (how hard it is to drag */
+				/* with Z-axis pressed) */
+
+#define TP_MINDRAG	(0x59)	/* Minimum amount of force needed */
+				/* to trigger dragging */
+
+#define TP_THRESH	(0x5C)	/* Minimum value for a Z-axis press */
+#define TP_UP_THRESH	(0x5A)	/* Used to generate a 'click' on Z-axis */
+#define TP_Z_TIME	(0x5E)	/* How sharp of a press */
+#define TP_JENKS_CURV	(0x5D)	/* Minimum curvature for double click */
+
+/*
+ * Toggling Flag bits
+ */
+#define TP_TOGGLE (0x47) /* Toggle command */
+
+#define TP_TOGGLE_MB		(0x23)	/* Disable/Enable Middle Button */
+#define TP_TOGGLE_DRIFT		(0x23)	/* Drift Correction */
+#define TP_TOGGLE_BURST		(0x28)	/* Burst Mode */
+#define TP_TOGGLE_PTSON		(0x2C)	/* Press to Select */
+#define TP_TOGGLE_HARD_TRANS	(0x2C)	/* Alternate method to set Hard
Transparency */
+#define TP_TOGGLE_TWOHAND	(0x2D)	/* Two handed */
+#define TP_TOGGLE_STICKY_TWO	(0x2D)	/* Sticky two handed */
+#define TP_TOGGLE_SKIPBACK	(0x2D)	/* Suppress movement */
+					/* after drag release */
+#define TP_TOGGLE_EXT_DEV	(0x23)  /* Toggle external device */
+#define TP_TOGGLE_SOURCE_TAG	(0x20)  /* Bit 3 of the first packet
will be set to
+					   to the origin of the packet (external or TP) */
+
+/*
+ * Various makses for registers 
+ * XOR'd to current contents for new value
+ */
+#define TP_MASK_PTSON		(0x01)
+#define TP_MASK_SKIPBACK	(0x08)
+#define TP_MASK_TWOHAND		(0x01)
+#define TP_MASK_STICKY_TWO	(0x04)
+#define TP_MASK_HARD_TRANS	(0x80)
+#define TP_MASK_BURST		(0x80)
+#define TP_MASK_MB		(0x01)
+#define TP_MASK_DRIFT		(0x80)
+#define TP_MASK_EXT_DEV		(0x02)
+#define TP_MASK_SOURCE_TAG	(0x80)
+
+/* Power on Self Test Results */
+#define TP_POR_SUCCESS		(0x3B)
+
+/*
+ * Default power on values
+ */
+#define TP_DEF_SENS	(0x80)
+#define TP_DEF_INERTIA	(0x06)
+#define TP_DEF_SPEED	(0x61)
+#define TP_DEF_REACH	(0x0A)
+
+#define TP_DEF_DRAGHYS   (0xFF)
+#define TP_DEF_MINDRAG	 (0x14)
+
+#define TP_DEF_THRESH     (0x08)
+#define TP_DEF_UP_THRESH  (0xFF)
+#define TP_DEF_Z_TIME     (0x26)
+#define TP_DEF_JENKS_CURV (0x87)
+
+/* Toggles */
+#define TP_DEF_MB	 (0x00)
+#define TP_DEF_PTSON	 (0x00)
+#define TP_DEF_SKIPBACK  (0x00)
+#define TP_DEF_EXT_DEV   (0x01)
+#define TP_DEF_MB_SCROLL (0x00)
+#define TP_DEF_SCROLL_DELAY (200)
+
+#define MAKE_PS2_CMD(params, results, cmd) ((params<<12) |
(results<<8) | (cmd))
+
+#define PSMOUSE_TRACKPOINT 42
+#define Z_ACCEL_EXP	1.2
+#define Z_ACCEL_MULT	0.02
+
+
+struct trackpoint_data
+{
+	unsigned char firmware_id;
+
+	unsigned char sens, speed, inertia, reach;
+	unsigned char draghys, mindrag;
+	unsigned char thresh, up_thresh;
+	unsigned char z_time, jenks_curv;
+
+	unsigned char ptson; /* Press to Select */
+	unsigned char twohand, skipback;
+	unsigned char mb;
+
+	unsigned char ext_dev;
+	unsigned char transparent;
+	unsigned char source_tag;
+
+	unsigned char mb_scroll, mb_was_down, scrolling;
+	unsigned long scroll_delay, last_mb_press;
+
+	int xacc, yacc;
+};
+
+extern int trackpoint_init (struct psmouse *psmouse);
+extern void trackpoint_sim_scroll(struct psmouse *psmouse);
+
+#endif /* _TRACKPOINT_H */

^ permalink raw reply	[flat|nested] 24+ messages in thread

* Re: [PATCH 2.6.11-rc3] IBM Trackpoint support
  2005-02-03 22:43 [PATCH 2.6.11-rc3] IBM Trackpoint support Stephen Evanchik
@ 2005-02-04  0:34 ` Dmitry Torokhov
  2005-02-04  3:52   ` Dmitry Torokhov
  2005-02-04  6:35   ` Vojtech Pavlik
  2005-02-05 10:44 ` Pavel Machek
  2005-02-06 20:17 ` Domen Puncer
  2 siblings, 2 replies; 24+ messages in thread
From: Dmitry Torokhov @ 2005-02-04  0:34 UTC (permalink / raw)
  To: Stephen Evanchik; +Cc: Vojtech Pavlik, linux-kernel

On Thursday 03 February 2005 17:43, Stephen Evanchik wrote:
> Vojtech,
> 
> Here is a patch that exposes the IBM TrackPoint's extended properties
> as well as scroll wheel emulation.
> 
> 

Hi,

Very nice although I have a couple of comments.

>  /*
> + * Try to initialize the IBM TrackPoint
> + */
> +	if (max_proto > PSMOUSE_PS2 && trackpoint_init(psmouse) == 0) {
> +		psmouse->vendor = "IBM";
> +		psmouse->name = "TrackPoint";
> + 
> +		return PSMOUSE_PS2;

Why PSMOUSE_PS2? Reconnect will surely not like it.

> +int tp_sens = TP_DEF_SENS;
> +module_param_named(sens, tp_sens, uint, 0);
> +MODULE_PARM_DESC(sens, "Sensitivity");
....
> +int tp_mb_scroll = TP_DEF_MB_SCROLL;
> +module_param_named(mb_scroll, tp_mb_scroll, uint, 0);
> +MODULE_PARM_DESC(mb_scroll, "Scroll with middle button");

All of this should be handled via sysfs dynamically, we don't need any
more pmouse module parameters.

> +__obsolete_setup("pts=");
> +__obsolete_setup("backup=");
> +__obsolete_setup("draghyst=");

What are these? They can't be obsolete as the module has never been part
of the vanilla kernel.

> +
> +/*
> + * Device IO: read, write and toggle bit
> + */
> +static void trackpoint_command(struct ps2dev *ps2dev, unsigned char cmd)
> +{	
> +	ps2_command(ps2dev, NULL, MAKE_PS2_CMD(0, 0, TP_COMMAND));
> +	ps2_command(ps2dev, NULL, MAKE_PS2_CMD(0, 0, cmd));
> +}
> +

Error checking would be nice.

> +
> +#ifdef CONFIG_PROC_FS
...
> +{
> +        remove_proc_entry("scroll_delay", tp_dir);
> +        remove_proc_entry("scroll", tp_dir);
> +        remove_proc_entry("transparent", tp_dir);
> +        remove_proc_entry("ext_dev", tp_dir);
> +        remove_proc_entry("mb", tp_dir);
> +        remove_proc_entry("skip_back", tp_dir);
> +        remove_proc_entry("ptson", tp_dir);
> +        remove_proc_entry("jenks_curv", tp_dir);
> +        remove_proc_entry("z_time", tp_dir);
> +        remove_proc_entry("up_thresh", tp_dir);
> +        remove_proc_entry("thresh", tp_dir);
> +        remove_proc_entry("min_drag", tp_dir);
> +        remove_proc_entry("drag_hyst", tp_dir);
> +        remove_proc_entry("backup", tp_dir);
> +        remove_proc_entry("neg_inertia", tp_dir);
> +        remove_proc_entry("speed", tp_dir);
> +        remove_proc_entry("sensitivity", tp_dir);
> +        remove_proc_entry("trackpoint", NULL);
> +}

No new proc stuff please (it will be visible from sysfs when you redo the
module parameters).

> +
> +		tp->scrolling = 0;
> +		tp->mb_was_down = 0;
> +	}
> +        else if(tp->scrolling) {
> +
> +		/* Vertical scrolling */
> +		diff = (int) ((packet[0] << 3) & 0x100) - (int) packet[2];
> +                if( diff < -2 ) {
> +			input_report_rel(&psmouse->dev, REL_WHEEL, 1);
> +		}
> +		else if(diff > 2) {
> +			input_report_rel(&psmouse->dev, REL_WHEEL, -1);
> +		}
> +
> +                /* Horizontal scrolling */
> +                diff = (int) packet[1] - (int) ((packet[0] << 4) & 0x100);
> +                if( diff < -2) {
> +                        input_report_rel(&psmouse->dev, REL_HWHEEL, 1);
> +                }
> +                else if( diff > 2) {
> +                        input_report_rel(&psmouse->dev, REL_HWHEEL, -1);
> +                }
> +
> +		packet[1] &= 0x00;
> +		packet[2] &= 0x00;
> +	}

Looks like whitespace damage (tabs vs spaces) plus it should be "} else {"
on one line.

> +int trackpoint_reconnect(struct psmouse *psmouse)
> +{
> +	unsigned char toggle;
> +	struct trackpoint_data *tp = psmouse->private;
> +
> +	/* Push the config to the device */
> +	

I'd like to verify that it still recognized as trackpoint - suspends often
play tricks on PS/2 devices.

> +
> +	printk("IBM TrackPoint firmware: 0x%02X\n", param[1]);

KERN_INFO?


-- 
Dmitry

^ permalink raw reply	[flat|nested] 24+ messages in thread

* Re: [PATCH 2.6.11-rc3] IBM Trackpoint support
  2005-02-04  0:34 ` Dmitry Torokhov
@ 2005-02-04  3:52   ` Dmitry Torokhov
  2005-02-04  4:39     ` Stephen Evanchik
  2005-02-13 19:13     ` Stephen Evanchik
  2005-02-04  6:35   ` Vojtech Pavlik
  1 sibling, 2 replies; 24+ messages in thread
From: Dmitry Torokhov @ 2005-02-04  3:52 UTC (permalink / raw)
  To: Stephen Evanchik; +Cc: Vojtech Pavlik, linux-kernel

On Thursday 03 February 2005 19:34, Dmitry Torokhov wrote:
> On Thursday 03 February 2005 17:43, Stephen Evanchik wrote:
> > Vojtech,
> > 
> > Here is a patch that exposes the IBM TrackPoint's extended properties
> > as well as scroll wheel emulation.
> > 
> > 
> 
> Hi,
> 
> Very nice although I have a couple of comments.
> 
> >  /*
> > + * Try to initialize the IBM TrackPoint
> > + */
> > +	if (max_proto > PSMOUSE_PS2 && trackpoint_init(psmouse) == 0) {
> > +		psmouse->vendor = "IBM";
> > +		psmouse->name = "TrackPoint";
> > + 
> > +		return PSMOUSE_PS2;
> 
> Why PSMOUSE_PS2? Reconnect will surely not like it.
>

OK, I have read the code once again, and saw that you have special
handling within PS/2 protocol based on model constant. Please set
psmouse type to PSMOUSE_TRACKPOINT instead of model and provide full
protocol handler, like ALPS, Synaptics and Logitech do. Trackpoint
is different and complex enough to warrant it.

-- 
Dmitry

^ permalink raw reply	[flat|nested] 24+ messages in thread

* Re: [PATCH 2.6.11-rc3] IBM Trackpoint support
  2005-02-04  3:52   ` Dmitry Torokhov
@ 2005-02-04  4:39     ` Stephen Evanchik
  2005-02-13 19:13     ` Stephen Evanchik
  1 sibling, 0 replies; 24+ messages in thread
From: Stephen Evanchik @ 2005-02-04  4:39 UTC (permalink / raw)
  To: Dmitry Torokhov; +Cc: Vojtech Pavlik, linux-kernel

On Thu, 3 Feb 2005 22:52:44 -0500, Dmitry Torokhov
<dtor_core@ameritech.net> wrote:
> OK, I have read the code once again, and saw that you have special
> handling within PS/2 protocol based on model constant. Please set
> psmouse type to PSMOUSE_TRACKPOINT instead of model and provide full
> protocol handler, like ALPS, Synaptics and Logitech do. Trackpoint
> is different and complex enough to warrant it.

Thanks, I've made all the changes suggested and I'll incorporate this
too. I'll send a new patch at the end of the weekend when I get back.


Stephen

^ permalink raw reply	[flat|nested] 24+ messages in thread

* Re: [PATCH 2.6.11-rc3] IBM Trackpoint support
  2005-02-04  0:34 ` Dmitry Torokhov
  2005-02-04  3:52   ` Dmitry Torokhov
@ 2005-02-04  6:35   ` Vojtech Pavlik
  2005-02-04  6:46     ` Fabio Massimo Di Nitto
                       ` (2 more replies)
  1 sibling, 3 replies; 24+ messages in thread
From: Vojtech Pavlik @ 2005-02-04  6:35 UTC (permalink / raw)
  To: Dmitry Torokhov; +Cc: Stephen Evanchik, linux-kernel

On Thu, Feb 03, 2005 at 07:34:16PM -0500, Dmitry Torokhov wrote:
> On Thursday 03 February 2005 17:43, Stephen Evanchik wrote:
> > Vojtech,
> > 
> > Here is a patch that exposes the IBM TrackPoint's extended properties
> > as well as scroll wheel emulation.
> > 
> > 
> 
> Hi,
> 
> Very nice although I have a couple of comments.
> 
> >  /*
> > + * Try to initialize the IBM TrackPoint
> > + */
> > +	if (max_proto > PSMOUSE_PS2 && trackpoint_init(psmouse) == 0) {
> > +		psmouse->vendor = "IBM";
> > +		psmouse->name = "TrackPoint";
> > + 
> > +		return PSMOUSE_PS2;
> 
> Why PSMOUSE_PS2? Reconnect will surely not like it.

Indeed. IIRC this patch killed wheel mouse detection in ubuntu.

> 
> > +int tp_sens = TP_DEF_SENS;
> > +module_param_named(sens, tp_sens, uint, 0);
> > +MODULE_PARM_DESC(sens, "Sensitivity");
> ....
> > +int tp_mb_scroll = TP_DEF_MB_SCROLL;
> > +module_param_named(mb_scroll, tp_mb_scroll, uint, 0);
> > +MODULE_PARM_DESC(mb_scroll, "Scroll with middle button");
> 
> All of this should be handled via sysfs dynamically, we don't need any
> more pmouse module parameters.

Exactly.

> > +        remove_proc_entry("neg_inertia", tp_dir);
> > +        remove_proc_entry("speed", tp_dir);
> > +        remove_proc_entry("sensitivity", tp_dir);
> > +        remove_proc_entry("trackpoint", NULL);
> > +}
> 
> No new proc stuff please (it will be visible from sysfs when you redo the
> module parameters).

... automatically, even ...

> > +
> > +		tp->scrolling = 0;
> > +		tp->mb_was_down = 0;
> > +	}
> > +        else if(tp->scrolling) {
> > +
> > +		/* Vertical scrolling */
> > +		diff = (int) ((packet[0] << 3) & 0x100) - (int) packet[2];
> > +                if( diff < -2 ) {
> > +			input_report_rel(&psmouse->dev, REL_WHEEL, 1);
> > +		}
> > +		else if(diff > 2) {
> > +			input_report_rel(&psmouse->dev, REL_WHEEL, -1);
> > +		}
> > +
> > +                /* Horizontal scrolling */
> > +                diff = (int) packet[1] - (int) ((packet[0] << 4) & 0x100);
> > +                if( diff < -2) {
> > +                        input_report_rel(&psmouse->dev, REL_HWHEEL, 1);
> > +                }
> > +                else if( diff > 2) {
> > +                        input_report_rel(&psmouse->dev, REL_HWHEEL, -1);
> > +                }
> > +
> > +		packet[1] &= 0x00;
> > +		packet[2] &= 0x00;
> > +	}
> 
> Looks like whitespace damage (tabs vs spaces) plus it should be "} else {"
> on one line.

What a shame that this thing doesn't have a raw mode where it'd report
the pressure ...

> > +int trackpoint_reconnect(struct psmouse *psmouse)
> > +{
> > +	unsigned char toggle;
> > +	struct trackpoint_data *tp = psmouse->private;
> > +
> > +	/* Push the config to the device */
> > +	
> 
> I'd like to verify that it still recognized as trackpoint - suspends often
> play tricks on PS/2 devices.
> 
> > +
> > +	printk("IBM TrackPoint firmware: 0x%02X\n", param[1]);
> 
> KERN_INFO?

-- 
Vojtech Pavlik
SuSE Labs, SuSE CR

^ permalink raw reply	[flat|nested] 24+ messages in thread

* Re: [PATCH 2.6.11-rc3] IBM Trackpoint support
  2005-02-04  6:35   ` Vojtech Pavlik
@ 2005-02-04  6:46     ` Fabio Massimo Di Nitto
  2005-02-04  6:52     ` Dmitry Torokhov
  2005-02-04 13:17     ` Stephen Evanchik
  2 siblings, 0 replies; 24+ messages in thread
From: Fabio Massimo Di Nitto @ 2005-02-04  6:46 UTC (permalink / raw)
  To: Vojtech Pavlik; +Cc: Dmitry Torokhov, Stephen Evanchik, linux-kernel

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Vojtech Pavlik wrote:
| On Thu, Feb 03, 2005 at 07:34:16PM -0500, Dmitry Torokhov wrote:
|
|>On Thursday 03 February 2005 17:43, Stephen Evanchik wrote:
|>
|>>Vojtech,
|>>
|>>Here is a patch that exposes the IBM TrackPoint's extended properties
|>>as well as scroll wheel emulation.
|>>
|>>
|>
|>Hi,
|>
|>Very nice although I have a couple of comments.
|>
|>
|>> /*
|>>+ * Try to initialize the IBM TrackPoint
|>>+ */
|>>+	if (max_proto > PSMOUSE_PS2 && trackpoint_init(psmouse) == 0) {
|>>+		psmouse->vendor = "IBM";
|>>+		psmouse->name = "TrackPoint";
|>>+
|>>+		return PSMOUSE_PS2;
|>
|>Why PSMOUSE_PS2? Reconnect will surely not like it.
|
|
| Indeed. IIRC this patch killed wheel mouse detection in ubuntu.
|

That's correct. I had to revert it unfortunatly and i am dealing to
give it another shot if you want to get it tested again
before inclusion in the main tree, but it has to happen no later than
next week since we are very close to feature freeze for the next release.

Regards,
Fabio
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.5 (GNU/Linux)
Comment: Using GnuPG with Thunderbird - http://enigmail.mozdev.org

iQIVAwUBQgMaXlA6oBJjVJ+OAQKn7A//ULwd9zWcnqgmY0+uacKYT9LYa2hcIBuu
P9i08D/GpTGSglJ0iLBKM6eHw1eKLMwC1snVQ99TyCVMIicEBnNgcF31McEui/Q7
ZJug1Twndb0pUAc/erKUzdqLmQTIPax1eJLLCEmw81UWA0sW2PW52DZ26/4jqSFz
qpNYpvkT8h4X5Gc4l8j/erMYasN4jglcdjDKzfj6NMsVqWC5VJN5W863KPyM2dmf
BN9Mx8jDSzO6PgfquhKJa/6pUV7OODko6PwnJFkWC3SR03x8SjX7EKKDpkYW8OnX
RZGq2Tkmv5B2lme4v9e+O5+UPRzBuahxyknZw9WOcRBUeMpzAAXrIL6cDsWb9ZAd
ZCbIp3MS2be+hIY3hElbHiMN6+XLmr41u5PHGoxBOg8t4UPPTij7/ym3w4iB9Fbu
JIjEDsUfSVjzMZ0+tLGFl+2CtwrrBtmvGnuzLEzJxbwRWlzirIBj5VxAyLUVfXUB
TT0tAeDcopHqki3kFifiXUJ9XKPocwgznosZpISfNdJLB4+kw6S0/XamsbzZBJzr
K1Me547OABE8d/vc4dR7nDKqw4quZk6qThK7wqziiz6mGlBC28gLkfyxfGvVj/Uv
6uaE7RNOvRQYQNUFMMt6BH7vogCp7GsqrMfiiNc72SaxN8Gp4g2cH8v7xpUXcrJ0
mc6TtaGNagQ=
=AVn/
-----END PGP SIGNATURE-----

^ permalink raw reply	[flat|nested] 24+ messages in thread

* Re: [PATCH 2.6.11-rc3] IBM Trackpoint support
  2005-02-04  6:35   ` Vojtech Pavlik
  2005-02-04  6:46     ` Fabio Massimo Di Nitto
@ 2005-02-04  6:52     ` Dmitry Torokhov
  2005-02-04  6:54       ` Vojtech Pavlik
  2005-02-04 13:17     ` Stephen Evanchik
  2 siblings, 1 reply; 24+ messages in thread
From: Dmitry Torokhov @ 2005-02-04  6:52 UTC (permalink / raw)
  To: Vojtech Pavlik; +Cc: Stephen Evanchik, linux-kernel

On Friday 04 February 2005 01:35, Vojtech Pavlik wrote:
> On Thu, Feb 03, 2005 at 07:34:16PM -0500, Dmitry Torokhov wrote:
> > On Thursday 03 February 2005 17:43, Stephen Evanchik wrote:
> > > Vojtech,
> > > 
> > > Here is a patch that exposes the IBM TrackPoint's extended properties
> > > as well as scroll wheel emulation.
> > > 
> > > 
> > 
> > Hi,
> > 
> > Very nice although I have a couple of comments.
> > 
> > >  /*
> > > + * Try to initialize the IBM TrackPoint
> > > + */
> > > +	if (max_proto > PSMOUSE_PS2 && trackpoint_init(psmouse) == 0) {
> > > +		psmouse->vendor = "IBM";
> > > +		psmouse->name = "TrackPoint";
> > > + 
> > > +		return PSMOUSE_PS2;
> > 
> > Why PSMOUSE_PS2? Reconnect will surely not like it.
> 
> Indeed. IIRC this patch killed wheel mouse detection in ubuntu.
> 

We may need yet another psmouse_reset after unsuccessful test.

-- 
Dmitry

^ permalink raw reply	[flat|nested] 24+ messages in thread

* Re: [PATCH 2.6.11-rc3] IBM Trackpoint support
  2005-02-04  6:52     ` Dmitry Torokhov
@ 2005-02-04  6:54       ` Vojtech Pavlik
  2005-02-04 14:17         ` Dmitry Torokhov
  0 siblings, 1 reply; 24+ messages in thread
From: Vojtech Pavlik @ 2005-02-04  6:54 UTC (permalink / raw)
  To: Dmitry Torokhov; +Cc: Stephen Evanchik, linux-kernel

On Fri, Feb 04, 2005 at 01:52:39AM -0500, Dmitry Torokhov wrote:
> On Friday 04 February 2005 01:35, Vojtech Pavlik wrote:
> > On Thu, Feb 03, 2005 at 07:34:16PM -0500, Dmitry Torokhov wrote:
> > > On Thursday 03 February 2005 17:43, Stephen Evanchik wrote:
> > > > Vojtech,
> > > > 
> > > > Here is a patch that exposes the IBM TrackPoint's extended properties
> > > > as well as scroll wheel emulation.
> > > > 
> > > > 
> > > 
> > > Hi,
> > > 
> > > Very nice although I have a couple of comments.
> > > 
> > > >  /*
> > > > + * Try to initialize the IBM TrackPoint
> > > > + */
> > > > +	if (max_proto > PSMOUSE_PS2 && trackpoint_init(psmouse) == 0) {
> > > > +		psmouse->vendor = "IBM";
> > > > +		psmouse->name = "TrackPoint";
> > > > + 
> > > > +		return PSMOUSE_PS2;
> > > 
> > > Why PSMOUSE_PS2? Reconnect will surely not like it.
> > 
> > Indeed. IIRC this patch killed wheel mouse detection in ubuntu.
> > 
> 
> We may need yet another psmouse_reset after unsuccessful test.
 
We probably should do one after every test for isolation. It's not that
big a problem now that we do the probing from a thread.

-- 
Vojtech Pavlik
SuSE Labs, SuSE CR

^ permalink raw reply	[flat|nested] 24+ messages in thread

* Re: [PATCH 2.6.11-rc3] IBM Trackpoint support
  2005-02-04  6:35   ` Vojtech Pavlik
  2005-02-04  6:46     ` Fabio Massimo Di Nitto
  2005-02-04  6:52     ` Dmitry Torokhov
@ 2005-02-04 13:17     ` Stephen Evanchik
  2005-02-04 13:45       ` Vojtech Pavlik
  2 siblings, 1 reply; 24+ messages in thread
From: Stephen Evanchik @ 2005-02-04 13:17 UTC (permalink / raw)
  To: Vojtech Pavlik; +Cc: Dmitry Torokhov, linux-kernel

On Fri, 4 Feb 2005 07:35:20 +0100, Vojtech Pavlik <vojtech@suse.cz> wrote:
> > >  /*
> > > + * Try to initialize the IBM TrackPoint
> > > + */
> > > +   if (max_proto > PSMOUSE_PS2 && trackpoint_init(psmouse) == 0) {
> > > +           psmouse->vendor = "IBM";
> > > +           psmouse->name = "TrackPoint";
> > > +
> > > +           return PSMOUSE_PS2;
> >
> > Why PSMOUSE_PS2? Reconnect will surely not like it.
> 
> Indeed. IIRC this patch killed wheel mouse detection in ubuntu.

Earlier versions of the patch didn't disable the device while probing
so events could be interpreted as the magic ID of a TrackPoint. It now
resets and disables the PS/2 device before detection but not after a
detect failure.

I'll clean that up so its more sensible.


Stephen

^ permalink raw reply	[flat|nested] 24+ messages in thread

* Re: [PATCH 2.6.11-rc3] IBM Trackpoint support
  2005-02-04 13:17     ` Stephen Evanchik
@ 2005-02-04 13:45       ` Vojtech Pavlik
  2005-02-04 14:12         ` Dmitry Torokhov
  0 siblings, 1 reply; 24+ messages in thread
From: Vojtech Pavlik @ 2005-02-04 13:45 UTC (permalink / raw)
  To: Stephen Evanchik; +Cc: Dmitry Torokhov, linux-kernel

On Fri, Feb 04, 2005 at 08:17:43AM -0500, Stephen Evanchik wrote:
> On Fri, 4 Feb 2005 07:35:20 +0100, Vojtech Pavlik <vojtech@suse.cz> wrote:
> > > >  /*
> > > > + * Try to initialize the IBM TrackPoint
> > > > + */
> > > > +   if (max_proto > PSMOUSE_PS2 && trackpoint_init(psmouse) == 0) {
> > > > +           psmouse->vendor = "IBM";
> > > > +           psmouse->name = "TrackPoint";
> > > > +
> > > > +           return PSMOUSE_PS2;
> > >
> > > Why PSMOUSE_PS2? Reconnect will surely not like it.
> > 
> > Indeed. IIRC this patch killed wheel mouse detection in ubuntu.
> 
> Earlier versions of the patch didn't disable the device while probing
> so events could be interpreted as the magic ID of a TrackPoint. It now
> resets and disables the PS/2 device before detection but not after a
> detect failure.

Since we fixed libps2, this shouldn't happen anymore, as long as the
BIOS doesn't inject an endless stream of data from an USB mouse.

> I'll clean that up so its more sensible.

Thanks.

-- 
Vojtech Pavlik
SuSE Labs, SuSE CR

^ permalink raw reply	[flat|nested] 24+ messages in thread

* Re: [PATCH 2.6.11-rc3] IBM Trackpoint support
  2005-02-04 13:45       ` Vojtech Pavlik
@ 2005-02-04 14:12         ` Dmitry Torokhov
  0 siblings, 0 replies; 24+ messages in thread
From: Dmitry Torokhov @ 2005-02-04 14:12 UTC (permalink / raw)
  To: Vojtech Pavlik; +Cc: Stephen Evanchik, linux-kernel

On Fri, 4 Feb 2005 14:45:28 +0100, Vojtech Pavlik <vojtech@suse.cz> wrote:
> On Fri, Feb 04, 2005 at 08:17:43AM -0500, Stephen Evanchik wrote:
> > On Fri, 4 Feb 2005 07:35:20 +0100, Vojtech Pavlik <vojtech@suse.cz> wrote:
> > > Indeed. IIRC this patch killed wheel mouse detection in ubuntu.
> >
> > Earlier versions of the patch didn't disable the device while probing
> > so events could be interpreted as the magic ID of a TrackPoint. It now
> > resets and disables the PS/2 device before detection but not after a
> > detect failure.
> 
> Since we fixed libps2, this shouldn't happen anymore, as long as the
> BIOS doesn't inject an endless stream of data from an USB mouse.
> 

I don't think changes in libps2 affect this problem in any way -
psmouse does PSMOUSE_CMD_RESET_DIS before trying to do any protocol
probing so there should be no events from the mouse during detection
phase.

-- 
Dmitry

^ permalink raw reply	[flat|nested] 24+ messages in thread

* Re: [PATCH 2.6.11-rc3] IBM Trackpoint support
  2005-02-04  6:54       ` Vojtech Pavlik
@ 2005-02-04 14:17         ` Dmitry Torokhov
  2005-02-04 14:45           ` Vojtech Pavlik
  0 siblings, 1 reply; 24+ messages in thread
From: Dmitry Torokhov @ 2005-02-04 14:17 UTC (permalink / raw)
  To: Vojtech Pavlik; +Cc: Stephen Evanchik, linux-kernel

On Fri, 4 Feb 2005 07:54:54 +0100, Vojtech Pavlik <vojtech@suse.cz> wrote:
> On Fri, Feb 04, 2005 at 01:52:39AM -0500, Dmitry Torokhov wrote:
> > On Friday 04 February 2005 01:35, Vojtech Pavlik wrote:
> > > On Thu, Feb 03, 2005 at 07:34:16PM -0500, Dmitry Torokhov wrote:
> > > > On Thursday 03 February 2005 17:43, Stephen Evanchik wrote:
> > > > > Vojtech,
> > > > >
> > > > > Here is a patch that exposes the IBM TrackPoint's extended properties
> > > > > as well as scroll wheel emulation.
> > > > >
> > > > >
> > > >
> > > > Hi,
> > > >
> > > > Very nice although I have a couple of comments.
> > > >
> > > > >  /*
> > > > > + * Try to initialize the IBM TrackPoint
> > > > > + */
> > > > > +       if (max_proto > PSMOUSE_PS2 && trackpoint_init(psmouse) == 0) {
> > > > > +               psmouse->vendor = "IBM";
> > > > > +               psmouse->name = "TrackPoint";
> > > > > +
> > > > > +               return PSMOUSE_PS2;
> > > >
> > > > Why PSMOUSE_PS2? Reconnect will surely not like it.
> > >
> > > Indeed. IIRC this patch killed wheel mouse detection in ubuntu.
> > >
> >
> > We may need yet another psmouse_reset after unsuccessful test.
> 
> We probably should do one after every test for isolation. It's not that
> big a problem now that we do the probing from a thread.
> 

It is still a problem if driver is registered after the port has been
detected wich quite often is the case as many people have psmouse as a
module.

I wonder if we should make driver registration asynchronous too. I
don't forsee any issues providing that I bump up module's reference
count while driver structure is "in flight", do you?

-- 
Dmitry

^ permalink raw reply	[flat|nested] 24+ messages in thread

* Re: [PATCH 2.6.11-rc3] IBM Trackpoint support
  2005-02-04 14:17         ` Dmitry Torokhov
@ 2005-02-04 14:45           ` Vojtech Pavlik
  2005-02-05  6:56             ` Dmitry Torokhov
  0 siblings, 1 reply; 24+ messages in thread
From: Vojtech Pavlik @ 2005-02-04 14:45 UTC (permalink / raw)
  To: dtor_core; +Cc: Stephen Evanchik, linux-kernel

On Fri, Feb 04, 2005 at 09:17:33AM -0500, Dmitry Torokhov wrote:
 
> It is still a problem if driver is registered after the port has been
> detected wich quite often is the case as many people have psmouse as a
> module.
> 
> I wonder if we should make driver registration asynchronous too.

Probably yes.

> I
> don't forsee any issues providing that I bump up module's reference
> count while driver structure is "in flight", do you?
 
No, looks OK to me, too.

-- 
Vojtech Pavlik
SuSE Labs, SuSE CR

^ permalink raw reply	[flat|nested] 24+ messages in thread

* Re: [PATCH 2.6.11-rc3] IBM Trackpoint support
  2005-02-04 14:45           ` Vojtech Pavlik
@ 2005-02-05  6:56             ` Dmitry Torokhov
  2005-02-05 12:24               ` Vojtech Pavlik
  0 siblings, 1 reply; 24+ messages in thread
From: Dmitry Torokhov @ 2005-02-05  6:56 UTC (permalink / raw)
  To: Vojtech Pavlik; +Cc: Stephen Evanchik, linux-kernel, vojtech

On Friday 04 February 2005 09:45, Vojtech Pavlik wrote:
> On Fri, Feb 04, 2005 at 09:17:33AM -0500, Dmitry Torokhov wrote:
>  
> > It is still a problem if driver is registered after the port has been
> > detected wich quite often is the case as many people have psmouse as a
> > module.
> > 
> > I wonder if we should make driver registration asynchronous too.
> 
> Probably yes.
> 
> > I
> > don't forsee any issues providing that I bump up module's reference
> > count while driver structure is "in flight", do you?
>  
> No, looks OK to me, too.
> 

Ok, what about the following patch then?

-- 
Dmitry


===================================================================


ChangeSet@1.2005, 2005-02-05 01:48:45-05:00, dtor_core@ameritech.net
  Input: make serio drivers register asynchronously. This should
         speed up boot process as some drivers take a long time
         probing for supported devices.
  
         Also change __inline__ to inline in serio.h
  
  Signed-off-by: Dmitry Torokhov <dtor@mail.ru>


 drivers/input/serio/serio.c |   65 ++++++++++++++++++++++++--------------------
 include/linux/serio.h       |   25 ++++++++++------
 2 files changed, 51 insertions(+), 39 deletions(-)


===================================================================



diff -Nru a/drivers/input/serio/serio.c b/drivers/input/serio/serio.c
--- a/drivers/input/serio/serio.c	2005-02-05 01:53:56 -05:00
+++ b/drivers/input/serio/serio.c	2005-02-05 01:53:56 -05:00
@@ -44,7 +44,7 @@
 EXPORT_SYMBOL(__serio_register_port);
 EXPORT_SYMBOL(serio_unregister_port);
 EXPORT_SYMBOL(__serio_unregister_port_delayed);
-EXPORT_SYMBOL(serio_register_driver);
+EXPORT_SYMBOL(__serio_register_driver);
 EXPORT_SYMBOL(serio_unregister_driver);
 EXPORT_SYMBOL(serio_open);
 EXPORT_SYMBOL(serio_close);
@@ -120,18 +120,19 @@
  * Serio event processing.
  */
 
-struct serio_event {
-	int type;
-	struct serio *serio;
-	struct module *owner;
-	struct list_head node;
-};
-
 enum serio_event_type {
 	SERIO_RESCAN,
 	SERIO_RECONNECT,
 	SERIO_REGISTER_PORT,
 	SERIO_UNREGISTER_PORT,
+	SERIO_REGISTER_DRIVER,
+};
+
+struct serio_event {
+	enum serio_event_type type;
+	void *object;
+	struct module *owner;
+	struct list_head node;
 };
 
 static DEFINE_SPINLOCK(serio_event_lock);	/* protects serio_event_list */
@@ -140,7 +141,7 @@
 static DECLARE_COMPLETION(serio_exited);
 static int serio_pid;
 
-static void serio_queue_event(struct serio *serio, struct module *owner,
+static void serio_queue_event(void *object, struct module *owner,
 			      enum serio_event_type event_type)
 {
 	unsigned long flags;
@@ -156,7 +157,7 @@
 	 * we need to preseve sequence of distinct events.
  	 */
 	list_for_each_entry_reverse(event, &serio_event_list, node) {
-		if (event->serio == serio) {
+		if (event->object == object) {
 			if (event->type == event_type)
 				goto out;
 			break;
@@ -170,7 +171,7 @@
 		}
 
 		event->type = event_type;
-		event->serio = serio;
+		event->object = object;
 		event->owner = owner;
 
 		list_add_tail(&event->node, &serio_event_list);
@@ -198,7 +199,7 @@
 
 	list_for_each_safe(node, next, &serio_event_list) {
 		e = list_entry(node, struct serio_event, node);
-		if (event->serio == e->serio) {
+		if (event->object == e->object) {
 			/*
 			 * If this event is of different type we should not
 			 * look further - we only suppress duplicate events
@@ -241,6 +242,7 @@
 static void serio_handle_events(void)
 {
 	struct serio_event *event;
+	struct serio_driver *serio_drv;
 
 	down(&serio_sem);
 
@@ -248,21 +250,26 @@
 
 		switch (event->type) {
 			case SERIO_REGISTER_PORT:
-				serio_add_port(event->serio);
+				serio_add_port(event->object);
 				break;
 
 			case SERIO_UNREGISTER_PORT:
-				serio_disconnect_port(event->serio);
-				serio_destroy_port(event->serio);
+				serio_disconnect_port(event->object);
+				serio_destroy_port(event->object);
 				break;
 
 			case SERIO_RECONNECT:
-				serio_reconnect_port(event->serio);
+				serio_reconnect_port(event->object);
 				break;
 
 			case SERIO_RESCAN:
-				serio_disconnect_port(event->serio);
-				serio_find_driver(event->serio);
+				serio_disconnect_port(event->object);
+				serio_find_driver(event->object);
+				break;
+
+			case SERIO_REGISTER_DRIVER:
+				serio_drv = event->object;
+				driver_register(&serio_drv->driver);
 				break;
 
 			default:
@@ -289,7 +296,7 @@
 
 	list_for_each_safe(node, next, &serio_event_list) {
 		event = list_entry(node, struct serio_event, node);
-		if (event->serio == serio) {
+		if (event->object == serio) {
 			list_del_init(node);
 			serio_free_event(event);
 		}
@@ -309,20 +316,23 @@
 static struct serio *serio_get_pending_child(struct serio *parent)
 {
 	struct serio_event *event;
-	struct serio *serio = NULL;
+	struct serio *serio, *child = NULL;
 	unsigned long flags;
 
 	spin_lock_irqsave(&serio_event_lock, flags);
 
 	list_for_each_entry(event, &serio_event_list, node) {
-		if (event->type == SERIO_REGISTER_PORT && event->serio->parent == parent) {
-			serio = event->serio;
-			break;
+		if (event->type == SERIO_REGISTER_PORT) {
+			serio = event->object;
+			if (serio->parent == parent) {
+				child = serio;
+				break;
+			}
 		}
 	}
 
 	spin_unlock_irqrestore(&serio_event_lock, flags);
-	return serio;
+	return child;
 }
 
 static int serio_thread(void *nothing)
@@ -672,16 +682,13 @@
 	return 0;
 }
 
-void serio_register_driver(struct serio_driver *drv)
+void __serio_register_driver(struct serio_driver *drv, struct module *owner)
 {
-	down(&serio_sem);
-
 	drv->driver.bus = &serio_bus;
 	drv->driver.probe = serio_driver_probe;
 	drv->driver.remove = serio_driver_remove;
-	driver_register(&drv->driver);
 
-	up(&serio_sem);
+	serio_queue_event(drv, owner, SERIO_REGISTER_DRIVER);
 }
 
 void serio_unregister_driver(struct serio_driver *drv)
diff -Nru a/include/linux/serio.h b/include/linux/serio.h
--- a/include/linux/serio.h	2005-02-05 01:53:56 -05:00
+++ b/include/linux/serio.h	2005-02-05 01:53:56 -05:00
@@ -95,10 +95,15 @@
 	__serio_unregister_port_delayed(serio, THIS_MODULE);
 }
 
-void serio_register_driver(struct serio_driver *drv);
+void __serio_register_driver(struct serio_driver *drv, struct module *owner);
+static inline void serio_register_driver(struct serio_driver *drv)
+{
+	__serio_register_driver(drv, THIS_MODULE);
+}
+
 void serio_unregister_driver(struct serio_driver *drv);
 
-static __inline__ int serio_write(struct serio *serio, unsigned char data)
+static inline int serio_write(struct serio *serio, unsigned char data)
 {
 	if (serio->write)
 		return serio->write(serio, data);
@@ -106,13 +111,13 @@
 		return -1;
 }
 
-static __inline__ void serio_drv_write_wakeup(struct serio *serio)
+static inline void serio_drv_write_wakeup(struct serio *serio)
 {
 	if (serio->drv && serio->drv->write_wakeup)
 		serio->drv->write_wakeup(serio);
 }
 
-static __inline__ void serio_cleanup(struct serio *serio)
+static inline void serio_cleanup(struct serio *serio)
 {
 	if (serio->drv && serio->drv->cleanup)
 		serio->drv->cleanup(serio);
@@ -122,12 +127,12 @@
  * Use the following fucntions to manipulate serio's per-port
  * driver-specific data.
  */
-static __inline__ void *serio_get_drvdata(struct serio *serio)
+static inline void *serio_get_drvdata(struct serio *serio)
 {
 	return dev_get_drvdata(&serio->dev);
 }
 
-static __inline__ void serio_set_drvdata(struct serio *serio, void *data)
+static inline void serio_set_drvdata(struct serio *serio, void *data)
 {
 	dev_set_drvdata(&serio->dev, data);
 }
@@ -136,12 +141,12 @@
  * Use the following fucntions to protect critical sections in
  * driver code from port's interrupt handler
  */
-static __inline__ void serio_pause_rx(struct serio *serio)
+static inline void serio_pause_rx(struct serio *serio)
 {
 	spin_lock_irq(&serio->lock);
 }
 
-static __inline__ void serio_continue_rx(struct serio *serio)
+static inline void serio_continue_rx(struct serio *serio)
 {
 	spin_unlock_irq(&serio->lock);
 }
@@ -149,12 +154,12 @@
 /*
  * Use the following fucntions to pin serio's driver in process context
  */
-static __inline__ int serio_pin_driver(struct serio *serio)
+static inline int serio_pin_driver(struct serio *serio)
 {
 	return down_interruptible(&serio->drv_sem);
 }
 
-static __inline__ void serio_unpin_driver(struct serio *serio)
+static inline void serio_unpin_driver(struct serio *serio)
 {
 	up(&serio->drv_sem);
 }

^ permalink raw reply	[flat|nested] 24+ messages in thread

* Re: [PATCH 2.6.11-rc3] IBM Trackpoint support
  2005-02-03 22:43 [PATCH 2.6.11-rc3] IBM Trackpoint support Stephen Evanchik
  2005-02-04  0:34 ` Dmitry Torokhov
@ 2005-02-05 10:44 ` Pavel Machek
  2005-02-07 10:14   ` Vojtech Pavlik
  2005-02-06 20:17 ` Domen Puncer
  2 siblings, 1 reply; 24+ messages in thread
From: Pavel Machek @ 2005-02-05 10:44 UTC (permalink / raw)
  To: Stephen Evanchik; +Cc: Vojtech Pavlik, linux-kernel

Hi!

> Here is a patch that exposes the IBM TrackPoint's extended properties
> as well as scroll wheel emulation.
> 
> 
> I would appreciate comments and suggestions to make this more acceptable.
> 
> 
> Stephen
> 
> 
> diff -uNr a/drivers/input/mouse/Makefile b/drivers/input/mouse/Makefile
> --- a/drivers/input/mouse/Makefile	2005-02-03 17:30:40.000000000 -0500
> +++ b/drivers/input/mouse/Makefile	2005-02-03 17:29:42.000000000 -0500
> @@ -14,4 +14,4 @@
>  obj-$(CONFIG_MOUSE_SERIAL)	+= sermouse.o
>  obj-$(CONFIG_MOUSE_VSXXXAA)	+= vsxxxaa.o
>  
> -psmouse-objs  := psmouse-base.o alps.o logips2pp.o synaptics.o
> +psmouse-objs  := psmouse-base.o alps.o logips2pp.o synaptics.o trackpoint.o
> diff -uNr a/drivers/input/mouse/psmouse-base.c
> b/drivers/input/mouse/psmouse-base.c
> --- a/drivers/input/mouse/psmouse-base.c	2005-02-03 17:30:40.000000000 -0500
> +++ b/drivers/input/mouse/psmouse-base.c	2005-02-03 17:29:42.000000000 -0500
> @@ -23,6 +23,7 @@
>  #include "psmouse.h"
>  #include "synaptics.h"
>  #include "logips2pp.h"
> +#include "trackpoint.h"
>  #include "alps.h"
>  
>  #define DRIVER_DESC	"PS/2 mouse driver"
> @@ -119,6 +120,13 @@
>  	}
>  
>  /*
> + * TrackPoint scroll simulation handler if the BTN_MIDDLE is down
> + */
> +
> +	if(psmouse->model == PSMOUSE_TRACKPOINT)
> +		trackpoint_sim_scroll(psmouse);
> +
> +/*
>   * Generic PS/2 Mouse
>   */
>  

Perhaps this should be done in userspace? It is probably usable on
non-trackpoint devices, too...
									Pavel


-- 
People were complaining that M$ turns users into beta-testers...
...jr ghea gurz vagb qrirybcref, naq gurl frrz gb yvxr vg gung jnl!

^ permalink raw reply	[flat|nested] 24+ messages in thread

* Re: [PATCH 2.6.11-rc3] IBM Trackpoint support
  2005-02-05  6:56             ` Dmitry Torokhov
@ 2005-02-05 12:24               ` Vojtech Pavlik
  0 siblings, 0 replies; 24+ messages in thread
From: Vojtech Pavlik @ 2005-02-05 12:24 UTC (permalink / raw)
  To: Dmitry Torokhov; +Cc: Stephen Evanchik, linux-kernel

On Sat, Feb 05, 2005 at 01:56:07AM -0500, Dmitry Torokhov wrote:
> On Friday 04 February 2005 09:45, Vojtech Pavlik wrote:
> > On Fri, Feb 04, 2005 at 09:17:33AM -0500, Dmitry Torokhov wrote:
> >  
> > > It is still a problem if driver is registered after the port has been
> > > detected wich quite often is the case as many people have psmouse as a
> > > module.
> > > 
> > > I wonder if we should make driver registration asynchronous too.
> > 
> > Probably yes.
> > 
> > > I
> > > don't forsee any issues providing that I bump up module's reference
> > > count while driver structure is "in flight", do you?
> >  
> > No, looks OK to me, too.
> 
> Ok, what about the following patch then?

Applied. ;)

> 
> -- 
> Dmitry
> 
> 
> ===================================================================
> 
> 
> ChangeSet@1.2005, 2005-02-05 01:48:45-05:00, dtor_core@ameritech.net
>   Input: make serio drivers register asynchronously. This should
>          speed up boot process as some drivers take a long time
>          probing for supported devices.
>   
>          Also change __inline__ to inline in serio.h
>   
>   Signed-off-by: Dmitry Torokhov <dtor@mail.ru>
> 
> 
>  drivers/input/serio/serio.c |   65 ++++++++++++++++++++++++--------------------
>  include/linux/serio.h       |   25 ++++++++++------
>  2 files changed, 51 insertions(+), 39 deletions(-)
> 
> 
> ===================================================================
> 
> 
> 
> diff -Nru a/drivers/input/serio/serio.c b/drivers/input/serio/serio.c
> --- a/drivers/input/serio/serio.c	2005-02-05 01:53:56 -05:00
> +++ b/drivers/input/serio/serio.c	2005-02-05 01:53:56 -05:00
> @@ -44,7 +44,7 @@
>  EXPORT_SYMBOL(__serio_register_port);
>  EXPORT_SYMBOL(serio_unregister_port);
>  EXPORT_SYMBOL(__serio_unregister_port_delayed);
> -EXPORT_SYMBOL(serio_register_driver);
> +EXPORT_SYMBOL(__serio_register_driver);
>  EXPORT_SYMBOL(serio_unregister_driver);
>  EXPORT_SYMBOL(serio_open);
>  EXPORT_SYMBOL(serio_close);
> @@ -120,18 +120,19 @@
>   * Serio event processing.
>   */
>  
> -struct serio_event {
> -	int type;
> -	struct serio *serio;
> -	struct module *owner;
> -	struct list_head node;
> -};
> -
>  enum serio_event_type {
>  	SERIO_RESCAN,
>  	SERIO_RECONNECT,
>  	SERIO_REGISTER_PORT,
>  	SERIO_UNREGISTER_PORT,
> +	SERIO_REGISTER_DRIVER,
> +};
> +
> +struct serio_event {
> +	enum serio_event_type type;
> +	void *object;
> +	struct module *owner;
> +	struct list_head node;
>  };
>  
>  static DEFINE_SPINLOCK(serio_event_lock);	/* protects serio_event_list */
> @@ -140,7 +141,7 @@
>  static DECLARE_COMPLETION(serio_exited);
>  static int serio_pid;
>  
> -static void serio_queue_event(struct serio *serio, struct module *owner,
> +static void serio_queue_event(void *object, struct module *owner,
>  			      enum serio_event_type event_type)
>  {
>  	unsigned long flags;
> @@ -156,7 +157,7 @@
>  	 * we need to preseve sequence of distinct events.
>   	 */
>  	list_for_each_entry_reverse(event, &serio_event_list, node) {
> -		if (event->serio == serio) {
> +		if (event->object == object) {
>  			if (event->type == event_type)
>  				goto out;
>  			break;
> @@ -170,7 +171,7 @@
>  		}
>  
>  		event->type = event_type;
> -		event->serio = serio;
> +		event->object = object;
>  		event->owner = owner;
>  
>  		list_add_tail(&event->node, &serio_event_list);
> @@ -198,7 +199,7 @@
>  
>  	list_for_each_safe(node, next, &serio_event_list) {
>  		e = list_entry(node, struct serio_event, node);
> -		if (event->serio == e->serio) {
> +		if (event->object == e->object) {
>  			/*
>  			 * If this event is of different type we should not
>  			 * look further - we only suppress duplicate events
> @@ -241,6 +242,7 @@
>  static void serio_handle_events(void)
>  {
>  	struct serio_event *event;
> +	struct serio_driver *serio_drv;
>  
>  	down(&serio_sem);
>  
> @@ -248,21 +250,26 @@
>  
>  		switch (event->type) {
>  			case SERIO_REGISTER_PORT:
> -				serio_add_port(event->serio);
> +				serio_add_port(event->object);
>  				break;
>  
>  			case SERIO_UNREGISTER_PORT:
> -				serio_disconnect_port(event->serio);
> -				serio_destroy_port(event->serio);
> +				serio_disconnect_port(event->object);
> +				serio_destroy_port(event->object);
>  				break;
>  
>  			case SERIO_RECONNECT:
> -				serio_reconnect_port(event->serio);
> +				serio_reconnect_port(event->object);
>  				break;
>  
>  			case SERIO_RESCAN:
> -				serio_disconnect_port(event->serio);
> -				serio_find_driver(event->serio);
> +				serio_disconnect_port(event->object);
> +				serio_find_driver(event->object);
> +				break;
> +
> +			case SERIO_REGISTER_DRIVER:
> +				serio_drv = event->object;
> +				driver_register(&serio_drv->driver);
>  				break;
>  
>  			default:
> @@ -289,7 +296,7 @@
>  
>  	list_for_each_safe(node, next, &serio_event_list) {
>  		event = list_entry(node, struct serio_event, node);
> -		if (event->serio == serio) {
> +		if (event->object == serio) {
>  			list_del_init(node);
>  			serio_free_event(event);
>  		}
> @@ -309,20 +316,23 @@
>  static struct serio *serio_get_pending_child(struct serio *parent)
>  {
>  	struct serio_event *event;
> -	struct serio *serio = NULL;
> +	struct serio *serio, *child = NULL;
>  	unsigned long flags;
>  
>  	spin_lock_irqsave(&serio_event_lock, flags);
>  
>  	list_for_each_entry(event, &serio_event_list, node) {
> -		if (event->type == SERIO_REGISTER_PORT && event->serio->parent == parent) {
> -			serio = event->serio;
> -			break;
> +		if (event->type == SERIO_REGISTER_PORT) {
> +			serio = event->object;
> +			if (serio->parent == parent) {
> +				child = serio;
> +				break;
> +			}
>  		}
>  	}
>  
>  	spin_unlock_irqrestore(&serio_event_lock, flags);
> -	return serio;
> +	return child;
>  }
>  
>  static int serio_thread(void *nothing)
> @@ -672,16 +682,13 @@
>  	return 0;
>  }
>  
> -void serio_register_driver(struct serio_driver *drv)
> +void __serio_register_driver(struct serio_driver *drv, struct module *owner)
>  {
> -	down(&serio_sem);
> -
>  	drv->driver.bus = &serio_bus;
>  	drv->driver.probe = serio_driver_probe;
>  	drv->driver.remove = serio_driver_remove;
> -	driver_register(&drv->driver);
>  
> -	up(&serio_sem);
> +	serio_queue_event(drv, owner, SERIO_REGISTER_DRIVER);
>  }
>  
>  void serio_unregister_driver(struct serio_driver *drv)
> diff -Nru a/include/linux/serio.h b/include/linux/serio.h
> --- a/include/linux/serio.h	2005-02-05 01:53:56 -05:00
> +++ b/include/linux/serio.h	2005-02-05 01:53:56 -05:00
> @@ -95,10 +95,15 @@
>  	__serio_unregister_port_delayed(serio, THIS_MODULE);
>  }
>  
> -void serio_register_driver(struct serio_driver *drv);
> +void __serio_register_driver(struct serio_driver *drv, struct module *owner);
> +static inline void serio_register_driver(struct serio_driver *drv)
> +{
> +	__serio_register_driver(drv, THIS_MODULE);
> +}
> +
>  void serio_unregister_driver(struct serio_driver *drv);
>  
> -static __inline__ int serio_write(struct serio *serio, unsigned char data)
> +static inline int serio_write(struct serio *serio, unsigned char data)
>  {
>  	if (serio->write)
>  		return serio->write(serio, data);
> @@ -106,13 +111,13 @@
>  		return -1;
>  }
>  
> -static __inline__ void serio_drv_write_wakeup(struct serio *serio)
> +static inline void serio_drv_write_wakeup(struct serio *serio)
>  {
>  	if (serio->drv && serio->drv->write_wakeup)
>  		serio->drv->write_wakeup(serio);
>  }
>  
> -static __inline__ void serio_cleanup(struct serio *serio)
> +static inline void serio_cleanup(struct serio *serio)
>  {
>  	if (serio->drv && serio->drv->cleanup)
>  		serio->drv->cleanup(serio);
> @@ -122,12 +127,12 @@
>   * Use the following fucntions to manipulate serio's per-port
>   * driver-specific data.
>   */
> -static __inline__ void *serio_get_drvdata(struct serio *serio)
> +static inline void *serio_get_drvdata(struct serio *serio)
>  {
>  	return dev_get_drvdata(&serio->dev);
>  }
>  
> -static __inline__ void serio_set_drvdata(struct serio *serio, void *data)
> +static inline void serio_set_drvdata(struct serio *serio, void *data)
>  {
>  	dev_set_drvdata(&serio->dev, data);
>  }
> @@ -136,12 +141,12 @@
>   * Use the following fucntions to protect critical sections in
>   * driver code from port's interrupt handler
>   */
> -static __inline__ void serio_pause_rx(struct serio *serio)
> +static inline void serio_pause_rx(struct serio *serio)
>  {
>  	spin_lock_irq(&serio->lock);
>  }
>  
> -static __inline__ void serio_continue_rx(struct serio *serio)
> +static inline void serio_continue_rx(struct serio *serio)
>  {
>  	spin_unlock_irq(&serio->lock);
>  }
> @@ -149,12 +154,12 @@
>  /*
>   * Use the following fucntions to pin serio's driver in process context
>   */
> -static __inline__ int serio_pin_driver(struct serio *serio)
> +static inline int serio_pin_driver(struct serio *serio)
>  {
>  	return down_interruptible(&serio->drv_sem);
>  }
>  
> -static __inline__ void serio_unpin_driver(struct serio *serio)
> +static inline void serio_unpin_driver(struct serio *serio)
>  {
>  	up(&serio->drv_sem);
>  }
> 

-- 
Vojtech Pavlik
SuSE Labs, SuSE CR

^ permalink raw reply	[flat|nested] 24+ messages in thread

* Re: [PATCH 2.6.11-rc3] IBM Trackpoint support
  2005-02-03 22:43 [PATCH 2.6.11-rc3] IBM Trackpoint support Stephen Evanchik
  2005-02-04  0:34 ` Dmitry Torokhov
  2005-02-05 10:44 ` Pavel Machek
@ 2005-02-06 20:17 ` Domen Puncer
  2 siblings, 0 replies; 24+ messages in thread
From: Domen Puncer @ 2005-02-06 20:17 UTC (permalink / raw)
  To: Stephen Evanchik; +Cc: Vojtech Pavlik, linux-kernel

I'm a bit late, sorry. Haven't seen these mentioned in replies:


On 03/02/05 17:43 -0500, Stephen Evanchik wrote:
> +int tp_sens = TP_DEF_SENS;
> +module_param_named(sens, tp_sens, uint, 0);
> +MODULE_PARM_DESC(sens, "Sensitivity");

I don't see out-of-file usages... these could be static.

...
> +	static int name(char* page, char** start, off_t off, int count, int*
> eof, void* data) \
> +	{ \
> +		int len; \
> +		struct psmouse *psmouse = (struct psmouse *)data; \
> +		struct trackpoint_data *tp = (struct trackpoint_data*)psmouse->private; \

No need to cast (void *).

...
> +static int scroll_write_func(struct file *file, const char __user
> *buffer, unsigned long count, void *data)
> +{
> +	int len = count;
> +	unsigned char tmp[5];
> +	struct psmouse *psmouse = (struct psmouse *)data;
> +	struct trackpoint_data *tp = (struct trackpoint_data*)psmouse->private;
> +	if(count > sizeof(tmp) - 1)
> +		len = sizeof(tmp) - 1;

How about: len = min(count, sizeof(tmp) - 1);?

...
> +no_ext_dev:

Nitpick:
Some like ' ' before label (makes diff -pu patches more readable)



	Domen

^ permalink raw reply	[flat|nested] 24+ messages in thread

* Re: [PATCH 2.6.11-rc3] IBM Trackpoint support
  2005-02-05 10:44 ` Pavel Machek
@ 2005-02-07 10:14   ` Vojtech Pavlik
  2005-02-13 19:07     ` Stephen Evanchik
  0 siblings, 1 reply; 24+ messages in thread
From: Vojtech Pavlik @ 2005-02-07 10:14 UTC (permalink / raw)
  To: Pavel Machek; +Cc: Stephen Evanchik, linux-kernel

On Sat, Feb 05, 2005 at 11:44:05AM +0100, Pavel Machek wrote:

> > Here is a patch that exposes the IBM TrackPoint's extended properties
> > as well as scroll wheel emulation.
> > 
> > 
> > I would appreciate comments and suggestions to make this more acceptable.
> > 
> 
> Perhaps this should be done in userspace? It is probably usable on
> non-trackpoint devices, too...
 
For a big part it's not possible to do in userspace, because the
touchpoint doesn't give the pressure information, it only can be mapped
to a button click.

But middle-button-to-scroll would be doable in userspace, yes.

-- 
Vojtech Pavlik
SuSE Labs, SuSE CR

^ permalink raw reply	[flat|nested] 24+ messages in thread

* Re: [PATCH 2.6.11-rc3] IBM Trackpoint support
  2005-02-07 10:14   ` Vojtech Pavlik
@ 2005-02-13 19:07     ` Stephen Evanchik
  2005-02-13 19:13       ` Vojtech Pavlik
  0 siblings, 1 reply; 24+ messages in thread
From: Stephen Evanchik @ 2005-02-13 19:07 UTC (permalink / raw)
  To: Vojtech Pavlik; +Cc: Pavel Machek, linux-kernel

On Mon, 7 Feb 2005 11:14:17 +0100, Vojtech Pavlik <vojtech@suse.cz> wrote:
> > Perhaps this should be done in userspace? It is probably usable on
> > non-trackpoint devices, too...
> 
> For a big part it's not possible to do in userspace, because the
> touchpoint doesn't give the pressure information, it only can be mapped
> to a button click.
> 
> But middle-button-to-scroll would be doable in userspace, yes.
> 

Middle-to-scroll in the newer Xorg releases. I received a number of
requests from users to include this feature, I'm not sure why the Xorg
option is inadequate. It can be removed if necessary.


Stephen

^ permalink raw reply	[flat|nested] 24+ messages in thread

* Re: [PATCH 2.6.11-rc3] IBM Trackpoint support
  2005-02-13 19:07     ` Stephen Evanchik
@ 2005-02-13 19:13       ` Vojtech Pavlik
  0 siblings, 0 replies; 24+ messages in thread
From: Vojtech Pavlik @ 2005-02-13 19:13 UTC (permalink / raw)
  To: Stephen Evanchik; +Cc: Pavel Machek, linux-kernel

On Sun, Feb 13, 2005 at 02:07:39PM -0500, Stephen Evanchik wrote:

> > > Perhaps this should be done in userspace? It is probably usable on
> > > non-trackpoint devices, too...
> > 
> > For a big part it's not possible to do in userspace, because the
> > touchpoint doesn't give the pressure information, it only can be mapped
> > to a button click.
> > 
> > But middle-button-to-scroll would be doable in userspace, yes.
> 
> Middle-to-scroll in the newer Xorg releases. I received a number of
> requests from users to include this feature, I'm not sure why the Xorg
> option is inadequate. It can be removed if necessary.
 
I'm glad it's in the Xorg X server. It's the right place for it to be.

-- 
Vojtech Pavlik
SuSE Labs, SuSE CR

^ permalink raw reply	[flat|nested] 24+ messages in thread

* Re: [PATCH 2.6.11-rc3] IBM Trackpoint support
  2005-02-04  3:52   ` Dmitry Torokhov
  2005-02-04  4:39     ` Stephen Evanchik
@ 2005-02-13 19:13     ` Stephen Evanchik
  2005-02-13 19:31       ` Vojtech Pavlik
  2005-02-13 23:50       ` Dmitry Torokhov
  1 sibling, 2 replies; 24+ messages in thread
From: Stephen Evanchik @ 2005-02-13 19:13 UTC (permalink / raw)
  To: Dmitry Torokhov; +Cc: Vojtech Pavlik, linux-kernel

On Thu, 3 Feb 2005 22:52:44 -0500, Dmitry Torokhov
<dtor_core@ameritech.net> wrote:
> OK, I have read the code once again, and saw that you have special
> handling within PS/2 protocol based on model constant. Please set
> psmouse type to PSMOUSE_TRACKPOINT instead of model and provide full
> protocol handler, like ALPS, Synaptics and Logitech do. Trackpoint
> is different and complex enough to warrant it.

I'm not sure that I think a protocol handler is necessary unless I am
misunderstanding what you mean. The TrackPoint is nothing more than a
PS/2 mouse with 2 or 3 buttons that responds to an additional set of
commands. The extra handling has to do with middle-to-scroll which
could be done in userspace.

Aside from that the only time TracKPoint specific processing occurs is
when some property is being manipulated.

Do you still think a custom handler is necessary? 

Stephen

^ permalink raw reply	[flat|nested] 24+ messages in thread

* Re: [PATCH 2.6.11-rc3] IBM Trackpoint support
  2005-02-13 19:13     ` Stephen Evanchik
@ 2005-02-13 19:31       ` Vojtech Pavlik
  2005-02-13 20:31         ` Stephen Evanchik
  2005-02-13 23:50       ` Dmitry Torokhov
  1 sibling, 1 reply; 24+ messages in thread
From: Vojtech Pavlik @ 2005-02-13 19:31 UTC (permalink / raw)
  To: Stephen Evanchik; +Cc: Dmitry Torokhov, linux-kernel

On Sun, Feb 13, 2005 at 02:13:15PM -0500, Stephen Evanchik wrote:

> On Thu, 3 Feb 2005 22:52:44 -0500, Dmitry Torokhov
> <dtor_core@ameritech.net> wrote:
> > OK, I have read the code once again, and saw that you have special
> > handling within PS/2 protocol based on model constant. Please set
> > psmouse type to PSMOUSE_TRACKPOINT instead of model and provide full
> > protocol handler, like ALPS, Synaptics and Logitech do. Trackpoint
> > is different and complex enough to warrant it.
> 
> I'm not sure that I think a protocol handler is necessary unless I am
> misunderstanding what you mean. The TrackPoint is nothing more than a
> PS/2 mouse with 2 or 3 buttons that responds to an additional set of
> commands. The extra handling has to do with middle-to-scroll which
> could be done in userspace.
> 
> Aside from that the only time TracKPoint specific processing occurs is
> when some property is being manipulated.
> 
> Do you still think a custom handler is necessary? 
 
You're right. The IBM trackpoints unfortunately don't have a 'native'
mode, they always do full processing and send classic PS/2 packets.

I think we shouldn't need a handler, since we can use the PS/2 protocol
one. We'll need some options to set the trackpoint tap behavior (as far
as I know it can only be mapped to a button), and we'll need a safe
detection, but that's all.

-- 
Vojtech Pavlik
SuSE Labs, SuSE CR

^ permalink raw reply	[flat|nested] 24+ messages in thread

* Re: [PATCH 2.6.11-rc3] IBM Trackpoint support
  2005-02-13 19:31       ` Vojtech Pavlik
@ 2005-02-13 20:31         ` Stephen Evanchik
  0 siblings, 0 replies; 24+ messages in thread
From: Stephen Evanchik @ 2005-02-13 20:31 UTC (permalink / raw)
  To: Vojtech Pavlik; +Cc: Dmitry Torokhov, linux-kernel

On Sun, 13 Feb 2005 20:31:49 +0100, Vojtech Pavlik <vojtech@suse.cz> wrote:
>
> You're right. The IBM trackpoints unfortunately don't have a 'native'
> mode, they always do full processing and send classic PS/2 packets.
> 
> I think we shouldn't need a handler, since we can use the PS/2 protocol
> one. We'll need some options to set the trackpoint tap behavior (as far
> as I know it can only be mapped to a button), and we'll need a safe
> detection, but that's all.

The tap only sends a button one event. As far as the Press to Select
qualities are concerned, the necessary options are exposed by the
driver in the sysfs filesystem now. Understanding their  effects on
how a press, drag, double press is detected is another matter.

I'll send a 2.6.11-rc4 based patch later today for consideration.

Stephen

^ permalink raw reply	[flat|nested] 24+ messages in thread

* Re: [PATCH 2.6.11-rc3] IBM Trackpoint support
  2005-02-13 19:13     ` Stephen Evanchik
  2005-02-13 19:31       ` Vojtech Pavlik
@ 2005-02-13 23:50       ` Dmitry Torokhov
  1 sibling, 0 replies; 24+ messages in thread
From: Dmitry Torokhov @ 2005-02-13 23:50 UTC (permalink / raw)
  To: Stephen Evanchik; +Cc: Vojtech Pavlik, linux-kernel

On Sunday 13 February 2005 14:13, Stephen Evanchik wrote:
> On Thu, 3 Feb 2005 22:52:44 -0500, Dmitry Torokhov
> <dtor_core@ameritech.net> wrote:
> > OK, I have read the code once again, and saw that you have special
> > handling within PS/2 protocol based on model constant. Please set
> > psmouse type to PSMOUSE_TRACKPOINT instead of model and provide full
> > protocol handler, like ALPS, Synaptics and Logitech do. Trackpoint
> > is different and complex enough to warrant it.
> 
> I'm not sure that I think a protocol handler is necessary unless I am
> misunderstanding what you mean. The TrackPoint is nothing more than a
> PS/2 mouse with 2 or 3 buttons that responds to an additional set of
> commands. The extra handling has to do with middle-to-scroll which
> could be done in userspace.
> 

If middle-to-scroll is movd to userspace and there is no trackpoint-
specific handling added to the "normal" psmouse handler then we don't
need a new handler of course.

-- 
Dmitry

^ permalink raw reply	[flat|nested] 24+ messages in thread

end of thread, other threads:[~2005-02-13 23:50 UTC | newest]

Thread overview: 24+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2005-02-03 22:43 [PATCH 2.6.11-rc3] IBM Trackpoint support Stephen Evanchik
2005-02-04  0:34 ` Dmitry Torokhov
2005-02-04  3:52   ` Dmitry Torokhov
2005-02-04  4:39     ` Stephen Evanchik
2005-02-13 19:13     ` Stephen Evanchik
2005-02-13 19:31       ` Vojtech Pavlik
2005-02-13 20:31         ` Stephen Evanchik
2005-02-13 23:50       ` Dmitry Torokhov
2005-02-04  6:35   ` Vojtech Pavlik
2005-02-04  6:46     ` Fabio Massimo Di Nitto
2005-02-04  6:52     ` Dmitry Torokhov
2005-02-04  6:54       ` Vojtech Pavlik
2005-02-04 14:17         ` Dmitry Torokhov
2005-02-04 14:45           ` Vojtech Pavlik
2005-02-05  6:56             ` Dmitry Torokhov
2005-02-05 12:24               ` Vojtech Pavlik
2005-02-04 13:17     ` Stephen Evanchik
2005-02-04 13:45       ` Vojtech Pavlik
2005-02-04 14:12         ` Dmitry Torokhov
2005-02-05 10:44 ` Pavel Machek
2005-02-07 10:14   ` Vojtech Pavlik
2005-02-13 19:07     ` Stephen Evanchik
2005-02-13 19:13       ` Vojtech Pavlik
2005-02-06 20:17 ` Domen Puncer

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).