From owner-freebsd-mobile Sun Jul 30 22:53:30 2000 Delivered-To: freebsd-mobile@freebsd.org Received: from mail.rdc1.il.home.com (ha1.rdc1.il.home.com [24.2.1.66]) by hub.freebsd.org (Postfix) with ESMTP id D968037B5CF for ; Sun, 30 Jul 2000 22:53:26 -0700 (PDT) (envelope-from stephen@math.missouri.edu) Received: from math.missouri.edu ([24.12.197.197]) by mail.rdc1.il.home.com (InterMail vM.4.01.03.00 201-229-121) with ESMTP id <20000731055326.RULK21928.mail.rdc1.il.home.com@math.missouri.edu> for ; Sun, 30 Jul 2000 22:53:26 -0700 Message-ID: <3984CDF4.3BC5F2A2@math.missouri.edu> Date: Mon, 31 Jul 2000 00:53:08 +0000 From: Stephen Montgomery-Smith X-Mailer: Mozilla 4.74 [en] (X11; U; Linux 2.2.12 i386) X-Accept-Language: en MIME-Version: 1.0 To: mobile@FreeBSD.ORG Subject: Configuring the touchpad Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Sender: owner-freebsd-mobile@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.org 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; slen && !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