# include # include # include // This code is free, as in beer // This program is based on some information at: // http://www.synaptics.com/support/dev_support.cfm // // as well as the program tpconfig from // http://www.compass.com/synaptics // /* WHY * * I *hate* the tapping feature on my Sony Z505. Alps completly Foobared it's design * and it makes random taps all over the place. With windows I had tapping disabled, * but when I switched to Linux it really wanted to tap. The program "tpconfig" * is out there and it will disable tapping when you have X stopped and gpm stopped * and are sitting at a root console window. However, I really wanted the ability * to put my laptop to sleep and be able to wake it back up in X and keep working. * Thus was born this hack. * * WHAT * * This program will open /dev/psaux (which is hopefully your glidepoint mouse!) and * send it its special sequence of keys to disable tapping. It will do this regardless * of whether you are in X or not and it wont mess up X if you are. Note that the * sequence of bytes it sends to disable tapping has this nasty side effect of * setting your resolution really low. So it also turns up the reosolution to a * "suitable" value. You can change this if you like (see note below) * * HOW * * Dont' ask how. Apparently the PS/2 protocol is a total hack. It does not support * in a clean way "vendor extensions". Thus if you want to control things that * are special about mice (such as tapping on the glide point) you send the mouse * clean looking commands that are within protocol spec for PS/2 mice, *but* on * the correct hardware are interpreted as special and do something magical. This * by the way is NOT the way to design hardware and software interfaces.... * So you see the string "magic" down below. That is the magic sequence of * bytes that make it work. The technical document available from synaptics has * a nice write up all about this. * */ // Here are some random notes about the PS/2 protocol // // Resend fe // ACK fa // Reset ff // Set defaults f6 // disable stream mode f5 // enable stream mode f4 // set sampling rate f3 followed by 10,20,40,60,80,100,200 // read device type f2 // set remote mode f0 // set wrap mode ee // reset wrap mode ec // read data eb // set stream mode ea // status request e9 // set resolution e8 // int main(int argc, char *argv[]) { int mode; int fd; // NOTE the last byte of this string. It is the resolution your mouse will end up in // after you run this. Legal values are 0x00, 0x01, 0x02, and 0x03 that correspond // to (if you believe the documentation), 1, 2, 4, and 8 counts per mm. Ofcourse, // YMMV. // // The first 10 bytes of this "magic" are a hack. See discussion above. // // The byte 0xeb is there just to make me feel better. The 10 byte prefix is a special // sequence for the Glidepoint, so the 11'th byte is there to make sure they stop // interpreting the sequnce. // // Final note. You may be able to tune the 10 byte sequence to work better and // not mess up your mouse resolution. I have no real glide point documentation // so I just acquired this sequence from the sources listed above. If you do // get a better sequence, do share. char magic[] = { 0xe9, 0xf5, 0xf5, 0xe8, 0x00, 0xf5, 0xf5, 0xf5, 0xe9, 0xf4,0xeb,0xe8,0x02 }; // when all else fails, send your mouse a reset! char reset[] = { 0xff }; if ( argc != 2 ) { printf("usage: %s reset|disable\n", argv[0]); return(1); } if ( !strcmp(argv[1], "reset")) mode = 0; else if ( !strcmp(argv[1], "disable")) mode = 1; else { printf("usage: %s reset|disable\n", argv[0]); return(2); } fd = open("/dev/psaux", O_RDWR); if(fd<0) { printf("error opening device\n"); return(1); } if(mode == 0) write(fd, reset, 1); else if(mode == 1) write(fd, magic, 13); close(fd); return(0); }