From mboxrd@z Thu Jan 1 00:00:00 1970 Date: Sat, 15 May 1999 13:11:07 -0400 From: Dave Presotto presotto@plan9.bell-labs.com Subject: [9fans] intellimouse Topicbox-Message-UUID: 96783dce-eac8-11e9-9e20-41e7f4b1d025 Message-ID: <19990515171107.C9cdcanCAB6lO0oI7Ci7hBZktYftkNVAX9vFm4zMDIk@z> If anyone cares, we got an intellimouse working as a PS2 3 button mouse on brazil. The setup code follows. It's cleaner than in the plan 9 release since we've stuck the dance with the i8042 into a separate routine. int i8042auxcmd(int cmd) { unsigned int c; int tries; c = 0; tries = 0; ilock(&i8042lock); do{ if(tries++ > 2) break; if(outready() < 0) break; outb(Cmd, 0xD4); if(outready() < 0) break; outb(Data, cmd); if(outready() < 0) break; if(inready() < 0) break; c = inb(Data); } while(c == 0xFE || c == 0); iunlock(&i8042lock); if(c != 0xFA){ print("i8042: %2.2ux returned to the %2.2ux command\n", c, cmd); return -1; } return 0; } /* * set up a ps2 mouse */ static void ps2mouse(void) { if(mousetype == MousePS2) return; i8042auxenable(ps2mouseputc); /* make mouse streaming, enabled */ i8042auxcmd(0xEA); i8042auxcmd(0xF4); mousetype = MousePS2; } static void setintellimouse(void) { intellimouse = 1; switch(mousetype){ case MousePS2: i8042auxcmd(0xF3); /* set sample */ i8042auxcmd(0xC8); i8042auxcmd(0xF3); /* set sample */ i8042auxcmd(0x64); i8042auxcmd(0xF3); /* set sample */ i8042auxcmd(0x50); break; } } and in mousectl() ... } else if(strcmp(field[0], "ps2") == 0){ ps2mouse(); } else if(strcmp(field[0], "ps2intellimouse") == 0){ ps2mouse(); setintellimouse(); ... Cheers.