Merge branch 'main' into gsora/backlight-on-keypress

This commit is contained in:
Gianguido Sorà 2022-06-10 17:12:52 +02:00
commit 0ff4e569c1
60 changed files with 119 additions and 61 deletions

View file

@ -5,7 +5,7 @@ authors = ["bunnie <bunnie@kosagi.com>"]
edition = "2018"
description = "Ball demo app"
# Dependency policy: fully specify dependencies to the minor version number
# Dependency versions enforced by Cargo.lock.
[dependencies]
log = "0.4.14"
num-derive = {version = "0.3.3", default-features = false}

View file

@ -5,7 +5,7 @@ authors = ["bunnie <bunnie@kosagi.com>"]
edition = "2018"
description = "REPL demo app"
# Dependency policy: fully specify dependencies to the minor version number
# Dependency versions enforced by Cargo.lock.
[dependencies]
log = "0.4.14"
num-derive = {version = "0.3.3", default-features = false}

View file

@ -80,7 +80,8 @@ pub(crate) fn set_durations(prompt: i64, presence: i64) {
/// Some(char) => user is present, and they hit the key indicated
/// None => user was not present
pub(crate) fn request_permission_blocking(reason: String, channel_id: [u8; 4]) -> Option<char> {
log::info!("requesting permission (blocking)");
log::trace!("requesting permission (blocking)");
log::info!("{}VAULT.PERMISSION,{}", xous::BOOKEND_START, xous::BOOKEND_END);
request_permission_inner(reason, channel_id, true, None)
}
pub(crate) fn request_permission_polling(reason: String, application: [u8; 32]) -> bool {

View file

@ -5,7 +5,7 @@ authors = ["bunnie <bunnie@kosagi.com>"]
edition = "2018"
description = "com_rs import package"
# Dependency policy: fully specify dependencies to the minor version number
# Dependency versions enforced by Cargo.lock.
[dependencies]
com_rs = { git = "https://github.com/betrusted-io/com_rs.git", rev = "4a53c95b56407b8ad518b8c5ab6a361aae5dfaa1" }
#com_rs = { path = "../../../betrusted-ec/sw/com_rs" }

View file

@ -8,7 +8,7 @@ description = "Low level access to RISC-V processors"
keywords = ["riscv", "register", "peripheral"]
license = "ISC"
# Dependency policy: fully specify dependencies to the minor version number
# Dependency versions enforced by Cargo.lock.
[dependencies]
bare-metal = ">=0.2.0,<0.2.5"
bit_field = "0.9.0"

View file

@ -6,7 +6,7 @@ name = "kernel"
version = "0.8.2"
resolver = "2"
# Dependency policy: fully specify dependencies to the minor version number
# Dependency versions enforced by Cargo.lock.
[dependencies]
bitflags = "1.2.1"
# gdbstub branch "dev/0.6"

View file

@ -52,6 +52,6 @@ fn main() {
// CI sets this variable. This changes how the panic handler works.
println!("cargo:rerun-if-env-changed=CI");
if option_env!("CI").is_some() {
println!("cargp:rustc-cfg=ci");
println!("cargo:rustc-cfg=ci");
}
}

View file

@ -5,7 +5,7 @@ authors = ["bunnie <bunnie@kosagi.com>"]
edition = "2018"
description = "sha2 hardware accelerator engine"
# Dependency policy: fully specify dependencies to the minor version number
# Dependency versions enforced by Cargo.lock.
[dependencies]
# Rust-standard digest API dependencies

View file

@ -6,7 +6,7 @@ license = "MIT OR Apache-2.0"
name = "locales"
version = "0.1.0"
# Dependency policy: fully specify dependencies to the minor version number
# Dependency versions enforced by Cargo.lock.
[dependencies]
[build-dependencies]

View file

@ -5,7 +5,7 @@ edition = "2018"
name = "aes-test"
version = "0.1.0"
# Dependency policy: fully specify dependencies to the minor version number
# Dependency versions enforced by Cargo.lock.
[dependencies]
log = "0.4.14"
log-server = {path = "../log-server"}

View file

@ -5,7 +5,7 @@ authors = ["bunnie <bunnie@kosagi.com>"]
edition = "2018"
description = "AES library for Xous"
# Dependency policy: fully specify dependencies to the minor version number
# Dependency versions enforced by Cargo.lock.
[dependencies]
xous = { path = "../../xous-rs" }
log-server = { path = "../log-server" }

View file

@ -5,7 +5,7 @@ authors = ["bunnie <bunnie@kosagi.com>"]
edition = "2018"
description = "Benchmark target for Xous"
# Dependency policy: fully specify dependencies to the minor version number
# Dependency versions enforced by Cargo.lock.
[dependencies]
xous = { path = "../../xous-rs" }
xous-names = { path = "../xous-names" }

View file

@ -5,7 +5,7 @@ authors = ["bunnie <bunnie@kosagi.com>"]
edition = "2018"
description = "Benchmarks for Xous"
# Dependency policy: fully specify dependencies to the minor version number
# Dependency versions enforced by Cargo.lock.
[dependencies]
xous = { path = "../../xous-rs" }
graphics-server = { path = "../graphics-server" }

View file

@ -5,7 +5,7 @@ authors = ["bunnie <bunnie@kosagi.com>"]
edition = "2018"
description = "Audio CODEC server"
# Dependency policy: fully specify dependencies to the minor version number
# Dependency versions enforced by Cargo.lock.
[dependencies]
xous = { path = "../../xous-rs" }
log-server = { path = "../log-server" }

View file

@ -5,7 +5,7 @@ edition = "2018"
name = "com"
version = "0.1.0"
# Dependency policy: fully specify dependencies to the minor version number
# Dependency versions enforced by Cargo.lock.
[dependencies]
com_rs-ref = {path = "../../imports/com_rs-ref"}
log = "0.4.14"

View file

@ -5,7 +5,7 @@ authors = ["bunnie <bunnie@kosagi.com>"]
edition = "2018"
description = "Content Canvas Plugin Common APIs"
# Dependency policy: fully specify dependencies to the minor version number
# Dependency versions enforced by Cargo.lock.
[dependencies]
xous = { path = "../../xous-rs" }
rkyv = { version = "0.4.3", default_features = false }

View file

@ -5,7 +5,7 @@ authors = ["bunnie <bunnie@kosagi.com>"]
edition = "2018"
description = "Xous DNS resolver"
# Dependency policy: fully specify dependencies to the minor version number
# Dependency versions enforced by Cargo.lock.
[dependencies]
xous = { path = "../../xous-rs" }
log-server = { path = "../log-server" }

View file

@ -5,7 +5,7 @@ authors = ["bunnie <bunnie@kosagi.com>"]
edition = "2018"
description = "Curve25519 Engine"
# Dependency policy: fully specify dependencies to the minor version number
# Dependency versions enforced by Cargo.lock.
[dependencies]
xous = { path = "../../xous-rs" }
log-server = { path = "../log-server" }

View file

@ -5,7 +5,7 @@ authors = ["bunnie <bunnie@kosagi.com>"]
edition = "2018"
description = "Sha512 hardware accelerator engine"
# Dependency policy: fully specify dependencies to the minor version number
# Dependency versions enforced by Cargo.lock.
[dependencies]
xous = { path = "../../xous-rs" }
log-server = { path = "../log-server" }

View file

@ -5,7 +5,7 @@ authors = ["bunnie <bunnie@kosagi.com>"]
edition = "2018"
description = "FFI test integration"
# Dependency policy: fully specify dependencies to the minor version number
# Dependency versions enforced by Cargo.lock.
[dependencies]
xous = { path = "../../xous-rs" }
log-server = { path = "../log-server" }

View file

@ -5,7 +5,7 @@ edition = "2018"
name = "gam"
version = "0.1.0"
# Dependency policy: fully specify dependencies to the minor version number
# Dependency versions enforced by Cargo.lock.
[dependencies]
com = {path = "../com"} # used by the backlight setting on the main menu thread
content-plugin-api = {path = "../content-plugin-api"}

View file

@ -204,6 +204,7 @@ pub const MODAL_Y_MAX: i16 = 350; // in absolute screen coords, not relative to
pub(crate) enum MenuMgrOp {
// incoming is one of these ops
AddItem,
InsertItem(usize),
DeleteItem,
SetIndex(usize),
Quit,

View file

@ -105,8 +105,7 @@ impl<'a> Menu<'a> {
self.helper_data = Some(buf);
xous::create_thread_3(forwarding_thread, addr, size, offset).expect("couldn't spawn a helper thread");
}
// if successful, returns None, otherwise, the menu item
/// Appends a menu item to the end of the current Menu
pub fn add_item(&mut self, new_item: MenuItem) {
if new_item.name.as_str().unwrap() == "🔇" { // suppress the addition of menu items that are not applicable for a given locale
return;
@ -132,6 +131,38 @@ impl<'a> Menu<'a> {
log::debug!("add_item requesting bounds of {:?}", new_bounds);
self.gam.set_canvas_bounds_request(&mut new_bounds).expect("couldn't call set bounds");
}
// Attempts to insert a MenuItem at the index given. This displaces the item at that index down
// by one slot. Returns false if the index is invalid.
pub fn insert_item(&mut self, new_item: MenuItem, at: usize) -> bool {
if new_item.name.as_str().unwrap() == "🔇" { // suppress the addition of menu items that are not applicable for a given locale
return false;
}
// first, do the insertion.
// add the menu item to the first free slot
// any modifications to the menu structure should guarantee that the list is compacted
// and has no holes, in order for the "selected index" logic to work
if at <= self.items.len() {
self.items.insert(at, new_item);
// now, recompute the height
let mut total_items = self.num_items();
if total_items == 0 {
total_items = 1; // just so we see a blank menu at least, and have a clue how to debug
}
let current_bounds = self.gam.get_canvas_bounds(self.canvas).expect("couldn't get current bounds");
let mut new_bounds = SetCanvasBoundsRequest {
requested: Point::new(current_bounds.x, total_items as i16 * self.line_height + self.margin * 2),
granted: None,
token_type: TokenType::App,
token: self.authtoken,
};
log::debug!("add_item requesting bounds of {:?}", new_bounds);
self.gam.set_canvas_bounds_request(&mut new_bounds).expect("couldn't call set bounds");
true
} else {
false
}
}
// note: this routine has yet to be tested. (remove this comment once it has been actually used by something)
pub fn delete_item(&mut self, item: &str) -> bool {
let len_before = self.items.len();
@ -364,6 +395,20 @@ impl MenuMatic {
false
}
}
pub fn insert_item(&self, item: MenuItem, at: usize) -> bool {
let mm = MenuManagement {
item,
op: MenuMgrOp::InsertItem(at),
};
let mut buf = Buffer::into_buf(mm).expect("Couldn't convert to memory structure");
buf.lend_mut(self.cid, 0).expect("Couldn't issue management opcode");
let ret = buf.to_original::<MenuManagement, _>().unwrap();
if ret.op == MenuMgrOp::Ok {
true
} else {
false
}
}
pub fn delete_item(&self, item_name: &str) -> bool {
let mm = MenuManagement {
item: MenuItem {
@ -475,6 +520,15 @@ pub fn menu_matic(items: Vec::<MenuItem>, menu_name: &'static str, maybe_manager
mgmt.op = MenuMgrOp::Ok;
buffer.replace(mgmt).unwrap();
}
MenuMgrOp::InsertItem(at) => {
if menu.lock().unwrap().insert_item(mgmt.item, at) {
mgmt.op = MenuMgrOp::Ok;
buffer.replace(mgmt).unwrap();
} else {
mgmt.op = MenuMgrOp::Err;
buffer.replace(mgmt).unwrap();
}
}
MenuMgrOp::DeleteItem => {
if !menu.lock().unwrap().delete_item(mgmt.item.name.as_str().unwrap()) {
mgmt.op = MenuMgrOp::Err;

View file

@ -5,7 +5,7 @@ edition = "2018"
name = "graphics-server"
version = "0.1.0"
# Dependency policy: fully specify dependencies to the minor version number
# Dependency versions enforced by Cargo.lock.
[dependencies]
keyboard = {path = "../keyboard"}
log = "0.4.14"

View file

@ -5,7 +5,7 @@ edition = "2018"
name = "ime-frontend"
version = "0.1.0"
# Dependency policy: fully specify dependencies to the minor version number
# Dependency versions enforced by Cargo.lock.
[dependencies]
gam = {path = "../gam"}
graphics-server = {path = "../graphics-server"}

View file

@ -5,7 +5,7 @@ edition = "2018"
name = "ime-plugin-api"
version = "0.1.0"
# Dependency policy: fully specify dependencies to the minor version number
# Dependency versions enforced by Cargo.lock.
[dependencies]
graphics-server = {path = "../graphics-server"}# this is used by the IMEF portion of the API
log = "0.4.14"

View file

@ -5,7 +5,7 @@ edition = "2018"
name = "ime-plugin-shell"
version = "0.1.0"
# Dependency policy: fully specify dependencies to the minor version number
# Dependency versions enforced by Cargo.lock.
[dependencies]
ime-plugin-api = {path = "../ime-plugin-api"}
log = "0.4.14"

View file

@ -5,7 +5,7 @@ edition = "2018"
name = "ime-plugin-tts"
version = "0.1.0"
# Dependency policy: fully specify dependencies to the minor version number
# Dependency versions enforced by Cargo.lock.
[dependencies]
ime-plugin-api = {path = "../ime-plugin-api"}
log = "0.4.14"

View file

@ -5,7 +5,7 @@ authors = ["bunnie <bunnie@kosagi.com>"]
edition = "2018"
description = "JTAG port server"
# Dependency policy: fully specify dependencies to the minor version number
# Dependency versions enforced by Cargo.lock.
[dependencies]
xous = { path = "../../xous-rs" }
log-server = { path = "../log-server" }

View file

@ -5,7 +5,7 @@ authors = ["Sean Cross <sean@xobs.io>"]
edition = "2018"
description = "Program to test various aspects of the kernel"
# Dependency policy: fully specify dependencies to the minor version number
# Dependency versions enforced by Cargo.lock.
[dependencies]
xous = { path = "../../xous-rs" }
log-server = { path = "../log-server" }

View file

@ -5,7 +5,7 @@ edition = "2018"
name = "keyboard"
version = "0.1.0"
# Dependency policy: fully specify dependencies to the minor version number
# Dependency versions enforced by Cargo.lock.
[dependencies]
log = {version = "0.4", features = ["max_level_trace", "release_max_level_trace"]}
log-server = {path = "../log-server"}

View file

@ -5,7 +5,7 @@ authors = ["bunnie <bunnie@kosagi.com>"]
edition = "2018"
description = "libstd test stub"
# Dependency policy: fully specify dependencies to the minor version number
# Dependency versions enforced by Cargo.lock.
[dependencies]
xous = { path = "../../xous-rs" }
log-server = { path = "../log-server" }

View file

@ -5,7 +5,7 @@ edition = "2018"
name = "llio"
version = "0.1.0"
# Dependency policy: fully specify dependencies to the minor version number
# Dependency versions enforced by Cargo.lock.
[dependencies]
log = "0.4.14"
log-server = {path = "../log-server"}

View file

@ -5,7 +5,7 @@ edition = "2018"
name = "log-server"
version = "0.1.0"
# Dependency policy: fully specify dependencies to the minor version number
# Dependency versions enforced by Cargo.lock.
[dependencies]
log = "0.4.14"
num-derive = {version = "0.3.3", default-features = false}

View file

@ -5,7 +5,7 @@ edition = "2018"
name = "log-test-client"
version = "0.1.0"
# Dependency policy: fully specify dependencies to the minor version number
# Dependency versions enforced by Cargo.lock.
[dependencies]
xous = {path = "../../xous-rs"}

View file

@ -5,7 +5,7 @@ authors = ["bunnie <bunnie@kosagi.com>"]
edition = "2018"
description = "Ux modals server"
# Dependency policy: fully specify dependencies to the minor version number
# Dependency versions enforced by Cargo.lock.
[dependencies]
xous = { path = "../../xous-rs" }
log-server = { path = "../log-server" }

View file

@ -5,7 +5,7 @@ authors = ["bunnie <bunnie@kosagi.com>"]
edition = "2018"
description = "Network middleware"
# Dependency policy: fully specify dependencies to the minor version number
# Dependency versions enforced by Cargo.lock.
[dependencies]
xous = { path = "../../xous-rs" }
xous-ipc = {path="../../xous-ipc"}

View file

@ -5,7 +5,7 @@ authors = ["bunnie <bunnie@kosagi.com>"]
edition = "2018"
description = "Plausibly Deniable Database"
# Dependency policy: fully specify dependencies to the minor version number
# Dependency versions enforced by Cargo.lock.
[dependencies]
bitflags = {version = "1"}
xous = { path = "../../xous-rs" }

View file

@ -5,7 +5,7 @@ edition = "2018"
name = "rkyv-test-client"
version = "0.1.0"
# Dependency policy: fully specify dependencies to the minor version number
# Dependency versions enforced by Cargo.lock.
[dependencies]
log = "0.4.14"
log-server = {path = "../log-server"}

View file

@ -5,7 +5,7 @@ edition = "2018"
name = "rkyv-test-server"
version = "0.1.0"
# Dependency policy: fully specify dependencies to the minor version number
# Dependency versions enforced by Cargo.lock.
[dependencies]
log = "0.4.14"
log-server = {path = "../log-server"}

View file

@ -5,7 +5,7 @@ authors = ["bunnie <bunnie@kosagi.com>"]
edition = "2018"
description = "Xous root keys server"
# Dependency policy: fully specify dependencies to the minor version number
# Dependency versions enforced by Cargo.lock.
[dependencies]
xous = { path = "../../xous-rs" }
log-server = { path = "../log-server" }

View file

@ -5,7 +5,7 @@ edition = "2018"
name = "shellchat"
version = "0.1.0"
# Dependency policy: fully specify dependencies to the minor version number
# Dependency versions enforced by Cargo.lock.
[dependencies]
com = {path = "../com"}
content-plugin-api = {path = "../content-plugin-api"}# all content canvas providers must provide this API

View file

@ -5,7 +5,7 @@ authors = ["bunnie <bunnie@kosagi.com>"]
edition = "2018"
description = "Audio CODEC server"
# Dependency policy: fully specify dependencies to the minor version number
# Dependency versions enforced by Cargo.lock.
[dependencies]
xous = { path = "../../xous-rs" }
log-server = { path = "../log-server" }

View file

@ -5,7 +5,7 @@ authors = ["bunnie <bunnie@kosagi.com>"]
edition = "2018"
description = "SPINOR ROM operations server"
# Dependency policy: fully specify dependencies to the minor version number
# Dependency versions enforced by Cargo.lock.
[dependencies]
xous = { path = "../../xous-rs" }
log-server = { path = "../log-server" }

View file

@ -5,7 +5,7 @@ edition = "2018"
name = "status"
version = "0.1.0"
# Dependency policy: fully specify dependencies to the minor version number
# Dependency versions enforced by Cargo.lock.
[dependencies]
com = {path = "../com"}
content-plugin-api = {path = "../content-plugin-api"}

View file

@ -5,7 +5,7 @@ authors = ["bunnie <bunnie@kosagi.com>"]
edition = "2018"
description = "Manager of suspend/resume operations"
# Dependency policy: fully specify dependencies to the minor version number
# Dependency versions enforced by Cargo.lock.
[dependencies]
xous = { path = "../../xous-rs" }
log-server = { path = "../log-server" }

View file

@ -5,7 +5,7 @@ edition = "2018"
name = "ticktimer-server"
version = "0.1.0"
# Dependency policy: fully specify dependencies to the minor version number
# Dependency versions enforced by Cargo.lock.
[dependencies]
log = "0.4.14"
log-server = {path = "../log-server"}

View file

@ -5,7 +5,7 @@ authors = ["bunnie <bunnie@kosagi.com>"]
edition = "2018"
description = "TRNG server"
# Dependency policy: fully specify dependencies to the minor version number
# Dependency versions enforced by Cargo.lock.
[dependencies]
xous = { path = "../../xous-rs" }
log-server = { path = "../log-server" }

View file

@ -5,7 +5,7 @@ authors = ["bunnie <bunnie@kosagi.com>"]
edition = "2018"
description = "Text to speech integration server"
# Dependency policy: fully specify dependencies to the minor version number
# Dependency versions enforced by Cargo.lock.
[dependencies]
xous = { path = "../../xous-rs" }
xous-ipc = {path="../../xous-ipc"}

View file

@ -5,7 +5,7 @@ authors = ["bunnie <bunnie@kosagi.com>"]
edition = "2018"
description = "Xous USB device drivers"
# Dependency policy: fully specify dependencies to the minor version number
# Dependency versions enforced by Cargo.lock.
[dependencies]
xous = { path = "../../xous-rs" }
xous-ipc = { path = "../../xous-ipc" }

View file

@ -853,13 +853,15 @@ impl UsbBus for SpinalUsbDevice {
/// continue be polled, and it shall return a value other than `Suspend` from `poll` when it no
/// longer detects the suspend condition.
fn suspend(&self) {
log::warn!("USB suspend called, doing nothing");
log::info!("{}USB.SUSPEND,{}", xous::BOOKEND_START, xous::BOOKEND_END);
log::warn!("USB suspend called; this implementation does nothing.");
}
/// Resumes from suspend mode. This may only be called after the peripheral has been previously
/// suspended.
fn resume(&self) {
log::warn!("USB resume called, but suspend is not implemented");
log::info!("{}USB.RESUME,{}", xous::BOOKEND_START, xous::BOOKEND_END);
log::info!("USB resume called.");
}
/// Gets information about events and incoming data. Usually called in a loop or from an

View file

@ -5,7 +5,7 @@ authors = ["bunnie <bunnie@kosagi.com>"]
edition = "2018"
description = "USB test & development stub"
# Dependency policy: fully specify dependencies to the minor version number
# Dependency versions enforced by Cargo.lock.
[dependencies]
xous = { path = "../../xous-rs" }
log-server = { path = "../log-server" }

View file

@ -8,7 +8,7 @@ license = "MIT OR Apache-2.0"
repository = "https://github.com/betrusted-io/xous-core/"
homepage = "https://betrusted.io/"
# Dependency policy: fully specify dependencies to the minor version number
# Dependency versions enforced by Cargo.lock.
[dependencies]
num-derive = {version = "0.3.3", default-features = false}
num-traits = {version = "0.2.14", default-features = false}

View file

@ -7,7 +7,7 @@ edition = "2018"
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
# Dependency policy: fully specify dependencies to the minor version number
# Dependency versions enforced by Cargo.lock.
[dependencies]
quick-xml = "0.19.0"
clap = "2.33.3"

View file

@ -6,7 +6,7 @@ edition = "2018"
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
# Dependency policy: fully specify dependencies to the minor version number
# Dependency versions enforced by Cargo.lock.
[dependencies]
quick-xml = "0.19.0"
clap = "2.33.3"

View file

@ -7,7 +7,7 @@ version = "0.1.0"
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
# Dependency policy: fully specify dependencies to the minor version number
# Dependency versions enforced by Cargo.lock.
[dependencies]
bitflags = "1.2.1"
clap = "2.33.3"

View file

@ -3,7 +3,7 @@ name = "wycheproof-import"
version = "0.1.0"
edition = "2018"
# Dependency policy: fully specify dependencies to the minor version number
# Dependency versions enforced by Cargo.lock.
[dependencies]
eyre = "0.6.5"
serde = { version = "1.0.129", features = ["derive"] }

View file

@ -9,7 +9,7 @@ std = []
default_features = ["std"]
# Dependency policy: fully specify dependencies to the minor version number
# Dependency versions enforced by Cargo.lock.
[dependencies]
[build-dependencies]

View file

@ -8,7 +8,7 @@ version = "0.9.7"
repository = "https://github.com/betrusted-io/xous-core/"
homepage = "https://betrusted.io/"
# Dependency policy: fully specify dependencies to the minor version number
# Dependency versions enforced by Cargo.lock.
[dependencies]
bitflags = {version = "1"}
rkyv = {version = "0.4.3", features = ["const_generics"], default-features = false}

View file

@ -6,7 +6,7 @@ authors = ["Sean Cross <sean@xobs.io>"]
edition = "2018"
rust-version = "1.59"
# Dependency policy: fully specify dependencies to the minor version number
# Dependency versions enforced by Cargo.lock.
[dependencies]
atty = "0.2.14"
filetime = "0.2.14"