fix device compile error, update crate pc_keyboard

toolchain_update
WangRunji 6 years ago
parent 08c8d89974
commit 6e8a0e20ab

14
kernel/Cargo.lock generated

@ -188,7 +188,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
[[package]]
name = "pc-keyboard"
version = "0.3.1"
version = "0.5.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
[[package]]
@ -253,7 +253,7 @@ dependencies = [
"linked_list_allocator 0.6.3 (registry+https://github.com/rust-lang/crates.io-index)",
"log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)",
"once 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)",
"pc-keyboard 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)",
"pc-keyboard 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)",
"raw-cpuid 6.1.0 (registry+https://github.com/rust-lang/crates.io-index)",
"rcore-fs 0.1.0 (git+https://github.com/wangrunji0408/rcore-fs?branch=sefs)",
"rcore-fs-sfs 0.1.0 (git+https://github.com/wangrunji0408/rcore-fs?branch=sefs)",
@ -261,7 +261,7 @@ dependencies = [
"rcore-thread 0.1.0",
"riscv 0.3.0 (git+https://github.com/riscv-and-rust-and-decaf/riscv)",
"smoltcp 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)",
"spin 0.4.10 (registry+https://github.com/rust-lang/crates.io-index)",
"spin 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)",
"uart_16550 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)",
"volatile 0.2.6 (registry+https://github.com/rust-lang/crates.io-index)",
"x86_64 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)",
@ -381,6 +381,11 @@ name = "spin"
version = "0.4.10"
source = "registry+https://github.com/rust-lang/crates.io-index"
[[package]]
name = "spin"
version = "0.5.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
[[package]]
name = "static_assertions"
version = "0.3.1"
@ -519,7 +524,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
"checksum nodrop 0.1.13 (registry+https://github.com/rust-lang/crates.io-index)" = "2f9667ddcc6cc8a43afc9b7917599d7216aa09c463919ea32c59ed6cac8bc945"
"checksum once 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)" = "931fb7a4cf34610cf6cbe58d52a8ca5ef4c726d4e2e178abd0dc13a6551c6d73"
"checksum os_bootinfo 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)" = "66481dbeb5e773e7bd85b63cd6042c30786f834338288c5ec4f3742673db360a"
"checksum pc-keyboard 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)" = "fff50ab09ba31bcebc0669f4e64c0952fae1acdca9e6e0587e68e4e8443808ac"
"checksum pc-keyboard 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)" = "c48392db76c4e9a69e0b3be356c5f97ebb7b14413c5e4fd0af4755dbf86e2fce"
"checksum pulldown-cmark 0.0.3 (registry+https://github.com/rust-lang/crates.io-index)" = "8361e81576d2e02643b04950e487ec172b687180da65c731c03cf336784e6c07"
"checksum rand 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)" = "552840b97013b1a26992c11eac34bdd778e464601a4c2054b5f0bff7c6761293"
"checksum rand_core 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)" = "7a6fdeb83b075e8266dcc8762c22776f6877a63111121f5f8c7411e5be7eed4b"
@ -537,6 +542,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
"checksum skeptic 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)" = "061203a849117b0f7090baf8157aa91dac30545208fbb85166ac58b4ca33d89c"
"checksum smoltcp 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)" = "fef582369edb298c6c41319a544ca9c4e83622f226055ccfcb35974fbb55ed34"
"checksum spin 0.4.10 (registry+https://github.com/rust-lang/crates.io-index)" = "ceac490aa12c567115b40b7b7fceca03a6c9d53d5defea066123debc83c5dc1f"
"checksum spin 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)" = "44363f6f51401c34e7be73db0db371c04705d35efbe9f7d6082e03a921a32c55"
"checksum static_assertions 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)" = "389ce475f424f267dbed6479cbd8f126c5e1afb053b0acdaa019c74305fc65d1"
"checksum tempdir 0.3.7 (registry+https://github.com/rust-lang/crates.io-index)" = "15f2b5fb00ccdf689e0149d1b1b3c03fead81c2b37735d812fa8bddbbf41b6d8"
"checksum tock-registers 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "3a385d94f3f62e60445a0adb9ff8d9621faa272234530d4c0f848ec98f88e316"

@ -42,7 +42,7 @@ debug = true
[dependencies]
log = "0.4"
spin = "0.4"
spin = "0.5"
once = "0.3"
xmas-elf = "0.6"
bitflags = "1.0"
@ -64,7 +64,7 @@ apic = { git = "https://github.com/wangrunji0408/APIC-Rust" }
x86_64 = "0.4"
raw-cpuid = "6.0"
uart_16550 = "0.1"
pc-keyboard = "0.3"
pc-keyboard = "0.5"
[target.'cfg(any(target_arch = "riscv32", target_arch = "riscv64"))'.dependencies]
riscv = { git = "https://github.com/riscv-and-rust-and-decaf/riscv" }

@ -1,6 +1,6 @@
use spin::Mutex;
use x86_64::instructions::port::Port;
use pc_keyboard::{Keyboard, ScancodeSet1, DecodedKey, layouts};
use pc_keyboard::{Keyboard, ScancodeSet1, DecodedKey, layouts, HandleControl};
use lazy_static::lazy_static;
pub fn init() {
@ -14,7 +14,7 @@ pub fn init() {
pub fn receive() -> Option<char> {
lazy_static! {
static ref KEYBOARD: Mutex<Keyboard<layouts::Us104Key, ScancodeSet1>> =
Mutex::new(Keyboard::new(layouts::Us104Key, ScancodeSet1));
Mutex::new(Keyboard::new(layouts::Us104Key, ScancodeSet1, HandleControl::Ignore));
}
let mut keyboard = KEYBOARD.lock();

@ -6,18 +6,15 @@ use rcore_fs::dev::*;
#[cfg(target_arch = "x86_64")]
use crate::arch::driver::ide;
#[cfg(not(target_arch = "x86_64"))]
pub struct MemBuf(RwLock<&'static mut [u8]>);
#[cfg(not(target_arch = "x86_64"))]
impl MemBuf {
unsafe fn new(begin: unsafe extern fn(), end: unsafe extern fn()) -> Self {
pub unsafe fn new(begin: unsafe extern fn(), end: unsafe extern fn()) -> Self {
use core::slice;
MemBuf(RwLock::new(slice::from_raw_parts_mut(begin as *mut u8, end as usize - begin as usize)))
}
}
#[cfg(not(target_arch = "x86_64"))]
impl Device for MemBuf {
fn read_at(&self, offset: usize, buf: &mut [u8]) -> Option<usize> {
let slice = self.0.read();

Loading…
Cancel
Save