All of lore.kernel.org
 help / color / mirror / Atom feed
From: Vojtech Pavlik <vojtech@suse.cz>
To: akpm@osdl.org, dtor_core@ameritech.net, petero2@telia.com,
	Andries.Brouwer@cwi.nl, linux-kernel@vger.kernel.org
Subject: [PATCH 8/8] Add BTN_TOUCH to Synaptics driver. Update mousedev.
Date: Thu, 25 Sep 2003 18:50:12 +0200	[thread overview]
Message-ID: <10645086121286@twilight.ucw.cz> (raw)
In-Reply-To: <10645086122225@twilight.ucw.cz>

You can pull this changeset from:
	bk://kernel.bkbits.net/vojtech/input

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

ChangeSet@1.1348, 2003-09-25 18:32:35+02:00, vojtech@mail.parknet.co.jp
  input: Add BTN_TOUCH to Synaptics pad driver. This fixes the joydev
         grabbing of the pads, as well as simplifies the mousedev driver.


 mouse/synaptics.c |    4 ++
 mousedev.c        |   77 ++++++++++++++++++++++--------------------------------
 2 files changed, 36 insertions(+), 45 deletions(-)

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

diff -Nru a/drivers/input/mouse/synaptics.c b/drivers/input/mouse/synaptics.c
--- a/drivers/input/mouse/synaptics.c	Thu Sep 25 18:36:58 2003
+++ b/drivers/input/mouse/synaptics.c	Thu Sep 25 18:36:58 2003
@@ -333,6 +333,7 @@
 	set_bit(ABS_TOOL_WIDTH, dev->absbit);
 
 	set_bit(EV_KEY, dev->evbit);
+	set_bit(BTN_TOUCH, dev->keybit);
 	set_bit(BTN_TOOL_FINGER, dev->keybit);
 	set_bit(BTN_TOOL_DOUBLETAP, dev->keybit);
 	set_bit(BTN_TOOL_TRIPLETAP, dev->keybit);
@@ -531,6 +532,9 @@
 		input_report_abs(dev, ABS_Y, YMAX_NOMINAL + YMIN_NOMINAL - hw.y);
 	}
 	input_report_abs(dev, ABS_PRESSURE, hw.z);
+
+	if (hw.z > 30) input_report_key(dev, BTN_TOUCH, 1);
+	if (hw.z < 25) input_report_key(dev, BTN_TOUCH, 0);
 
 	input_report_abs(dev, ABS_TOOL_WIDTH, finger_width);
 	input_report_key(dev, BTN_TOOL_FINGER, num_fingers == 1);
diff -Nru a/drivers/input/mousedev.c b/drivers/input/mousedev.c
--- a/drivers/input/mousedev.c	Thu Sep 25 18:36:58 2003
+++ b/drivers/input/mousedev.c	Thu Sep 25 18:36:58 2003
@@ -83,59 +83,40 @@
 		return;
 
 	/* Handle touchpad data */
-	if (test_bit(BTN_TOOL_FINGER, handle->dev->keybit) &&
-	    test_bit(ABS_PRESSURE, handle->dev->absbit) &&
-	    test_bit(ABS_TOOL_WIDTH, handle->dev->absbit)) {
+	if (test_bit(BTN_TOOL_FINGER, handle->dev->keybit)) {
+
+		if (list->finger && list->finger < 3)
+			list->finger++;
+
 		switch (code) {
-		case ABS_PRESSURE:
-			if (!list->finger) {
-				if (value > 30)
-					list->finger = 1;
-			} else {
-				if (value < 25)
-					list->finger = 0;
-				else if (list->finger < 3)
-					list->finger++;
-			}
-			break;
-		case ABS_X:
-			if (list->finger >= 3) {
-				list->dx += (value - list->oldx) / 8;
-			}
-			list->oldx = value;
-			break;
-		case ABS_Y:
-			if (list->finger >= 3) {
-				list->dy -= (value - list->oldy) / 8;
-			}
-			list->oldy = value;
-			break;
+			case ABS_X:
+				if (list->finger == 3)
+					list->dx += (value - list->oldx) / 8;
+				list->oldx = value;
+				return;
+			case ABS_Y:
+				if (list->finger == 3)
+					list->dy -= (value - list->oldy) / 8;
+				list->oldy = value;
+				return;
 		}
 		return;
 	}
 
-	/* Handle tablet like devices */
+	/* Handle tablet data */
 	switch (code) {
-	case ABS_X:
-		size = handle->dev->absmax[ABS_X] - handle->dev->absmin[ABS_X];
-		if (size != 0) {
+		case ABS_X:
+			size = handle->dev->absmax[ABS_X] - handle->dev->absmin[ABS_X];
+			if (size == 0) size = xres;
 			list->dx += (value * xres - list->oldx) / size;
 			list->oldx += list->dx * size;
-		} else {
-			list->dx += value - list->oldx;
-			list->oldx += list->dx;
-		}
-		break;
-	case ABS_Y:
-		size = handle->dev->absmax[ABS_Y] - handle->dev->absmin[ABS_Y];
-		if (size != 0) {
+			return;
+		case ABS_Y:
+			size = handle->dev->absmax[ABS_Y] - handle->dev->absmin[ABS_Y];
+			if (size == 0) size = yres;
 			list->dy -= (value * yres - list->oldy) / size;
 			list->oldy -= list->dy * size;
-		} else {
-			list->dy -= value - list->oldy;
-			list->oldy -= list->dy;
-		}
-		break;
+			return;
 	}
 }
 
