FreeBSD Bugzilla – Attachment 10794 Details for
Bug 21520
Configure the synaptics touchpad.
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
Remember
[x]
|
Forgot Password
Login:
[x]
file.shar
file.shar (text/plain), 11.19 KB, created by
Stephen Montgomery-Smith
on 2000-09-24 18:20:01 UTC
(
hide
)
Description:
file.shar
Filename:
MIME Type:
Creator:
Stephen Montgomery-Smith
Created:
2000-09-24 18:20:01 UTC
Size:
11.19 KB
patch
obsolete
># This is a shell archive. Save it in a file, remove anything before ># this line, and then unpack it by entering "sh file". Note, it may ># create directories; files and directories will be owned by you and ># have default permissions. ># ># This archive contains: ># ># synaptics ># synaptics/files ># synaptics/files/remouse ># synaptics/files/remouse.sh-sample ># synaptics/files/md5 ># synaptics/patches ># synaptics/patches/patch-aa ># synaptics/pkg ># synaptics/pkg/COMMENT ># synaptics/pkg/DESCR ># synaptics/pkg/PLIST ># synaptics/Makefile ># >echo c - synaptics >mkdir -p synaptics > /dev/null 2>&1 >echo c - synaptics/files >mkdir -p synaptics/files > /dev/null 2>&1 >echo x - synaptics/files/remouse >sed 's/^X//' >synaptics/files/remouse << 'END-of-synaptics/files/remouse' >X#!/bin/sh >X >X# Suck in the configuration variables. >Xif [ -r /etc/defaults/rc.conf ]; then >X . /etc/defaults/rc.conf >X source_rc_confs >Xelif [ -r /etc/rc.conf ]; then >X . /etc/rc.conf >Xfi >X >Xif [ -f /var/run/moused.pid ]; then >X kill `cat /var/run/moused.pid` >X rm -f /var/run/moused.pid >Xfi >X >X/usr/local/bin/tpconfig $@ >X >Xcase ${moused_enable} in >X[Yy][Ee][Ss]) >X /usr/sbin/moused -p ${moused_port} -t ${moused_type} ${moused_flags} >X ;; >Xesac >END-of-synaptics/files/remouse >echo x - synaptics/files/remouse.sh-sample >sed 's/^X//' >synaptics/files/remouse.sh-sample << 'END-of-synaptics/files/remouse.sh-sample' >X#!/bin/sh >Xcase "$1" in >X start) >X /usr/local/bin/remouse -t0 >X echo -n ' remouse' >X ;; >X stop) >X ;; >X restart) >X /usr/local/bin/remouse -t0 >X echo -n ' remouse' >X ;; >X -h) >X echo "Usage: `basename $0` { start | stop | restart }" >X ;; >X *) >X /usr/local/bin/remouse -t0 >X echo -n ' remouse' >X ;; >Xesac >END-of-synaptics/files/remouse.sh-sample >echo x - synaptics/files/md5 >sed 's/^X//' >synaptics/files/md5 << 'END-of-synaptics/files/md5' >XMD5 (synaptics-2.2.tar.gz) = 9cd5348a797081c2abead26a02f7365e >END-of-synaptics/files/md5 >echo c - synaptics/patches >mkdir -p synaptics/patches > /dev/null 2>&1 >echo x - synaptics/patches/patch-aa >sed 's/^X//' >synaptics/patches/patch-aa << 'END-of-synaptics/patches/patch-aa' >X--- ../synaptics-2.2/tpconfig.c Tue Feb 16 13:09:43 1999 >X+++ tpconfig.c Tue Aug 15 00:34:09 2000 >X@@ -55,11 +55,14 @@ >X #include <fcntl.h> >X #include <stdio.h> >X #include <unistd.h> >X-#include <assert.h> >X #include <sys/ioctl.h> >X #include <sys/time.h> >X #include <sys/timeb.h> >X >X+#include <machine/mouse.h> >X+ >X+#define exit_if_false(e) if (!(e)){printf("failed for %s\n",#e);exit(1);} >X+ >X >X #define fatal(string) \ >X { fprintf(stderr, "fatal: " string); exit(1); } >X@@ -67,10 +70,6 @@ >X /* Prototypes for PS/2 utility functions */ >X typedef unsigned char byte; >X >X-/* write a byte to the ps/2 port, handling ACK */ >X-void putbyte(int fd, byte b); >X-/* read a byte from the ps/2 port */ >X-byte getbyte(int fd); >X /* use the Synaptics extended ps/2 syntax to write a special command byte */ >X void send_cmd(int fd, byte cmd); >X /* write 'cmd' to mode byte 1 */ >X@@ -107,54 +106,13 @@ >X void set_firmware_options(int fd, FILE *info); >X >X >X-int tp_read(fd,buffer,num_bytes) >X- int fd; >X- char *buffer; >X- int num_bytes; >X-{ /* tp_read */ >X-#define TRUE 1 >X-#define FALSE 0 >X-#define TIMEOUT 3 /* wait for up to 3 seconds for a reply*/ >X-int bytes_read; >X-struct timeb start; >X-struct timeb now; >X-int at; >X-int left; >X- >X-#ifdef DEBUG >X-printf("Trying to read [%d] bytes \n",num_bytes); >X-#endif >X-/* Use the temporary buffer to store the data as it arrives */ >X-ftime(&start); >X-at = 0; >X-left = num_bytes; >X-do >X- { >X- bytes_read = read(fd,(buffer + at),left); >X- if(bytes_read > 0) >X- { >X- left = left - bytes_read; >X- at = at + bytes_read; >X- } >X- ftime(&now); >X- if((((now.time * 1000.0 + now.millitm) - >X- (start.time * 1000.0 + start.millitm)) / 1000.0) > TIMEOUT) >X- { >X- printf("\n\nTimed Out waiting to read from Touchpad\n\n"); >X- exit(-1); >X- } >X- } >X-while(left > 0); >X- >X-return(at); >X-} /* tp_read */ >X- >X >X /* initialize file description if hasn't already been done. */ >X void init_fd(int *fd) { >X+ >X if (*fd<0) { >X- *fd = open("/dev/psaux", O_RDWR|O_NDELAY); >X- if (*fd<0) fatal("Could not open /dev/psaux"); >X+ *fd = open("/dev/psm0", O_RDWR|O_NDELAY); >X+ if (*fd<0) fatal("Could not open /dev/psm2"); >X if (!is_touchpad(*fd)) >X fatal("\n\nNo Synaptics touchpad device was found.\n\n"); >X } >X@@ -167,21 +125,19 @@ >X byte b=0xff; >X byte ack; >X byte null; >X+struct mousedata data; >X fprintf(stderr,"Performing a Software Reset on TouchPad\n"); >X #ifdef DEBUG >X printf("Writing [0x%x] in reset_touchpad\n",b); >X #endif >X-write(fd, &b, 1); >X-tp_read(fd, &ack, 1); >X-#ifdef DEBUG >X-printf("Read [0x%x] in reset_touchpad ACK? (0xfa)\n",ack); >X-#endif >X-assert(ack==0xFA); >X-tp_read(fd, &null, 1); >X+data.len=1; >X+data.buf[0]=b; >X+exit_if_false(ioctl(fd,MOUSE_SENDREADCMD,&data)!=-1); >X #ifdef DEBUG >X-printf("Read [0x%x] in reset_touchpad NULL? (0x0)\n",null); >X+printf("Read [0x%x] in reset_touchpad NULL? (0x0)\n",data.buf[0]); >X #endif >X-assert(null==0x00); >X+printf("data.len = %d\n",data.len); >X+exit_if_false(data.len==1 && data.buf[0]==0x00); >X fprintf(stderr,"Software Reset of TouchPad DONE!\n\n"); >X } /* reset_touchpad */ >X >X@@ -324,7 +280,7 @@ >X else if((((mode1>>2)&1)==0) && (((cc>>2)&1)!=0)) >X fprintf(stderr,"Tap-to-drag NOT Correctly Set\n"); >X else if((((mode1>>2)&1)==1) && (((cc>>2)&1)==1)) >X- fprintf(stderr,"No tap gestures CORECTLY Set\n"); >X+ fprintf(stderr,"No tap gestures CORRECTLY Set\n"); >X else if((((mode1>>2)&1)==1) && (((cc>>2)&1)!=1)) >X fprintf(stderr,"No tap gestures NOT Correctly Set\n"); >X } >X@@ -621,74 +577,66 @@ >X /* PS/2 Utility functions. */ >X /*------------------------------------------------------------------------*/ >X >X-/* write a byte to the ps/2 port, handling ACK */ >X-void putbyte(int fd, byte b) { >X- byte ack; >X- int waiting = 0; >X- int ireturn = 0; >X-#ifdef DEBUG >X- printf("Writing [0x%x] in putbyte\n",b); >X-#endif >X- write(fd, &b, 1); >X-/* >X- ireturn = ioctl(fd,FIONREAD,&waiting); >X- if(waiting < 1) >X- { >X- printf("Timed Out waiting for Acknowledgement from Touchpad\n"); >X- } >X-*/ >X- tp_read(fd, &ack, 1); >X-#ifdef DEBUG >X- printf("Read [0x%x] in putbyte\n",ack); >X-#endif >X- assert(ack==0xFA); >X+void clear_data(struct mousedata *data) >X+{ >X+ data->len = 0; >X } >X-/* read a byte from the ps/2 port */ >X-byte getbyte(int fd) { >X- byte b; >X- tp_read(fd, &b, 1); >X-#ifdef DEBUG >X- printf("Read [0x%x] in getbyte\n",b); >X-#endif >X- return b; >X+ >X+void append_data(struct mousedata *data, byte b) >X+{ >X+ data->buf[data->len] = b; >X+ data->len++; >X } >X-/* use the Synaptics extended ps/2 syntax to write a special command byte */ >X-void send_cmd(int fd, byte cmd) { >X+ >X+void append_data_cmd(struct mousedata *data,byte cmd) >X+{ >X int i; >X /* initialize with 'inert' command */ >X- putbyte(fd, 0xE6); >X+ append_data(data, 0xE6); >X for (i=0; i<4; i++) { >X- putbyte(fd, 0xE8); >X- putbyte(fd, (cmd>>6)&0x3); >X+ append_data(data, 0xE8); >X+ append_data(data, (cmd>>6)&0x3); >X cmd<<=2; >X } >X } >X+ >X+ >X /* write 'cmd' to mode byte 1 */ >X void set_mode1(int fd, byte cmd) >X { >X+ struct mousedata data; >X+ >X if(single_mode_byte) >X set_mode2(fd,cmd); >X else >X { >X- send_cmd(fd, cmd); >X- putbyte(fd, 0xF3); >X- putbyte(fd, 0x0A); >X+ clear_data(&data); >X+ append_data_cmd(&data,cmd); >X+ append_data(&data, 0xF3); >X+ append_data(&data, 0x0A); >X+ exit_if_false(ioctl(fd,MOUSE_SENDREADCMD,&data)!=-1); >X } >X } >X /* write 'cmd' to mode byte 2 */ >X void set_mode2(int fd, byte cmd) { >X- send_cmd(fd, cmd); >X- putbyte(fd, 0xF3); >X- putbyte(fd, 0x14); >X+ struct mousedata data; >X+ clear_data(&data); >X+ append_data_cmd(&data,cmd); >X+ append_data(&data, 0xF3); >X+ append_data(&data, 0x14); >X+ exit_if_false(ioctl(fd,MOUSE_SENDREADCMD,&data)!=-1); >X } >X /* read three byte status ('a','b','c') corresponding to register 'cmd' */ >X void status_rqst(int fd, byte cmd, byte *byte1, byte *byte2, byte *byte3) { >X- byte chk; >X- send_cmd(fd, cmd); >X- putbyte(fd, 0xE9); >X- *byte1=getbyte(fd); >X- *byte2=getbyte(fd); >X- *byte3=getbyte(fd); >X+ struct mousedata data; >X+ clear_data(&data); >X+ append_data_cmd(&data,cmd); >X+ append_data(&data, 0xE9); >X+ exit_if_false(ioctl(fd,MOUSE_SENDREADCMD,&data)!=-1); >X+ exit_if_false(data.len==3); >X+ *byte1=data.buf[0]; >X+ *byte2=data.buf[1]; >X+ *byte3=data.buf[2]; >X } >X byte get_mode1(int fd) { >X byte a,b,c; >X@@ -717,10 +665,5 @@ >X #ifdef DEBUG >X printf("In is_touchpad, a,b,c [%x, %x %x]\n",a,b,c); >X #endif >X- while(a == ACK) >X- { /* 2.2.x kernel fix an extra ack preceeded the status */ >X- a=b;b=c; >X- c = getbyte(fd); >X- } >X return (b==0x47); >X } >END-of-synaptics/patches/patch-aa >echo c - synaptics/pkg >mkdir -p synaptics/pkg > /dev/null 2>&1 >echo x - synaptics/pkg/COMMENT >sed 's/^X//' >synaptics/pkg/COMMENT << 'END-of-synaptics/pkg/COMMENT' >XConfigure the synaptics touchpad >END-of-synaptics/pkg/COMMENT >echo x - synaptics/pkg/DESCR >sed 's/^X//' >synaptics/pkg/DESCR << 'END-of-synaptics/pkg/DESCR' >XThis program allows the user to configure a synaptics touchpad - >Xa pointing device used on many laptops. >X >XThe basic program is called tpconfig. Type tpconfig to see >Xall of its options. It will not work if any other program >Xis using the mouse (for example moused or X windows). Also, >Xyou should not touch the touchpad while this program is running. >X >XI have also included a program remouse. This first kills the >Xmoused daemon, then runs tpconfig with whatever options you have >Xset, and then restarts the moused daemon. >X >XAlso included is a file /usr/local/etc/rc.d/remouse.sh-sample. You >Xcan make whatever changes you like, and then rename it to >Xremouse.sh, and then remouse will be called upon boot up. >X >XIMPORTANT: this port will not compile or work unless some changes >Xare made to the kernel. You can find the required changes at >Xhttp://www.freebsd.org/cgi/query-pr.cgi?pr=20352 >X >XWWW: http://www.compass.com/synaptics/ >X >XStephen Montgomery-Smith >Xstephen@math.missouri.edu >END-of-synaptics/pkg/DESCR >echo x - synaptics/pkg/PLIST >sed 's/^X//' >synaptics/pkg/PLIST << 'END-of-synaptics/pkg/PLIST' >Xbin/tpconfig >Xbin/remouse >Xetc/rc.d/remouse.sh-sample >END-of-synaptics/pkg/PLIST >echo x - synaptics/Makefile >sed 's/^X//' >synaptics/Makefile << 'END-of-synaptics/Makefile' >X# New ports collection makefile for: synaptics >X# Date created: September 24 2000 >X# Whom: Stephen Montgomery-Smith <stephen@math.missouri.edu> >X# >X# $FreeBSD: >X# >X >XPORTNAME= synaptics >XPORTVERSION= 2.2 >XCATEGORIES= sysutils >XMASTER_SITES= http://www.compass.com/synaptics/ >X >XMAINTAINER= stephen@math.missouri.edu >X >XLIB_DEPENDS= gnugetopt:${PORTSDIR}/devel/libgnugetopt:install >X >XGNU_CONFIGURE= yes >XCONFIGURE_ENV+= CFLAGS="${CFLAGS} -I${PREFIX}/include" \ >X LDFLAGS=-L${PREFIX}/lib \ >X LIBS=-lgnugetopt >X >Xpre-patch: >X ${CHMOD} +w ${WRKSRC}/tpconfig.c >X >Xpost-install: >X strip ${PREFIX}/bin/tpconfig >X ${INSTALL_SCRIPT} ${FILESDIR}/remouse.sh-sample ${PREFIX}/etc/rc.d >X ${INSTALL_SCRIPT} ${FILESDIR}/remouse ${PREFIX}/bin >X >X.include <bsd.port.mk> >END-of-synaptics/Makefile >exit
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Raw
Actions:
View
Attachments on
bug 21520
: 10794