[PATCH] Absolute mode event interface for synaptics touchpad 2

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Sorry I forgot some options to the diff ...

Regards
--- mice.c	Fri Aug  8 14:10:56 2003
+++ miceev.c	Fri Aug  8 14:08:15 2003
@@ -233,11 +233,28 @@
 /*========================================================================*/
 
 #ifdef HAVE_LINUX_INPUT_H
+#define EVDEV_ABS_MIN	1000
+#define EVDEV_ABS_DEADZ	300
+#define EVDEV_ABS_MIN_X (1300+EVDEV_ABS_DEADZ)
+#define EVDEV_ABS_MIN_Y (1200+EVDEV_ABS_DEADZ)
+#define EVDEV_ABS_MAX_X (5650-EVDEV_ABS_MIN_X-EVDEV_ABS_DEADZ)
+#define EVDEV_ABS_MAX_Y (4400-EVDEV_ABS_MIN_Y-EVDEV_ABS_DEADZ)
+/* evdev absolute mode for synaptic in linux-2.6.0-test2 */
 static int M_evdev (Gpm_Event * state, unsigned char *data)
 {
    struct input_event thisevent;
    (void) memcpy (&thisevent, data, sizeof (struct input_event));
-   if (thisevent.type == EV_REL) {
+   // printf("%d\t%d\t%d\t%d\t%d\n",thisevent.type,thisevent.code,thisevent.value,state->x,state->y);
+   if (thisevent.type == EV_ABS && thisevent.value > EVDEV_ABS_MIN) {
+	thisevent.type-=EVDEV_ABS_DEADZ;
+      if (thisevent.code == ABS_X){
+	 thisevent.value-=EVDEV_ABS_MIN_X;
+	    state->x = (signed char) ((thisevent.value*win.ws_col)/EVDEV_ABS_MAX_X);
+      }else if (thisevent.code == ABS_Y){
+	 thisevent.value-=EVDEV_ABS_MIN_Y;
+	 state->y = (signed char) (win.ws_row-((thisevent.value*win.ws_row)/EVDEV_ABS_MAX_Y));
+      }
+   } else if (thisevent.type == EV_REL) {
       if (thisevent.code == REL_X)
          state->dx = (signed char) thisevent.value;
       else if (thisevent.code == REL_Y)
@@ -2242,7 +2259,7 @@
 #ifdef HAVE_LINUX_INPUT_H
    {"evdev", "Linux Event Device",
             "", M_evdev, I_empty, STD_FLG,
-                        {0x00, 0x00, 0x00, 0x00} , 16, 16, 0, 0, NULL},
+                        {0x00, 0x00, 0x00, 0x00} , 16, 16, 0, 1, NULL},
 #endif /* HAVE_LINUX_INPUT_H */
    {"exps2",   "IntelliMouse Explorer (ps2) - 3 buttons, wheel unused",
            "ExplorerPS/2", M_imps2, I_exps2, STD_FLG,

Attachment: pgp00077.pgp
Description: PGP signature


[Index of Archives]     [Kernel Development]     [Red Hat Install]     [Red Hat Watch]     [Red Hat Development]     [Gimp]     [Yosemite News]