OSDev.org

The Place to Start for Operating System Developers
It is currently Tue Apr 23, 2024 9:01 am

All times are UTC - 6 hours




Post new topic Reply to topic  [ 2 posts ] 
Author Message
 Post subject: Mouse Input article
PostPosted: Sat Feb 07, 2009 12:22 pm 
Offline
Member
Member
User avatar

Joined: Thu Oct 02, 2008 8:20 am
Posts: 67
Hello,

I think there is a typo in the Mouse Input article

Near the end of the page:
Quote:
If mouseID is 0, send: Set Samplerate 200, Set Samplerate 100, Set Samplerate 80, Get MouseID. If mouseID changed to 3, mouse has a scroll wheel, and is now in 4 byte packet mode.
If mouseID is 3, send: Set Samplerate 200, Set Samplerate 200, Set Samplerate 80, Get MouseID. If mouseID changed to 4, mouse has 5 mouse buttons -- otherwise only 3.


The second thing we should send when mouseID is 3 is certainly "samplerate 100" and not 200, though I'm not sure because the PS/2 chipset is such a strange thing


By the way you should also precise that the three or four packets each trigger a different IRQ12
On first IRQ12 you can only read the first data byte (port 0x60)
On the second you can only read the second data byte, etc.

I've learned this the hard way :)

Thanks BOCHS logs:
Quote:
00170792000d[KBD ] [mouse] Dx=1 Dy=1 Dz=0
00170792000d[KBD ] mouse_enQ(08)
00170792000d[KBD ] mouse_enQ(01)
00170792000d[KBD ] mouse_enQ(01)
00170850037d[KBD ] [mouse] read from 0x60 returns 0x08
00170850051d[KBD ] num_elements = 0
00170850051d[KBD ] read from port 60h with outb empty
00170850065d[KBD ] num_elements = 0
00170850065d[KBD ] read from port 60h with outb empty
00170850500d[KBD ] service_keyboard: key(from mouse) in internal buffer waiting
00170891288d[KBD ] [mouse] read from 0x60 returns 0x01
00170891302d[KBD ] num_elements = 0
00170891302d[KBD ] read from port 60h with outb empty
00170891316d[KBD ] num_elements = 0
00170891316d[KBD ] read from port 60h with outb empty
00170891500d[KBD ] service_keyboard: key(from mouse) in internal buffer waiting
00170932550d[KBD ] [mouse] read from 0x60 returns 0x01
00170932564d[KBD ] num_elements = 0
00170932564d[KBD ] read from port 60h with outb empty
00170932578d[KBD ] num_elements = 0
00170932578d[KBD ] read from port 60h with outb empty
00170933000d[KBD ] service_keyboard(): no keys waiting

_________________
MysteriOS
Currently working on: TCP/IP


Top
 Profile  
 
 Post subject: Re: Mouse Input article
PostPosted: Sat Feb 07, 2009 6:56 pm 
Offline
Member
Member
User avatar

Joined: Wed Feb 07, 2007 1:45 pm
Posts: 1401
Location: Eugene, OR, US
Hmmmm. I will look back into it -- but on first glance, I'm pretty sure the article is correct.
The SetSampleRate 200 command is what "turns on" the extra buttons and sets the new mode. You cannot repeat the same command as before, or it would set the same old mode as before.

And you do not precisely have to wait for an IRQ12 to get each byte. If port 0x64 says that there is another byte to read, you can read it without waiting for the next IRQ. You certainly cannot just go and do another inb(0x60), though. You MUST verify that there is a new char available using some method.

I am certainly planning on rewriting that article of mine sometime soon, however -- what is there now was only my first draft. So it certainly may need some modifications.


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 2 posts ] 

All times are UTC - 6 hours


Who is online

Users browsing this forum: No registered users and 37 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group