MCPcopy Create free account
hub / github.com/LibertyOS-Development/kernel / intrh

Function intrh

src/dev/kbd/mod.rs:106–138  ·  view source on GitHub ↗

Interrupt handler

()

Source from the content-addressed store, hash-verified

104
105// Interrupt handler
106fn intrh()
107{
108 if let Some(ref mut keyboard) = *KBD.lock()
109 {
110 let scancode = read_scancode();
111
112 if let Ok(Some(key_event)) = keyboard.addbyte(scancode)
113 {
114 if let Some(key) = keyboard.proc_keyevent(key_event)
115 {
116 match key
117 {
118 // Unicode character
119 DecodedKey::Unicode(c) => sendkey(c),
120
121 // Up arrow
122 DecodedKey::RawKey(KeyCode::ArrowUp) => sendcsi('A'),
123
124 // Down arrow
125 DecodedKey::RawKey(KeyCode::ArrowDown) => sendcsi('B'),
126
127 // Right arrow
128 DecodedKey::RawKey(KeyCode::ArrowRight) => sendcsi('C'),
129
130 // Left arrow
131 DecodedKey::RawKey(KeyCode::ArrowLeft) => sendcsi('D'),
132
133 _ => {},
134 };
135 }
136 }
137 }
138}
139
140// Read scancode
141fn read_scancode() -> u8

Callers

nothing calls this directly

Calls 6

read_scancodeFunction · 0.85
sendkeyFunction · 0.85
sendcsiFunction · 0.85
lockMethod · 0.80
addbyteMethod · 0.80
proc_keyeventMethod · 0.80

Tested by

no test coverage detected