Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 31 Jul 2000 00:53:08 +0000
From:      Stephen Montgomery-Smith <stephen@math.missouri.edu>
To:        mobile@FreeBSD.ORG
Subject:   Configuring the touchpad
Message-ID:  <3984CDF4.3BC5F2A2@math.missouri.edu>

next in thread | raw e-mail | index | archive | help
I have a Dell Inspiron 7500 which comes with a touchpad for
mouse control.  I don't like the feature that tapping the
mousepad is like pressing the right mouse button.

I found this program tpconfig at
http://www.compass.com/synaptics/
which works nicely under Linux to allow one to configure the
touchpad in the way I desired, as well as in many other ways.

I tried to get this to work under FreeBSD, but it requires
a device /dev/psaux, which seems to be a raw mouse device 
(quite unlike /dev/psm0).

I guess one could write a raw mouse device for the PS2 interface -
I wouldn't know how to do that.  Or maybe there already is one
that I don't know about.

However, I was able to get tpconfig working.  The way I did this
was to create a ioctl for the device psm0 in the following
way:

struct mousedata mdata; int fd
fd = open("/dev/psm0", O_RDWR|O_NDELAY);
ioctl(fd,MOUSE_SENDREADCMD,&mdata)

What this does is to send a stream of bytes defined in mdata to
the mouse, then read what comes back from the mouse, and
put that in mdata.

Using this ioctl I was able to rewrite tpconfig with not too 
many changes so that it works under FreeBSD 4.1.

I wonder if this might be of general interest?  Really, I am
hacking the kernel, just as one would hack at a tree - I
did this by looking at the code and guessing what might work.
(I suspect that if something goes wrong in the kernel code that
the keyboard will stop working.)  So I really don't know
what I am doing, and maybe an expert will tell me that I am
doing it all wrong.  But it did work for me.

Here is what I did:

In sys/isa/psm.c add lines in the procedure psmioctl within
the switch(cmd) like:

    case MOUSE_SENDREADCMD:
        data = (mousedata_t *)addr;
        if (data->len > sizeof(data->buf)/sizeof(data->buf[0]))
            return EINVAL;

        error = block_mouse_data(sc, &command_byte);
        if (error)
            return error;
        for (s=0; s<data->len && !error; s++) {
            if ((send_aux_command(sc->kbdc, data->buf[s])) != PSM_ACK)
                error = EIO;
        }
        if (!error) {
            for (s = 0; s < sizeof(data->buf)/sizeof(data->buf[0]); s++) {
                data->buf[s] = read_aux_data(sc->kbdc);
                if (data->buf[s] < 0)
                    break;
            }
            if (s==sizeof(data->buf)/sizeof(data->buf[0]))
                error=EIO;
            else
                data->len=s;
        }
        unblock_mouse_data(sc, command_byte);
        break;

and in sys/i386/include/mouse.h add a line

#define MOUSE_SENDREADCMD       _IOWR('M', 14, mousedata_t)

Maybe (although I suspect not) one could make this work a 
different way by making /dev/psm0 writable.  But I cannot
figure out how to write a psmwrite function.  There is
this data structure called struct uio that I cannot figure
out.  So I didn't get to try this possibility.

What do you think?

Stephen


To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-mobile" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?3984CDF4.3BC5F2A2>