you should be able to test the keyboard, connect +5 (VCC) and ground to the eyboard or mouse then press the key you need to know its cod and read th output from data output bus of your device.
to know the cable confegurations search for PS2 or com1 datasheet (from Mother bourd catalog).
I´ve been searching for the serial protocol for serial mouses. I´m planning to use a mouse as a quadrature rotary encoder. Is it too slow for this application??? What´s the meaning of the bytes transmitted by the serial mouse??