Skip to content

Commit 1c0c79f

Browse files
authored
Acknowledgment credits in ext description |
Acknowledgment stuff from https://wiki.osdev.org/PS/2_Mouse
1 parent 45c91a5 commit 1c0c79f

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed

kernel/devices/mouse/mouse.c

+14
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
11
#include "mouse.h"
2+
#include <log/log.h>
3+
#include <asm/io.h>
24

35
void mouse_driver(){
46
mouse_drvr_platypusos.init_mouse();
@@ -11,4 +13,16 @@ void init_mouse(){
1113
int left_butt_pressed = 0; // I did that on purpose xD
1214
int middle_butt_pressed = 0;
1315
int right_butt_pressed = 0;
16+
log(INFO, "Mouse initialized!");
17+
}
18+
19+
void work_mouse(){
20+
outb(0xD4, 0x64); // tell the controller to address the mouse
21+
outb(0xF3, 0x60); // write the mouse command code to the controller's data port
22+
while(!(inb(0x64) & 1) asm("pause"); // wait until we can read
23+
ack = inb(0x60); // read back acknowledge. This should be 0xFA
24+
outb(0xD4, 0x64); // tell the controller to address the mouse
25+
outb(100, 0x60); // write the parameter to the controller's data port
26+
while(!(inb(0x64) & 1) asm("pause"); // wait until we can read
27+
ack = inb(0x60); // read back acknowledge. This should be 0xFA
1428
}

0 commit comments

Comments
 (0)