Patch keyboard capslock alt (#219)

* keyboard-alt-capslock

* 解决键盘输入'%'字符的时候无法回显的bug

---------

Co-authored-by: longjin <longjin@RinGoTek.cn>
This commit is contained in:
Gou Ngai
2023-03-31 18:23:58 +08:00
committed by GitHub
parent 20e3152e1e
commit d7b31a969f
3 changed files with 76 additions and 37 deletions

View File

@ -5,7 +5,7 @@ use thingbuf::mpsc::{
errors::{TryRecvError, TrySendError},
};
use crate::{libs::rwlock::RwLock, kdebug};
use crate::libs::rwlock::RwLock;
pub mod tty_device;
@ -286,7 +286,7 @@ impl TtyCore {
pub fn disable_echo(&self) {
self.state.write().set(TtyCoreState::ECHO_ON, false);
}
/// @brief 判断当前tty核心是否开启了输入回显
///
/// @return true 开启了输入回显

View File

@ -9,10 +9,9 @@ use crate::{
devfs::{devfs_register, DevFS, DeviceINode},
vfs::{file::FileMode, FilePrivateData, FileType, IndexNode, Metadata, ROOT_INODE},
},
include::bindings::bindings::{printk_color, textui_putchar, BLACK, WHITE},
kdebug, kerror,
include::bindings::bindings::{textui_putchar, BLACK, WHITE},
kerror,
libs::rwlock::RwLock,
print,
syscall::SystemError,
};
@ -240,7 +239,7 @@ impl IndexNode for TtyDevice {
loop {
let mut buf = [0u8; 512];
let r: Result<usize, TtyError> = self.core.read_output(&mut buf[0..511], false);
let r: Result<usize, TtyError> = self.core.output(&mut buf[0..511], false);
let len;
match r {
Ok(x) => {
@ -256,9 +255,11 @@ impl IndexNode for TtyDevice {
break;
}
// 输出到屏幕
print!("{}", unsafe {
core::str::from_utf8_unchecked(&buf[0..len])
});
unsafe {
for x in buf {
textui_putchar(x as u16, WHITE, BLACK);
}
}
}
return Ok(());
}