@@ -166,8 +147,13 @@
 
 				case EV_KEY:
 					switch (code) {
+						case BTN_TOUCH: /* Handle touchpad data */
+							if (test_bit(BTN_TOOL_FINGER, handle->dev->keybit)) {
+								list->finger = value;
+								return;
+							}
 						case BTN_0:
-						case BTN_TOUCH:
+						case BTN_FORWARD:
 						case BTN_LEFT:   index = 0; break;
 						case BTN_4:
 						case BTN_EXTRA:  if (list->mode == 2) { index = 4; break; }
@@ -175,6 +161,7 @@
 						case BTN_1:
 						case BTN_RIGHT:  index = 1; break;
 						case BTN_3:
+						case BTN_BACK:
 						case BTN_SIDE:   if (list->mode == 2) { index = 3; break; }
 						case BTN_2:
 						case BTN_STYLUS2:
@@ -333,7 +320,7 @@
 {
 	struct mousedev_list *list = file->private_data;
 	unsigned char c;
-	int i;
+	unsigned int i;
 
 	for (i = 0; i < count; i++) {
 


  reply	other threads:[~2003-09-25 16:50 UTC|newest]

Thread overview: 29+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2003-09-25 16:48 My current patches Vojtech Pavlik
2003-09-25 16:50 ` [PATCH 1/8] Revert synaptics->pktcnt change Vojtech Pavlik
2003-09-25 16:50   ` [PATCH 2/8] Fix multibutton handling in synaptics.c Vojtech Pavlik
2003-09-25 16:50     ` [PATCH 3/8] Synaptics code cleanups Vojtech Pavlik
2003-09-25 16:50       ` [PATCH 4/8] Add touchpad support to mousedev.c Vojtech Pavlik
2003-09-25 16:50         ` [PATCH 5/8] Rely less on sanity of AT keyboards Vojtech Pavlik
2003-09-25 16:50           ` [PATCH 6/8] Extend KD?BENT to handle > 256 keycodes Vojtech Pavlik
2003-09-25 16:50             ` [PATCH 7/8] Fix handling of rotated Synaptics touchpads Vojtech Pavlik
2003-09-25 16:50               ` Vojtech Pavlik [this message]
2003-09-25 18:23                 ` [PATCH 8/8] Add BTN_TOUCH to Synaptics driver. Update mousedev Dmitry Torokhov
2003-09-25 22:30                   ` Vojtech Pavlik
2003-09-26  5:24                     ` Peter Osterlund
2003-09-26  7:24                     ` Dmitry Torokhov
2003-09-26  7:54                       ` Vojtech Pavlik
2003-09-27  1:58                         ` Dmitry Torokhov
2003-09-27 20:19                         ` Pavel Machek
2003-09-27 21:05                           ` Vojtech Pavlik
2003-09-27 21:09                             ` Pavel Machek
2003-09-27 21:16                               ` Vojtech Pavlik
2003-09-27 21:18                                 ` Pavel Machek
2003-09-27 21:21                                   ` Vojtech Pavlik
2003-09-27 21:58                                     ` Matt Gibson
2003-09-28  9:49                                       ` Vojtech Pavlik
2003-09-25 22:57             ` [PATCH 6/8] Extend KD?BENT to handle > 256 keycodes Andrew Morton
2003-09-25 23:21               ` Vojtech Pavlik
2003-09-25 23:38             ` Andries Brouwer
2003-09-26  6:20               ` Vojtech Pavlik
2003-10-05 15:12           ` [PATCH 5/8] Rely less on sanity of AT keyboards Martin Josefsson
2003-09-25 18:13 ` My current patches Peter Osterlund

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=10645086121286@twilight.ucw.cz \
    --to=vojtech@suse.cz \
    --cc=Andries.Brouwer@cwi.nl \
    --cc=akpm@osdl.org \
    --cc=dtor_core@ameritech.net \
    --cc=linux-kernel@vger.kernel.org \
    --cc=petero2@telia.com \
    /path/to/YOUR_REPLY

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

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