Page 1 of 1
ps2mouse
Posted: Thu Jan 04, 2007 12:20 pm
by pulsar
In bochs this code sometimes enables mouse and sometimes dont. In vmware well it it always set the mouse byte to 0xFF. If mouse is disabled then keyboard is also disabled. I took a look at some sources, mobius seems to send some mouse packets. what is the need for those packets? the following code is identical to the code in menuetOS however this doesn;t read status after every command. I tried that too but it doesn't help.
Code: Select all
Ps2mousecommand( 0x20); // read byte
byte = Ps2mouseread();
print("\n mouse byte 0x%x",byte);
byte |= 0x02; // set INT2
Ps2mousecommand( 0x60);
Ps2mousewrite( byte);
Ps2mousecommand( 0xD4); /* write mouse device ; write aux port */
Ps2mousewrite( 0xF4); /* enable data reporting ; aux enable */
Posted: Sat Jan 06, 2007 11:35 pm
by pulsar
none of you seem to have interest in answering this post, but i can't proceed my gui design without enabling the mouse. once again i rephrase my question.
Is there any mistake in the above code?
should i send the following sequence of bytes? What are their purpose?
code taken from mobius ps2mouse driver
Code: Select all
static uint8_t s1[] = { 0xF3, 0xC8, 0xF3, 0x64, 0xF3, 0x50, 0 };
static uint8_t s2[] = { 0xF6, 0xE6, 0xF4, 0xF3, 0x64, 0xE8, 0x03, 0 };
Posted: Sat Jan 06, 2007 11:55 pm
by carbonBased
pulsar wrote:none of you seem to have interest in answering this post, but i can't proceed my gui design without enabling the mouse. once again i rephrase my question.
Is there any mistake in the above code?
should i send the following sequence of bytes? What are their purpose?
code taken from mobius ps2mouse driver
Code: Select all
static uint8_t s1[] = { 0xF3, 0xC8, 0xF3, 0x64, 0xF3, 0x50, 0 };
static uint8_t s2[] = { 0xF6, 0xE6, 0xF4, 0xF3, 0x64, 0xE8, 0x03, 0 };
Maybe you should actually take a look at the PS2 mouse specs, rather then trying to decipher someone else's driver, for now. Checking out the theory/interfaces before coding is always a good idea, IMO.
Potentially people aren't responding due to these details existing in the FAQ:
http://www.osdev.org/osfaq2/index.php/MouseInput
Hopefully that helps,
Jeff
PS: your posted code is using functions for which you haven't provided function body's...
Posted: Sat Jan 06, 2007 11:56 pm
by Alboin
Uh....Let me check the indispensable PC Hardware book......Okay!
Code: Select all
static uint8_t s1[] = { 0xF3, 0xC8, 0xF3, 0x64, 0xF3, 0x50, 0 };
static uint8_t s2[] = { 0xF6, 0xE6, 0xF4, 0xF3, 0x64, 0xE8, 0x03, 0 };
These are commands\arguments for the mouse....Here:
F3 - Set scan rate
C8 - 200 scan\s (rate for f3)
64 - 100 scan\s (rate for f3)
50 - 80 scans\s (rate for f3)
f6 - set standard (Initializes the mouse to normal values.)
e6 - Resets scaling
f4 - Activate
eb - read data in form of packet.
Posted: Sun Jan 07, 2007 6:30 am
by Seven11
I had problem with the PS/2 mouse for sometime with bochs. I found that increasing the delay made it work all the time.