Re: Do not use synaptics extensions by default

From: Peter Osterlund
Date: Sat Jan 10 2004 - 16:34:52 EST


Sean Neakums <sneakums@xxxxxxxx> writes:

> Vojtech Pavlik <vojtech@xxxxxxx> 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@xxxxxxxxx
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@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/