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

Re: disable touchpad - accidental tap [was: Re: trackpad on powerbook]



On Sunday 13 of February 2005 20:53, Arkadiusz Miskiewicz wrote:

> One functionality is missing - ability to choose which device should be
> disabled and which not. For example it currently affects not only trackpad
> but also my external usb mouse which is bad for me.
>
> Fortunately it doesn't seem to be hard to add such support.

... no longer. Patch attached (user can avoid disabling USB and/or ADB devices).

ps. there seems to be bug in original sources
                       if (test_bit(EV_KEY, bit) && test_bit(EV_REP, bit)) {
                                ioctl(fd, EVIOCGID, id);
[...]
                       } else if (test_bit(EV_REL, bit)) {
                                if (id[ID_PRODUCT] != eventdevs[m].product ||
                                        id[ID_VENDOR]  != eventdevs[m].vendor) {

for else if case id isn't updated (missing ioctl(fd, EVIOCGID, id);).

Please apply to your sources.

> > --
> > Colin
> >   "When in doubt, do the right thing."

diff -urN mouseemu.org/mouseemu.c mouseemu/mouseemu.c
--- mouseemu.org/mouseemu.c 2004-04-05 16:23:54.000000000 +0200
+++ mouseemu/mouseemu.c 2005-02-13 21:19:45.000000000 +0100
@@ -47,6 +47,9 @@
 static kdev eventdevs[5];
 static input_handler ihandler[5];
 
+static int nousb = 0;
+static int noadb = 0;
+
 static void send_event(int type, int code, int value)
 {
  struct input_event event;
@@ -208,8 +211,14 @@
     }
     m++;
    } else if (test_bit(EV_REL, bit)) {
-    if (id[ID_PRODUCT] != eventdevs[m].product ||
-     id[ID_VENDOR]  != eventdevs[m].vendor) {
+        int skip = 0;
+        ioctl(fd, EVIOCGID, id);
+    if (nousb && (id[ID_BUS] == BUS_USB))
+        skip = 1;
+    if (noadb && (id[ID_BUS] == BUS_ADB))
+        skip = 1;
+    if (!skip && (id[ID_PRODUCT] != eventdevs[m].product ||
+     id[ID_VENDOR]  != eventdevs[m].vendor)) {
      if (eventdevs[m].handle >= 0) {
       unregister_inputhandler(eventdevs[m].handle);
       close(eventdevs[m].handle);
@@ -484,6 +493,14 @@
      nofork=1;
      continue;
     }
+    if (!strcmp(argv[i], "-skip-usb")) {
+         nousb=1;
+     continue;
+    }
+    if (!strcmp(argv[i], "-skip-adb")) {
+         noadb=1;
+     continue;
+    }
    }
   }
  }

-- 
Arkadiusz Miśkiewicz                    PLD/Linux Team
http://www.t17.ds.pwr.wroc.pl/~misiek/  http://ftp.pld-linux.org/



Reply to: