lkml.org 
[lkml]   [2004]   [Jan]   [10]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    /
    SubjectRe: Do not use synaptics extensions by default
    From
    Date
    Sean Neakums <sneakums@zork.net> writes:

    > Vojtech Pavlik <vojtech@suse.cz> writes:
    >
    > > On Sat, Jan 10, 2004 at 08:18:22PM +0000, Sean Neakums wrote:
    > >
    > >> Will this also result in the passthough port not being enabled?
    > >> (I'd like to disable it.)
    > >
    > > It depends on the touchpad firmware. Most leave it enabled.
    > > In this mode we don't have any control over the passthrough port.
    >
    > I notice that the passthrough appears as an extra device (mouse1 on my
    > system). Is there a way to disable devices from userspace?

    You can write a program that grabs the event device for exclusive
    access and then just ignores all events, like this:

    #include <sys/types.h>
    #include <sys/stat.h>
    #include <fcntl.h>
    #include <stdio.h>
    #include <errno.h>
    #include <sys/ioctl.h>
    #include <unistd.h>
    #include <string.h>
    #include <stdlib.h>

    /* From linux/include/linux/input.h */
    struct input_event {
    struct timeval time;
    unsigned short type;
    unsigned short code;
    unsigned int value;
    };

    #define EVDEV "/dev/input/event0"

    #define EVIOCGRAB _IOW('E', 0x90, int) /* Grab/Release device */

    int main(int argc, char* argv[])
    {
    const char* devName = EVDEV;
    int fd;
    int ret;

    if (argc > 1)
    devName = argv[1];

    fd = open(devName, O_RDONLY);
    if (fd < 0) {
    fprintf(stderr, "Can't open file %s, errno:%d (%s)\n",
    devName, errno, strerror(errno));
    exit(1);
    }

    ret = ioctl(fd, EVIOCGRAB, 1);
    if (ret < 0) {
    printf("Can't grab event device, errno:%d (%s)\n",
    errno, strerror(errno));
    exit(1);
    }

    for (;;) {
    struct input_event ev;
    read(fd, &ev, sizeof(ev));
    }

    close(fd);
    return 0;
    }

    --
    Peter Osterlund - petero2@telia.com
    http://w1.894.telia.com/~u89404340
    -
    To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
    the body of a message to majordomo@vger.kernel.org
    More majordomo info at http://vger.kernel.org/majordomo-info.html
    Please read the FAQ at http://www.tux.org/lkml/

    \
     
     \ /
      Last update: 2005-03-22 13:59    [W:0.023 / U:62.484 seconds]
    ©2003-2016 Jasper Spaans. hosted at Digital OceanAdvertise on this site