Binary files synaptics/ddd.core and synfreebsd/ddd.core differ diff -dur -N synaptics/ps2comm.c synfreebsd/ps2comm.c --- synaptics/ps2comm.c Wed Dec 17 00:39:13 2003 +++ synfreebsd/ps2comm.c Wed Dec 31 22:09:18 2003 @@ -8,6 +8,9 @@ * Copyright (c) 2002 Linuxcare Inc. David Kennedy * adapted to version 0.12.1 * Copyright (c) 2003 Fred Hucht + * + * FreeBSD Hacking + * Copyright (c) 2003 Arne Schwabe * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License @@ -25,6 +28,10 @@ * */ +#include +#include +#include + #include "xf86_OSproc.h" #include "ps2comm.h" @@ -71,7 +78,7 @@ #define PS2_RES_RESOLUTION(r) (((r) >> 8) & 0x03) #define PS2_RES_SAMPLE_RATE(r) ((r) & 0xff) -/* #define DEBUG */ +#define DEBUG #ifdef DEBUG #define DBG(x) (x) @@ -102,28 +109,10 @@ return !Success; } -/* - * Write a byte to the ps/2 port, wait for ACK - */ static Bool -ps2_putbyte(int fd, byte b) +ps2_putbyte(int fd, int b) { - byte ack; - - if (xf86WriteSerial(fd, &b, 1) != 1) { - DBG(ErrorF("ps2_putbyte: error xf86WriteSerial\n")); - return !Success; - } - DBG(ErrorF("ps2_putbyte: byte %02X send\n", b)); - /* wait for an ACK */ - if (ps2_getbyte(fd, &ack) != Success) { - return !Success; - } - if (ack != PS2_ACK) { - DBG(ErrorF("ps2_putbyte: wrong acknowledge 0x%02x\n", ack)); - return !Success; - } - return Success; + return !Success; } /* @@ -132,24 +121,22 @@ * special command: 0xE8 rr 0xE8 ss 0xE8 tt 0xE8 uu where (rr*64)+(ss*16)+(tt*4)+uu * is the command. A 0xF3 or 0xE9 must follow (see ps2_send_cmd, ps2_set_mode) */ + +/* static Bool -ps2_special_cmd(int fd, byte cmd) +ps2_nono_special_cmd(int fd, byte cmd) { int i; - /* initialize with 'inert' command */ - if (ps2_putbyte(fd, PS2_CMD_SET_SCALING_1_1) == Success) - /* send 4x 2-bits with set resolution command */ - for (i = 0; i < 4; i++) { - if (((ps2_putbyte(fd, PS2_CMD_SET_RESOLUTION)) != Success) || - ((ps2_putbyte(fd, (cmd >> 6) & 0x3) != Success))) - return !Success; - cmd <<= 2; - } + + + else return !Success; + return Success; -} +}*/ + /* * Send a command to the synpatics touchpad by special commands @@ -157,8 +144,18 @@ static Bool ps2_send_cmd(int fd, byte c) { - DBG(ErrorF("send command: 0x%02X\n", c)); - return ps2_special_cmd(fd, c) || ps2_putbyte(fd, PS2_CMD_STATUS_REQUEST); + int ret; + + DBG(ErrorF("send command: 0x%02X ....", c)); + ret = ioctl(fd,MOUSE_SYNAPTICS_INFO,&c); + if (ret == -1) + { + DBG(ErrorF("(ps2sendcmd)failed%d, %d",ret, errno)); + return !Success; + }else{ + DBG(ErrorF("(ps2sendcmd)Sucess%d",ret)); + return Success; + } } /***************************************************************************** @@ -202,6 +199,9 @@ static Bool ps2_putbyte_passthrough(int fd, byte c) { + ErrorF("ps2_putbyte_passthrough broken\n"); + return !Success; + /* byte ack; ps2_special_cmd(fd, c); @@ -213,7 +213,7 @@ DBG(ErrorF("ps2_putbyte_passthrough: wrong acknowledge 0x%02x\n", ack)); return !Success; } - return Success; + return Success; */ } /***************************************************************************** @@ -226,10 +226,17 @@ Bool synaptics_set_mode(int fd, byte mode) { - DBG(ErrorF("set mode byte to: 0x%02X\n", mode)); - return (ps2_special_cmd(fd, mode) || - ps2_putbyte(fd, PS2_CMD_SET_SAMPLE_RATE) || - ps2_putbyte(fd, 0x14)); + + int ret; + DBG(ErrorF("send mode: 0x%02X\n", mode)); + ret = ioctl(fd,MOUSE_SYNAPTICS_CMD,&mode); + if (ret == -1) + { + DBG(ErrorF("Set mode ioctl failed",mode)); + return !Success; + } + return Success; + } /* @@ -243,7 +250,7 @@ xf86FlushInput(fd); DBG(ErrorF("Reset the Touchpad...\n")); if (ps2_putbyte(fd, PS2_CMD_RESET) != Success) { - DBG(ErrorF("...failed\n")); + DBG(ErrorF("...(reset)failed\n")); return !Success; } xf86WaitForInput(fd, 4000000); @@ -257,14 +264,15 @@ return !Success; } } - DBG(ErrorF("...failed\n")); + DBG(ErrorF("...(reset)failed\n")); return !Success; } Bool SynapticsResetPassthrough(int fd) { - byte ack; + + byte ack; /* send reset */ ps2_putbyte_passthrough(fd, 0xff); @@ -305,7 +313,7 @@ DBG(ErrorF("...done.\n")); return Success; } - DBG(ErrorF("...failed.\n")); + DBG(ErrorF("...(modeid)failed.\n")); return !Success; } @@ -340,11 +348,11 @@ "but I cannot read them.")); } } - DBG(ErrorF("...done.\n")); + DBG(ErrorF("...(capa)done.\n")); return Success; } } - DBG(ErrorF("...failed.\n")); + DBG(ErrorF("...(capa)failed.\n")); return !Success; } @@ -370,7 +378,7 @@ return Success; } } - DBG(ErrorF("...failed.\n")); + DBG(ErrorF("...(ident)failed.\n")); return !Success; } @@ -396,7 +404,7 @@ return Success; } } - DBG(ErrorF("...failed.\n")); + DBG(ErrorF("...(readmode)failed.\n")); return !Success; } @@ -416,20 +424,26 @@ Bool QueryIsSynaptics(int fd) { - unsigned long id = 0; - int i; + int ret; + int level=2; + mousehw_t mhw; + int model; - for (i = 0; i < 3; i++) { - if (SynapticsDisableDevice(fd) == Success) - break; - } + /* Put the device in Native protokoll mode to be sure + * Otherwise HWINFO will not return the right id */ + + ret = ioctl(fd,MOUSE_SETLEVEL,&level); + ret = ioctl(fd,MOUSE_GETHWINFO,&mhw); - xf86WaitForInput(fd, 20000); - xf86FlushInput(fd); - if (synaptics_identify(fd, &id) == Success) { - return TRUE; - } else { - ErrorF("Query no Synaptics: %06X\n", id); - return FALSE; + model = mhw.model; + if (mhw.model == MOUSE_MODEL_SYNAPTICS) + { + ErrorF("Found Synaptics: %d\n", model); + return TRUE; + } else { + ErrorF("Query no Synaptics: %d\n", model); + return FALSE; } + } + diff -dur -N synaptics/synaptics.c synfreebsd/synaptics.c --- synaptics/synaptics.c Wed Dec 17 00:39:13 2003 +++ synfreebsd/synaptics.c Wed Dec 31 22:39:45 2003 @@ -108,11 +108,12 @@ #define TIME_DIFF(a, b) ((long)((a)-(b))) #define SYSCALL(call) while (((call) == -1) && (errno == EINTR)) + /* for auto-dev: */ #define DEV_INPUT_EVENT "/dev/input" #define EVENT_DEV_NAME "event" -#define VERSION "0.12.2" +#define VERSION "0.12.2freebsd" /***************************************************************************** * Forward declaration @@ -1249,13 +1250,6 @@ } xf86Msg(X_PROBED, "%s synaptics touchpad found\n", local->name); - - retries = 3; - while ((retries++ <= 3) && (synaptics_reset(local->fd) != Success)) - xf86Msg(X_ERROR, "%s reset failed\n", local->name); - - if (synaptics_identify(local->fd, &priv->identity) != Success) - return !Success; para->identity = priv->identity; if (synaptics_model_id(local->fd, &priv->model_id) != Success) @@ -1285,9 +1279,9 @@ /* Disable the host to talk to the guest */ SynapticsDisableDevice(local->fd); /* Reset it, set defaults, streaming and enable it */ - if ((SynapticsResetPassthrough(local->fd)) != Success) { - priv->hasGuest = FALSE; - } + /* if ((SynapticsResetPassthrough(local->fd)) != Success) { + priv->hasGuest = FALSE; + } */ } SynapticsEnableDevice(local->fd); diff -dur -N synaptics/syndaemon.c synfreebsd/syndaemon.c --- synaptics/syndaemon.c Wed Dec 17 00:39:13 2003 +++ synfreebsd/syndaemon.c Tue Dec 30 20:08:07 2003 @@ -37,7 +37,7 @@ static int signals[] = { SIGHUP, SIGINT, SIGQUIT, SIGILL, SIGTRAP, SIGABRT, SIGBUS, SIGFPE, SIGUSR1, SIGSEGV, SIGUSR2, SIGPIPE, - SIGALRM, SIGTERM, SIGPWR + SIGALRM, SIGTERM }; int i; struct sigaction act; @@ -46,7 +46,7 @@ sigemptyset(&set); act.sa_handler = signal_handler; act.sa_mask = set; - act.sa_flags = SA_ONESHOT; + act.sa_flags = 0; /* SA_ONESHOT; */ for (i = 0; i < sizeof(signals) / sizeof(int); i++) { if (sigaction(signals[i], &act, 0) == -1) { diff -dur -N synaptics/testprotokoll.c synfreebsd/testprotokoll.c --- synaptics/testprotokoll.c Wed Dec 17 00:39:13 2003 +++ synfreebsd/testprotokoll.c Tue Dec 30 19:23:53 2003 @@ -1,5 +1,6 @@ #include #include +#include #include #include #include @@ -16,11 +17,12 @@ while (read(fd,&u, 1) == 1) { pBuf[count++] = u; + printf("|%02x|",u); /* check first byte */ if ((count == 1) && ((u & 0xC8) != 0x80)) { inSync = 0; count = 0; - printf("Synaptics driver lost sync at 1st byte\n"); + printf("Synaptics driver lost sync at 1st byte: %02x\n",u); continue; } @@ -62,17 +64,26 @@ int main(int argc, char* argv[]) { int fd; + int level; + int ret; if (argc > 1) outputformat = atoi(argv[1]); - fd = open("/dev/psaux", O_RDONLY); + fd = open("/dev/bpsm0", O_RDONLY); if (fd == -1) { - printf("Error opening /dev/psaux\n"); - exit(1); + printf("Error opening /dev/psaux\n"); + exit(1); } + + level =2; + ret = ioctl(fd,MOUSE_SETLEVEL,level); + printf("Set level return %d\n",ret); + ret = ioctl(fd,MOUSE_GETLEVEL,level); + printf("Get level %d, %d\n",level,ret); + SynapticsReadPacket(fd); close(fd);