* Port previous ethernet scheme

* Add ipd

* Fix initfs rebuilds, use QEMU user networking addresses in ipd

* Add tcp/udp, netutils, dns, and network config

* Add fsync to network driver

* Add dns, router, subnet by default

* Fix e1000 driver. Make ethernet and IP non-blocking to avoid deadlocks

* Add orbital server, WIP

* Add futex

* Add orbutils and orbital

* Update libstd, orbutils, and orbital
Move ANSI key encoding to vesad

* Add orbital assets

* Update orbital

* Update to add login manager

* Add blocking primitives, block for most things except waitpid, update orbital

* Wait in waitpid and IRQ, improvements for other waits

* Fevent in root scheme

* WIP: Switch to using fevent

* Reorganize

* Event based e1000d driver

* Superuser-only access to some network schemes, display, and disk

* Superuser root and irq schemes

* Fix orbital
This commit is contained in:
Jeremy Soller 2016-10-13 17:21:42 -06:00 committed by GitHub
parent 372d44f88c
commit 224c43f761
92 changed files with 3415 additions and 473 deletions

View file

@ -1,7 +1,8 @@
use std::fs::File;
use std::io::{Read, Write};
use std::mem;
use std::thread;
use orbclient::KeyEvent;
use keymap;
@ -9,7 +10,6 @@ pub fn keyboard() {
let mut file = File::open("irq:1").expect("ps2d: failed to open irq:1");
let mut input = File::open("display:input").expect("ps2d: failed to open display:input");
let mut ctrl = false;
let mut lshift = false;
let mut rshift = false;
loop {
@ -28,71 +28,17 @@ pub fn keyboard() {
(data, true)
};
if scancode == 0x1D {
ctrl = pressed;
} else if scancode == 0x2A {
if scancode == 0x2A {
lshift = pressed;
} else if scancode == 0x36 {
rshift = pressed;
} else if pressed {
match scancode {
f @ 0x3B ... 0x44 => { // F1 through F10
input.write(&[(f - 0x3B) + 0xF4]).unwrap();
},
0x57 => { // F11
input.write(&[0xFE]).unwrap();
},
0x58 => { // F12
input.write(&[0xFF]).unwrap();
},
0x47 => { // Home
input.write(b"\x1B[H").unwrap();
},
0x48 => { // Up
input.write(b"\x1B[A").unwrap();
},
0x49 => { // Page up
input.write(b"\x1B[5~").unwrap();
},
0x4B => { // Left
input.write(b"\x1B[D").unwrap();
},
0x4D => { // Right
input.write(b"\x1B[C").unwrap();
},
0x4F => { // End
input.write(b"\x1B[F").unwrap();
},
0x50 => { // Down
input.write(b"\x1B[B").unwrap();
},
0x51 => { // Page down
input.write(b"\x1B[6~").unwrap();
},
0x52 => { // Insert
input.write(b"\x1B[2~").unwrap();
},
0x53 => { // Delete
input.write(b"\x1B[3~").unwrap();
},
_ => {
let c = if ctrl {
match keymap::get_char(scancode, false) {
c @ 'a' ... 'z' => ((c as u8 - b'a') + b'\x01') as char,
c => c
}
} else {
keymap::get_char(scancode, lshift || rshift)
};
if c != '\0' {
input.write(&[c as u8]).unwrap();
}
}
}
}
} else {
thread::yield_now();
input.write(&KeyEvent {
character: keymap::get_char(scancode, lshift || rshift),
scancode: scancode,
pressed: pressed
}.to_event()).expect("ps2d: failed to write key event");
}
}
}

View file

@ -3,6 +3,7 @@
#[macro_use]
extern crate bitflags;
extern crate io;
extern crate orbclient;
extern crate syscall;
use std::thread;

View file

@ -1,7 +1,8 @@
use std::fs::File;
use std::io::{Read, Write};
use std::mem;
use std::thread;
use orbclient::MouseEvent;
bitflags! {
flags MousePacketFlags: u8 {
@ -18,6 +19,7 @@ bitflags! {
pub fn mouse(extra_packet: bool) {
let mut file = File::open("irq:12").expect("ps2d: failed to open irq:12");
let mut input = File::open("display:input").expect("ps2d: failed to open display:input");
let mut packets = [0; 4];
let mut packet_i = 0;
@ -40,23 +42,29 @@ pub fn mouse(extra_packet: bool) {
packet_i = 0;
} else if packet_i >= packets.len() || (!extra_packet && packet_i >= 3) {
if ! flags.contains(X_OVERFLOW) && ! flags.contains(Y_OVERFLOW) {
let mut dx = packets[1] as isize;
let mut dx = packets[1] as i32;
if flags.contains(X_SIGN) {
dx -= 0x100;
}
let mut dy = packets[2] as isize;
let mut dy = -(packets[2] as i32);
if flags.contains(Y_SIGN) {
dy -= 0x100;
dy += 0x100;
}
let extra = if extra_packet {
let _extra = if extra_packet {
packets[3]
} else {
0
};
print!("ps2d: IRQ {:?}, {}, {}, {}\n", flags, dx, dy, extra);
input.write(&MouseEvent {
x: dx,
y: dy,
left_button: flags.contains(LEFT_BUTTON),
middle_button: flags.contains(MIDDLE_BUTTON),
right_button: flags.contains(RIGHT_BUTTON)
}.to_event()).expect("ps2d: failed to write mouse event");
} else {
println!("ps2d: overflow {:X} {:X} {:X} {:X}", packets[0], packets[1], packets[2], packets[3]);
}
@ -66,8 +74,6 @@ pub fn mouse(extra_packet: bool) {
}
file.write(&irqs).expect("ps2d: failed to write irq:12");
} else {
thread::yield_now();
}
}
}