1
0
Fork 0
forked from AbleOS/ableos

Attempt at enabling the scrollwheel.

This commit is contained in:
peony 2024-11-04 02:47:09 +01:00
parent 2b13242f7f
commit daced693fa

View file

@ -55,8 +55,6 @@ set_stream_mode := fn(): void @inline(send_command_byte, 0xEA)
set_non_linear_scaling := fn(): void @inline(send_command_byte, 0xE7) set_non_linear_scaling := fn(): void @inline(send_command_byte, 0xE7)
set_linear_scaling := fn(): void @inline(send_command_byte, 0xE6) set_linear_scaling := fn(): void @inline(send_command_byte, 0xE6)
resend_packet := fn(): void @inline(send_command_byte, 0xFE)
SampleRate := struct {value: u8} SampleRate := struct {value: u8}
sr10 := SampleRate.(10) sr10 := SampleRate.(10)
sr20 := SampleRate.(20) sr20 := SampleRate.(20)
@ -82,10 +80,14 @@ set_resolution := fn(resolution: Resolution): void {
@inline(send_command_byte, resolution.value) @inline(send_command_byte, resolution.value)
} }
set_up_mouse := fn(): void { MouseID := struct {data: u8}
@inline(reset_mouse) id0 := MouseID.(0)
@inline(set_resolution, res_8count_per_mm) id3 := MouseID.(3)
@inline(enable_streaming) id4 := MouseID.(4)
get_mouse_id := fn(): MouseID {
@inline(send_command_byte, 0xF2)
return MouseID.(memory.inb(0x60))
} }
button_states := @as(u8, 0) button_states := @as(u8, 0)
@ -96,7 +98,24 @@ main := fn(): int {
send_byte(0x64, 0xA8) send_byte(0x64, 0xA8)
log.info("Aux mouse device enabled.\0") log.info("Aux mouse device enabled.\0")
set_up_mouse() reset_mouse()
mouse_id := get_mouse_id()
log.info("Mouse ID:\0")
log.info(string.display_int(mouse_id.data, format_page, 10))
if mouse_id.data == 0 {
set_sample_rate(sr200)
set_sample_rate(sr100)
set_sample_rate(sr80)
mouse_id = get_mouse_id() //Returns 0 ;~;
set_sample_rate(sr100)
}
log.info("Mouse ID:\0")
log.info(string.display_int(mouse_id.data, format_page, 10))
enable_streaming()
loop { loop {
info := memory.inb(0x64) info := memory.inb(0x64)
@ -110,7 +129,6 @@ main := fn(): int {
if status == 0xAA { if status == 0xAA {
loop if memory.inb(0x60) == 0 break loop if memory.inb(0x60) == 0 break
log.info("Mouse plugged in!\0") log.info("Mouse plugged in!\0")
set_up_mouse()
continue continue
} }
@ -128,8 +146,6 @@ main := fn(): int {
button_states ^= changes button_states ^= changes
log.info(string.display_int(status, format_page, 10))
dx := i9.(false, 0) dx := i9.(false, 0)
dy := i9.(false, 0) dy := i9.(false, 0)