PS/2 Driver?

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.
Locked
smeezekitty
Member
Member
Posts: 50
Joined: Sat Mar 21, 2009 9:42 pm

PS/2 Driver?

Post by smeezekitty »

I looked at the wiki page for ps/2 mouse and most of it is over my head.
pretty much the only part i caught is that you reset the mouse then you read 3 packets
first one is state second is X third is Y but any ideas on implementation?
User avatar
Combuster
Member
Member
Posts: 9301
Joined: Wed Oct 18, 2006 3:45 am
Libera.chat IRC: [com]buster
Location: On the balcony, where I can actually keep 1½m distance
Contact:

Re: PS/2 Driver?

Post by Combuster »

Code: Select all

// wait for mouse
char status = read_byte();
// wait for mouse again
char dx = read_byte();
// wait for mouse once more
char dy = read_byte();
If that didn't answer the question...
"Certainly avoid yourself. He is a newbie and might not realize it. You'll hate his code deeply a few years down the road." - Sortie
[ My OS ] [ VDisk/SFS ]
User avatar
AJ
Member
Member
Posts: 2646
Joined: Sun Oct 22, 2006 7:01 am
Location: Devon, UK
Contact:

Re: PS/2 Driver?

Post by AJ »

Hi,
smeezekitty wrote:I looked at the wiki page for ps/2 mouse and most of it is over my head.
pretty much the only part i caught is that you reset the mouse then you read 3 packets
first one is state second is X third is Y but any ideas on implementation?
Please do more background reading. Until your post, I had never read the Mouse wiki page and have never implemented a mouse driver. I just read the page now and feel confident about basic mouse programming - everything is there. As you continue with OS Dev and more proprietary devices, you'll need to be able to read datasheets or even reverse engineer to write your drivers.

If you know about how to do basic IO and are familiar with your programming language, give it a go and ask questions if you run in to specific problems. If not, then learn how to do basic port IO and get familiar with your programming language.

Cheers,
Adam
Locked