Help needed in implementing PS/2 mouse

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
Afifalisaadman
Posts: 1
Joined: Fri Jan 23, 2026 2:12 am

Help needed in implementing PS/2 mouse

Post by Afifalisaadman »

:!: Warning : Bad code alert. Dont yell at me for enabling SSE. I will do full krnl mode. No trolls please

Hi,
I am trying to implement PS/2 mouse in my OS. But, even though it initializes successfully, it does not show ANY kind of data. I am using legacy PIC only(i disabled apic).
I need answers to these questions:
1. Is my code /logic incorrect ? If so,what is the solution?
2. Is the problem my code or my QEMU config or my QEMU build/version?
3. If it's not possible to implement PS/2, do I need to implement UHCI? Also, What kind for file system I should mount on the mouse? A fakefs or a virtfs?

Neccessary Info
1. Code: https://github.com/afifafifafifafifali/ ... /tree/main
2. QEMU Build: 4.2.0 (v4.2.0-11797-g2890edc853-dirty) (x86_64,windows exe, use this URL to install:https://drive.google.com/file/d/15PZQJC ... sp=sharing)
Octocontrabass
Member
Member
Posts: 6245
Joined: Mon Mar 25, 2013 7:01 pm

Re: Help needed in implementing PS/2 mouse

Post by Octocontrabass »

Afifalisaadman wrote: Fri Feb 20, 2026 12:44 amIs my code /logic incorrect ?
The mouse and keyboard are both connected to the same PS/2 controller. Your mouse driver directly accesses the PS/2 controller, so it can (and probably will) interfere with your keyboard driver.

There is a race condition. You enable IRQs before you install your IRQ handler.
Afifalisaadman wrote: Fri Feb 20, 2026 12:44 amAlso, What kind for file system I should mount on the mouse? A fakefs or a virtfs?
Since when can you mount a filesystem on a mouse?
Post Reply