1
0
Fork 0
forked from koniifer/ableos

port clparse

This commit is contained in:
able 2022-08-06 22:12:48 -05:00
parent e8221f8513
commit e768c308e6
9 changed files with 53 additions and 19 deletions

11
Cargo.lock generated
View file

@ -31,6 +31,7 @@ dependencies = [
"axel", "axel",
"bitflags", "bitflags",
"bootloader", "bootloader",
"clparse",
"cpuio", "cpuio",
"ext2", "ext2",
"externc-libm", "externc-libm",
@ -161,6 +162,16 @@ version = "1.0.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd" checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd"
[[package]]
name = "clparse"
version = "0.1.0"
source = "git+https://git.ablecorp.us/able/core_utils#46a97f827bd11f3cea8dcab797b9697d9485c4b3"
dependencies = [
"hashbrown",
"log",
"toml",
]
[[package]] [[package]]
name = "colored" name = "colored"
version = "2.0.0" version = "2.0.0"

View file

@ -71,6 +71,8 @@ versioning = { git = "https://git.ablecorp.us/able/aos_userland" }
# embedded-graphics = "*" # embedded-graphics = "*"
pc-keyboard = "0.5" pc-keyboard = "0.5"
# mini-backtrace = "0.1" # mini-backtrace = "0.1"
clparse = { git = "https://git.ablecorp.us/able/core_utils", default-features = false }
[dependencies.linked_list_allocator] [dependencies.linked_list_allocator]
version = "0.9.0" version = "0.9.0"

View file

@ -6,6 +6,7 @@ user_processes = ["shell"]
enabled = true enabled = true
level = "Trace" level = "Trace"
log_to_serial = true log_to_serial = true
log_to_vterm = false
filter = ["ableos::ps2_mouse", "ableos::vterm"] filter = ["ableos::ps2_mouse", "ableos::vterm"]

View file

@ -140,7 +140,6 @@ extern "x86-interrupt" fn keyboard_interrupt_handler(_stack_frame: InterruptStac
DecodedKey::Unicode(chr) => match chr { DecodedKey::Unicode(chr) => match chr {
'\n' => { '\n' => {
KEYBUFF.lock().push('\n'); KEYBUFF.lock().push('\n');
trace!("ENTER");
} }
// Backspace // Backspace
'\u{8}' => { '\u{8}' => {

View file

@ -52,6 +52,7 @@ impl Default for KernelConfig {
pub struct LoggingConfig { pub struct LoggingConfig {
pub enabled: bool, pub enabled: bool,
pub log_to_serial: bool, pub log_to_serial: bool,
pub log_to_vterm: bool,
pub level: LogLevel, pub level: LogLevel,
pub filter: Vec<String>, pub filter: Vec<String>,
} }

View file

@ -17,3 +17,4 @@ impl DeviceID {
} }
pub const VMWARE_SVGA2: DeviceID = DeviceID::new(VMware, 0x0405); pub const VMWARE_SVGA2: DeviceID = DeviceID::new(VMware, 0x0405);
pub const S3INC_TRIO64V2: DeviceID = DeviceID::new(S3Inc, 0x8900);

View file

@ -9,7 +9,7 @@ use super::devices::*;
pub fn check_pci_support(device_id: DeviceID) -> bool { pub fn check_pci_support(device_id: DeviceID) -> bool {
match device_id { match device_id {
VMWARE_SVGA2 => true, VMWARE_SVGA2 => true,
S3INC_TRIO64V2 => true,
_ => false, _ => false,
} }
} }

View file

@ -47,18 +47,20 @@ impl log::Log for SimpleLogger {
None => 0, None => 0,
}; };
let msg = format!( if KERNEL_CONF.logging.log_to_vterm {
// "[{}{}$RESET$][$GREEN${}$RESET$]{}\n", let msg = format!(
"[{}{:05}\0RESET\0][\0GREEN\0{}\0RESET\0][\0BLUE\0{}@{}\0RESET\0] {}", // "[{}{}$RESET$][$GREEN${}$RESET$]{}\n",
color.1, "[{}{:05}\0RESET\0][\0GREEN\0{}\0RESET\0][\0BLUE\0{}@{}\0RESET\0] {}",
record.level(), color.1,
time_float, record.level(),
mod_path, time_float,
line, mod_path,
record.args(), line,
); record.args(),
);
// println!("{msg}"); println!("{msg}");
}
if KERNEL_CONF.logging.log_to_serial { if KERNEL_CONF.logging.log_to_serial {
serial_println!( serial_println!(

View file

@ -7,7 +7,6 @@
use crate::arch::drivers::sysinfo::master; use crate::arch::drivers::sysinfo::master;
use crate::arch::interrupts::{reset_pit_for_cpu, set_pit_2}; use crate::arch::interrupts::{reset_pit_for_cpu, set_pit_2};
use crate::devices::pci::brute_force_scan; use crate::devices::pci::brute_force_scan;
use crate::image::mono_bitmap::bruh;
use crate::systeminfo::{KERNEL_VERSION, RELEASE_TYPE}; use crate::systeminfo::{KERNEL_VERSION, RELEASE_TYPE};
use crate::time::fetch_time; use crate::time::fetch_time;
use crate::KERNEL_STATE; use crate::KERNEL_STATE;
@ -204,6 +203,21 @@ pub fn command_parser(user: String, command: String) {
let bin_name = iter.next().unwrap(); let bin_name = iter.next().unwrap();
let mut strin = String::new();
for stri in iter {
trace!("{}", stri);
strin.push_str(stri);
}
let conf_args;
match clparse::Arguments::parse_from_string(strin) {
Ok(ok) => conf_args = ok,
Err(err) => {
println!("ERROR: {}", err);
error!("{}", err);
return;
}
};
match bin_name { match bin_name {
// note: able asked for rhaish to stay in the repo but will be removed // note: able asked for rhaish to stay in the repo but will be removed
// in the future so just comment it out for now // in the future so just comment it out for now
@ -217,9 +231,12 @@ pub fn command_parser(user: String, command: String) {
} }
} }
"echo" => { "echo" => match conf_args.1.arguments.get("p") {
echo_file(iter.next().unwrap().to_string(), fs); Some(path) => echo_file(path.to_string(), fs),
}
None => println!("No path provided"),
},
"test" => {}
"quit" => shutdown(), "quit" => shutdown(),
@ -252,8 +269,8 @@ pub fn command_parser(user: String, command: String) {
let mut binary = vec![]; let mut binary = vec![];
file.read_to_end(&mut binary).unwrap(); file.read_to_end(&mut binary).unwrap();
let args = iter.collect::<Vec<&str>>(); // let args = iter.collect::<Vec<&str>>();
println!("{:?}", args); // println!("{:?}", args);
run_program(&binary); run_program(&binary);
} }
} }