* [9fans] intellimouse
@ 1999-05-15 17:11 Dave
0 siblings, 0 replies; only message in thread
From: Dave @ 1999-05-15 17:11 UTC (permalink / raw)
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.
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~1999-05-15 17:11 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
1999-05-15 17:11 [9fans] intellimouse Dave
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).