1
0
Fork 0
forked from AbleOS/ableos

Merged once more

This commit is contained in:
peony 2024-11-24 13:31:57 +01:00
parent f4ceab972c
commit f7f9fece4f
2 changed files with 42 additions and 34 deletions

50
Cargo.lock generated
View file

@ -213,12 +213,12 @@ dependencies = [
[[package]] [[package]]
name = "hbbytecode" name = "hbbytecode"
version = "0.1.0" version = "0.1.0"
source = "git+https://git.ablecorp.us/AbleOS/holey-bytes.git#37dd13cab295aa9e74d704b3345685b4428d149a" source = "git+https://git.ablecorp.us/AbleOS/holey-bytes.git#9dfb2eb606e9049bc5d372e674a75e0be2c57ff0"
[[package]] [[package]]
name = "hblang" name = "hblang"
version = "0.1.0" version = "0.1.0"
source = "git+https://git.ablecorp.us/AbleOS/holey-bytes.git#37dd13cab295aa9e74d704b3345685b4428d149a" source = "git+https://git.ablecorp.us/AbleOS/holey-bytes.git#9dfb2eb606e9049bc5d372e674a75e0be2c57ff0"
dependencies = [ dependencies = [
"hashbrown", "hashbrown",
"hbbytecode", "hbbytecode",
@ -229,7 +229,7 @@ dependencies = [
[[package]] [[package]]
name = "hbvm" name = "hbvm"
version = "0.1.0" version = "0.1.0"
source = "git+https://git.ablecorp.us/AbleOS/holey-bytes.git#37dd13cab295aa9e74d704b3345685b4428d149a" source = "git+https://git.ablecorp.us/AbleOS/holey-bytes.git#9dfb2eb606e9049bc5d372e674a75e0be2c57ff0"
dependencies = [ dependencies = [
"hbbytecode", "hbbytecode",
] ]
@ -424,9 +424,9 @@ checksum = "02034f8f6b3e7bf050f310fbaf6db0018b8e54b75598d0a4c97172054752fede"
[[package]] [[package]]
name = "litemap" name = "litemap"
version = "0.7.3" version = "0.7.4"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "643cb0b8d4fcc284004d5fd0d67ccf61dfffadb7f75e1e71bc420f4688a3a704" checksum = "4ee93343901ab17bd981295f2cf0026d4ad018c7c31ba84549a4ddbb47a45104"
[[package]] [[package]]
name = "lock_api" name = "lock_api"
@ -503,9 +503,9 @@ checksum = "e3148f5046208a5d56bcfc03053e3ca6334e51da8dfb19b6cdc8b306fae3283e"
[[package]] [[package]]
name = "proc-macro2" name = "proc-macro2"
version = "1.0.89" version = "1.0.92"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f139b0662de085916d1fb67d2b4169d1addddda1919e696f3252b740b629986e" checksum = "37d3544b3f2748c54e147655edb5025752e2303145b5aefb3c3ea2c78b973bb0"
dependencies = [ dependencies = [
"unicode-ident", "unicode-ident",
] ]
@ -584,9 +584,9 @@ dependencies = [
[[package]] [[package]]
name = "rustls" name = "rustls"
version = "0.23.17" version = "0.23.18"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "7f1a745511c54ba6d4465e8d5dfbd81b45791756de28d4981af70d6dca128f1e" checksum = "9c9cc1d47e243d655ace55ed38201c19ae02c148ae56412ab8750e8f0166ab7f"
dependencies = [ dependencies = [
"log", "log",
"once_cell", "once_cell",
@ -717,9 +717,9 @@ checksum = "13c2bddecc57b384dee18652358fb23172facb8a2c51ccc10d74c157bdea3292"
[[package]] [[package]]
name = "syn" name = "syn"
version = "2.0.87" version = "2.0.89"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "25aa4ce346d03a6dcd68dd8b4010bcb74e54e62c90c573f394c46eae99aba32d" checksum = "44d46482f1c1c87acd84dea20c1bf5ebff4c757009ed6bf19cfd36fb10e92c4e"
dependencies = [ dependencies = [
"proc-macro2", "proc-macro2",
"quote", "quote",
@ -800,9 +800,9 @@ dependencies = [
[[package]] [[package]]
name = "unicode-ident" name = "unicode-ident"
version = "1.0.13" version = "1.0.14"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e91b56cd4cadaeb79bbf1a5645f6b4f8dc5bde8834ad5894a8db35fda9efa1fe" checksum = "adb9e6ca4f869e1180728b7950e35922a7fc6397f7b641499e8f3ef06e50dc83"
[[package]] [[package]]
name = "unicode-xid" name = "unicode-xid"
@ -833,9 +833,9 @@ dependencies = [
[[package]] [[package]]
name = "url" name = "url"
version = "2.5.3" version = "2.5.4"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "8d157f1b96d14500ffdc1f10ba712e780825526c03d9a49b4d0324b0d9113ada" checksum = "32f8b686cadd1473f4bd0117a5d28d36b1ade384ea9b5069a1c40aefed7fda60"
dependencies = [ dependencies = [
"form_urlencoded", "form_urlencoded",
"idna", "idna",
@ -876,9 +876,9 @@ checksum = "9c8d87e72b64a3b4db28d11ce29237c246188f4f51057d65a7eab63b7987e423"
[[package]] [[package]]
name = "webpki-roots" name = "webpki-roots"
version = "0.26.6" version = "0.26.7"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "841c67bff177718f1d4dfefde8d8f0e78f9b6589319ba88312f567fc5841a958" checksum = "5d642ff16b7e79272ae451b7322067cdc17cadf68c23264be9d94a32319efe7e"
dependencies = [ dependencies = [
"rustls-pki-types", "rustls-pki-types",
] ]
@ -1035,9 +1035,9 @@ dependencies = [
[[package]] [[package]]
name = "yoke" name = "yoke"
version = "0.7.4" version = "0.7.5"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "6c5b1314b079b0930c31e3af543d8ee1757b1951ae1e1565ec704403a7240ca5" checksum = "120e6aef9aa629e3d4f52dc8cc43a015c7724194c97dfaf45180d2daf2b77f40"
dependencies = [ dependencies = [
"serde", "serde",
"stable_deref_trait", "stable_deref_trait",
@ -1047,9 +1047,9 @@ dependencies = [
[[package]] [[package]]
name = "yoke-derive" name = "yoke-derive"
version = "0.7.4" version = "0.7.5"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "28cc31741b18cb6f1d5ff12f5b7523e3d6eb0852bbbad19d73905511d9849b95" checksum = "2380878cad4ac9aac1e2435f3eb4020e8374b5f13c296cb75b4620ff8e229154"
dependencies = [ dependencies = [
"proc-macro2", "proc-macro2",
"quote", "quote",
@ -1059,18 +1059,18 @@ dependencies = [
[[package]] [[package]]
name = "zerofrom" name = "zerofrom"
version = "0.1.4" version = "0.1.5"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "91ec111ce797d0e0784a1116d0ddcdbea84322cd79e5d5ad173daeba4f93ab55" checksum = "cff3ee08c995dee1859d998dea82f7374f2826091dd9cd47def953cae446cd2e"
dependencies = [ dependencies = [
"zerofrom-derive", "zerofrom-derive",
] ]
[[package]] [[package]]
name = "zerofrom-derive" name = "zerofrom-derive"
version = "0.1.4" version = "0.1.5"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "0ea7b4a3637ea8669cedf0f1fd5c286a17f3de97b8dd5a70a6c167a1730e63a5" checksum = "595eed982f7d355beb85837f651fa22e90b3c044842dc7f2c2842c086f295808"
dependencies = [ dependencies = [
"proc-macro2", "proc-macro2",
"quote", "quote",

View file

@ -2,15 +2,16 @@
.{MouseEvent} := @use("../../../libraries/intouch/src/lib.hb").events; .{MouseEvent} := @use("../../../libraries/intouch/src/lib.hb").events;
.{bit0, bit1, bit2, bit3, bit4} := @use("bits.hb") .{bit0, bit1, bit2, bit3, bit4} := @use("bits.hb")
devices := @use("devices.hb") devices := @use("devices.hb")
controller := @use("controller.hb") controller := @use("controller.hb");
.{Info, Port} := controller
mouse := @use("mouse.hb") mouse := @use("mouse.hb")
format_page := memory.dangling(u8) format_page := memory.dangling(u8)
mouse_buffer := 0 mouse_buffer := 0
keyboard_buffer := 0 keyboard_buffer := 0
info := controller.Info.(0) info := Info.(0)
send_command := fn(port: ^controller.Port, byte: u8): void { send_command := fn(port: ^Port, byte: u8): void {
tries := 3 tries := 3
loop if tries == 0 break else { loop if tries == 0 break else {
controller.send_byte(port, byte) controller.send_byte(port, byte)
@ -37,6 +38,10 @@ send_command := fn(port: ^controller.Port, byte: u8): void {
} }
} }
enable_streaming := fn(port: ^Port): void {
@inline(send_command, port, 0xF4)
}
process := fn(port: ^controller.Port): void { process := fn(port: ^controller.Port): void {
if port.device.value < devices.MOUSE_5_BUTTON.value { if port.device.value < devices.MOUSE_5_BUTTON.value {
event := MouseEvent.(0, 0, false, false, false) event := MouseEvent.(0, 0, false, false, false)
@ -52,7 +57,7 @@ process := fn(port: ^controller.Port): void {
} else if port.device == devices.MOUSE_INIT_1 { } else if port.device == devices.MOUSE_INIT_1 {
port.device.value = port.packet[0] port.device.value = port.packet[0]
if port.device != devices.MOUSE_SCROLLWHEEL { if port.device != devices.MOUSE_SCROLLWHEEL {
controller.send_byte(port, 0xF4) enable_streaming(port)
return return
} }
port.device = devices.MOUSE_INIT_2 port.device = devices.MOUSE_INIT_2
@ -61,9 +66,11 @@ process := fn(port: ^controller.Port): void {
} else if port.device == devices.NO_DEVICE { } else if port.device == devices.NO_DEVICE {
if port.packet_length == 1 { if port.packet_length == 1 {
port.device.value = port.packet[0] port.device.value = port.packet[0]
enable_streaming(port)
//TODO: Upgrade mouse.
} else { } else {
port.device.value = port.packet[1] | port.packet[0] << 8 port.device.value = port.packet[1] | port.packet[0] << 8
send_command(port, 0xF4) enable_streaming(port)
} }
log.info("Identified device!\0") log.info("Identified device!\0")
log.info(string.display_int(port.device.value, format_page, 16)) log.info(string.display_int(port.device.value, format_page, 16))
@ -107,10 +114,11 @@ main := fn(): void {
controller.init() controller.init()
if controller.port1.exists { if controller.port1.exists {
controller.send_byte(&controller.port1, 0xF4) //log.info("Port 1 exists.\0")
controller.send_byte(@bitcast(0), 0xF4)
} }
if controller.port2.exists { if controller.port2.exists {
controller.send_byte(&controller.port2, 0xF4) //controller.send_byte(&controller.port2, 0xF4)
} }
loop { loop {
@ -122,7 +130,7 @@ main := fn(): void {
if controller.check_parity(info) { if controller.check_parity(info) {
log.error("Parity error! Cannot handle these!\0") log.error("Parity error! Cannot handle these!\0")
} }
/*
if controller.has_input(info) { if controller.has_input(info) {
port := controller.get_port(info) port := controller.get_port(info)
if port.packet_length > 0 & check_complete(port) { if port.packet_length > 0 & check_complete(port) {
@ -139,6 +147,6 @@ main := fn(): void {
process(port) process(port)
port.packet_length = 0 port.packet_length = 0
} }
} }*/
} }
} }