ps2mouse

Question about which tools to use, bugs, the best way to implement a function, etc should go here. Don't forget to see if your question is answered in the wiki first! When in doubt post here.
Post Reply
User avatar
pulsar
Member
Member
Posts: 49
Joined: Wed Nov 22, 2006 1:01 am
Location: chennai

ps2mouse

Post 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 */
everyone here are best programmers ( not yet not yet)
User avatar
pulsar
Member
Member
Posts: 49
Joined: Wed Nov 22, 2006 1:01 am
Location: chennai

Post 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 };
everyone here are best programmers ( not yet not yet)
User avatar
carbonBased
Member
Member
Posts: 382
Joined: Sat Nov 20, 2004 12:00 am
Location: Wellesley, Ontario, Canada
Contact:

Post 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...
User avatar
Alboin
Member
Member
Posts: 1466
Joined: Thu Jan 04, 2007 3:29 pm
Location: Noricum and Pannonia

Post 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.
C8H10N4O2 | #446691 | Trust the nodes.
Seven11
Member
Member
Posts: 25
Joined: Mon Oct 30, 2006 12:48 pm

Post 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.
Post Reply