diff --git a/services/gam/src/lib.rs b/services/gam/src/lib.rs index ae3265ab2..8b0bfe49f 100644 --- a/services/gam/src/lib.rs +++ b/services/gam/src/lib.rs @@ -430,7 +430,7 @@ impl<'a> Menu<'a> { rawkeys_op, drop_op }; - let mut buf = Buffer::into_buf(helper_data).expect("couldn't allocate helper data for helper thread"); + let buf = Buffer::into_buf(helper_data).expect("couldn't allocate helper data for helper thread"); let (addr, size, offset) = unsafe{buf.to_raw_parts()}; self.helper_data = Some(buf); xous::create_thread_3(forwarding_thread, addr, size, offset).expect("couldn't spawn a helper thread"); diff --git a/services/gam/src/modal.rs b/services/gam/src/modal.rs index 10e08cd49..4cac6f0fa 100644 --- a/services/gam/src/modal.rs +++ b/services/gam/src/modal.rs @@ -51,14 +51,9 @@ use enum_dispatch::enum_dispatch; use crate::api::*; use crate::Gam; -use graphics_server::api::{TextOp, TextView}; - -use graphics_server::api::{Point, Gid, Line, Rectangle, Circle, RoundedRectangle, TokenClaim}; +use graphics_server::api::*; pub use graphics_server::GlyphStyle; -// menu imports -use graphics_server::api::{PixelColor, TextBounds, DrawStyle}; -use xous::{send_message, CID, Message}; use xous_ipc::{String, Buffer}; use num_traits::*; @@ -463,7 +458,7 @@ impl ActionApi for RadioButtons { tv.bounds_hint = TextBounds::BoundingBox(Rectangle::new( Point::new(cursor_x, cur_y - emoji_slop), Point::new(cursor_x + 36, cur_y - emoji_slop + 36) )); - write!(tv, "»"); + write!(tv, "»").unwrap(); modal.gam.post_textview(&mut tv).expect("couldn't post tv"); do_okay = false; } @@ -474,7 +469,7 @@ impl ActionApi for RadioButtons { tv.bounds_hint = TextBounds::BoundingBox(Rectangle::new( Point::new(select_x, cur_y), Point::new(select_x + 36, cur_y + modal.line_height) )); - write!(tv, "•"); + write!(tv, "•").unwrap(); modal.gam.post_textview(&mut tv).expect("couldn't post tv"); } // draw the text @@ -483,7 +478,7 @@ impl ActionApi for RadioButtons { tv.bounds_hint = TextBounds::BoundingBox(Rectangle::new( Point::new(text_x, cur_y), Point::new(modal.canvas_width - modal.margin, cur_y + modal.line_height) )); - write!(tv, "{}", item.as_str()); + write!(tv, "{}", item.as_str()).unwrap(); modal.gam.post_textview(&mut tv).expect("couldn't post tv"); cur_line += 1; @@ -497,9 +492,8 @@ impl ActionApi for RadioButtons { tv.bounds_hint = TextBounds::BoundingBox(Rectangle::new( Point::new(cursor_x, cur_y - emoji_slop), Point::new(cursor_x + 36, cur_y - emoji_slop + 36) )); - write!(tv, "»"); // right arrow emoji. use unicode numbers, because text editors do funny shit with emojis + write!(tv, "»").unwrap(); // right arrow emoji. use unicode numbers, because text editors do funny shit with emojis modal.gam.post_textview(&mut tv).expect("couldn't post tv"); - do_okay = false; } // draw the "OK" line tv.text.clear(); @@ -634,7 +628,7 @@ impl ActionApi for CheckBoxes { tv.bounds_hint = TextBounds::BoundingBox(Rectangle::new( Point::new(cursor_x, cur_y - emoji_slop), Point::new(cursor_x + 36, cur_y - emoji_slop + 36) )); - write!(tv, "»"); + write!(tv, "»").unwrap(); modal.gam.post_textview(&mut tv).expect("couldn't post tv"); do_okay = false; } @@ -645,7 +639,7 @@ impl ActionApi for CheckBoxes { tv.bounds_hint = TextBounds::BoundingBox(Rectangle::new( Point::new(select_x, cur_y - emoji_slop), Point::new(select_x + 36, cur_y + modal.line_height) )); - write!(tv, "\u{d7}"); // multiplication sign + write!(tv, "\u{d7}").unwrap(); // multiplication sign modal.gam.post_textview(&mut tv).expect("couldn't post tv"); } // draw the text @@ -654,7 +648,7 @@ impl ActionApi for CheckBoxes { tv.bounds_hint = TextBounds::BoundingBox(Rectangle::new( Point::new(text_x, cur_y), Point::new(modal.canvas_width - modal.margin, cur_y + modal.line_height) )); - write!(tv, "{}", item.as_str()); + write!(tv, "{}", item.as_str()).unwrap(); modal.gam.post_textview(&mut tv).expect("couldn't post tv"); cur_line += 1; @@ -668,9 +662,8 @@ impl ActionApi for CheckBoxes { tv.bounds_hint = TextBounds::BoundingBox(Rectangle::new( Point::new(cursor_x, cur_y - emoji_slop), Point::new(cursor_x + 36, cur_y - emoji_slop + 36) )); - write!(tv, "»"); // right arrow emoji. use unicode numbers, because text editors do funny shit with emojis + write!(tv, "»").unwrap(); // right arrow emoji. use unicode numbers, because text editors do funny shit with emojis modal.gam.post_textview(&mut tv).expect("couldn't post tv"); - do_okay = false; } // draw the "OK" line tv.text.clear(); @@ -765,11 +758,11 @@ impl ActionApi for Slider { #[enum_dispatch] trait ActionApi { fn height(&self, glyph_height: i16, margin: i16) -> i16 {glyph_height + margin * 2} - fn redraw(&self, at_height: i16, modal: &Modal) { unimplemented!() } + fn redraw(&self, _at_height: i16, _modal: &Modal) { unimplemented!() } fn close(&mut self) {} fn is_password(&self) -> bool { false } /// navigation is one of '∴' | '←' | '→' | '↑' | '↓' - fn key_action(&mut self, key: char) -> (Option>, bool) {(None, true)} + fn key_action(&mut self, _key: char) -> (Option>, bool) {(None, true)} } #[enum_dispatch(ActionApi)] @@ -842,7 +835,7 @@ fn recompute_canvas(modal: &mut Modal, action: ActionType, top_text: Option<&str top_tv.margin = Point::new(0, 0,); // all margin already accounted for in the raw bounds of the text drawing top_tv.ellipsis = false; top_tv.invert = modal.inverted; - write!(top_tv.text, "{}", top_str); + write!(top_tv.text, "{}", top_str).unwrap(); log::trace!("posting top tv: {:?}", top_tv); modal.gam.bounds_compute_textview(&mut top_tv).expect("couldn't simulate top text size"); @@ -858,7 +851,7 @@ fn recompute_canvas(modal: &mut Modal, action: ActionType, top_text: Option<&str // compute height of action item log::trace!("step 1 total_height: {}", total_height); - total_height += modal.action.height(modal.line_height, modal.margin); + total_height += action.height(modal.line_height, modal.margin); total_height += modal.margin; // compute height of bot_text, if any @@ -874,7 +867,7 @@ fn recompute_canvas(modal: &mut Modal, action: ActionType, top_text: Option<&str bot_tv.margin = Point::new(0, 0,); // all margin already accounted for in the raw bounds of the text drawing bot_tv.ellipsis = false; bot_tv.invert = modal.inverted; - write!(bot_tv.text, "{}", bot_str); + write!(bot_tv.text, "{}", bot_str).unwrap(); log::trace!("posting bot tv: {:?}", bot_tv); modal.gam.bounds_compute_textview(&mut bot_tv).expect("couldn't simulate bot text size"); @@ -971,7 +964,7 @@ impl<'a> Modal<'a> { rawkeys_op, drop_op }; - let mut buf = Buffer::into_buf(helper_data).expect("couldn't allocate helper data for helper thread"); + let buf = Buffer::into_buf(helper_data).expect("couldn't allocate helper data for helper thread"); let (addr, size, offset) = unsafe{buf.to_raw_parts()}; self.helper_data = Some(buf); xous::create_thread_3(crate::forwarding_thread, addr, size, offset).expect("couldn't spawn a helper thread"); diff --git a/services/graphics-server/src/main.rs b/services/graphics-server/src/main.rs index d0f584df2..2182d12e7 100644 --- a/services/graphics-server/src/main.rs +++ b/services/graphics-server/src/main.rs @@ -251,8 +251,8 @@ fn xmain() -> ! { } else { checkedwidth }; - let br = Point::new(tl.x + checkedwidth, tl.y + checkedheight); - log::trace!("br: {:?}, comp w: {}, comp h: {}", br, checkedwidth, checkedheight); + let br = Point::new(tl.x + finalwidth, tl.y + checkedheight); + log::trace!("br: {:?}, comp w: {}, comp h: {}", br, finalwidth, checkedheight); if clip_rect.intersects_point(br) { tv.bounds_computed = Some(Rectangle::new( tl, diff --git a/services/root-keys/src/api.rs b/services/root-keys/src/api.rs index 726956336..f32e74ea2 100644 --- a/services/root-keys/src/api.rs +++ b/services/root-keys/src/api.rs @@ -1,4 +1,5 @@ pub(crate) const SERVER_NAME_KEYS: &str = "_Root key server and update manager_"; +#[allow(dead_code)] pub(crate) const ROOTKEY_MODAL_NAME: &'static str = "rootkeys modal"; diff --git a/services/root-keys/src/implementation.rs b/services/root-keys/src/implementation.rs index f20cb8f9b..c3d7845cb 100755 --- a/services/root-keys/src/implementation.rs +++ b/services/root-keys/src/implementation.rs @@ -1,19 +1,22 @@ use utralib::generated::*; use crate::api::*; -use log::info; use core::num::NonZeroUsize; use num_traits::*; -const KEYROMADR_FPGA_KEY: u32 = 0x00; -const KEYROMADR_SELFSIGN_PRIVKEY: u32 = 0x08; -const KEYROMADR_SELFSIGN_PUBKEY: u32 = 0x10; -const KEYROMADR_DEVELOPER_PUBKEY: u32 = 0x18; -const KEYROMADR_THIRDPARTY_PUBKEY: u32 = 0x20; -const KEYROMADR_USER_KEY: u32 = 0x28; -const KEYROMADR_PEPPER: u32 = 0xf8; -const KEYROMADR_FPGA_REV: u32 = 0xfc; -const KEYROMADR_LOADER_REV: u32 = 0xfd; -const KERYOMADR_CONFIG: u32 = 0xff; +struct KeyRomLocations {} +#[allow(dead_code)] +impl KeyRomLocations { + const FPGA_KEY: u32 = 0x00; + const SELFSIGN_PRIVKEY: u32 = 0x08; + const SELFSIGN_PUBKEY: u32 = 0x10; + const DEVELOPER_PUBKEY: u32 = 0x18; + const THIRDPARTY_PUBKEY: u32 = 0x20; + const USER_KEY: u32 = 0x28; + const PEPPER: u32 = 0xf8; + const FPGA_REV: u32 = 0xfc; + const LOADER_REV: u32 = 0xfd; + const CONFIG: u32 = 0xff; +} pub struct KeyField { mask: u32, @@ -31,6 +34,7 @@ impl KeyField { (value & self.mask) << self.offset } } +#[allow(dead_code)] pub(crate) mod keyrom_config { use crate::KeyField; pub const VERSION_MINOR: KeyField = KeyField::new(8, 0 ); @@ -114,7 +118,7 @@ impl RootKeys { xous::MemoryFlags::R | xous::MemoryFlags::W, ).expect("couldn't map sensitive data page"); - let mut keys = RootKeys { + let keys = RootKeys { keyrom: CSR::new(keyrom.as_mut_ptr() as *mut u32), gateware, staging, @@ -182,7 +186,7 @@ impl RootKeys { step += 1; self.update_progress(progress_cid, step, total, false); - self.keyrom.wfo(utra::keyrom::ADDRESS_ADDRESS, KERYOMADR_CONFIG); + self.keyrom.wfo(utra::keyrom::ADDRESS_ADDRESS, KeyRomLocations::CONFIG); let config = self.keyrom.rf(utra::keyrom::DATA_DATA); if config & keyrom_config::INITIALIZED.ms(1) != 0 { @@ -210,7 +214,7 @@ impl RootKeys { // - pepper // provision the pepper - for keyword in sensitive_slice[KEYROMADR_PEPPER as usize..(KEYROMADR_PEPPER + 8) as usize].iter_mut() { + for keyword in sensitive_slice[KeyRomLocations::PEPPER as usize..(KeyRomLocations::PEPPER + 8) as usize].iter_mut() { *keyword = self.trng.get_u32().expect("couldn't get random number"); } diff --git a/services/root-keys/src/lib.rs b/services/root-keys/src/lib.rs index 832bf8983..797d66f15 100644 --- a/services/root-keys/src/lib.rs +++ b/services/root-keys/src/lib.rs @@ -3,7 +3,7 @@ pub mod api; use api::*; -use xous::{CID, msg_blocking_scalar_unpack, msg_scalar_unpack, send_message, Message}; +use xous::{CID, msg_scalar_unpack, send_message, Message}; use num_traits::*; pub use cipher::{self, BlockCipher, BlockDecrypt, BlockEncrypt, consts::U16}; diff --git a/services/root-keys/src/main.rs b/services/root-keys/src/main.rs index dcebdba43..b856fca03 100644 --- a/services/root-keys/src/main.rs +++ b/services/root-keys/src/main.rs @@ -68,7 +68,7 @@ pub(crate) fn rootkeys_ux_thread() { }; log::trace!("building ux thread modal"); let mut modal = gam::Modal::new( - crate::ROOTKEY_MODAL_NAME, + crate::api::ROOTKEY_MODAL_NAME, gam::ActionType::TextEntry(password_action), Some(t!("rootpass.top", xous::LANG)), None, diff --git a/services/rtc/src/api.rs b/services/rtc/src/api.rs index 0ee01a705..01ab581da 100644 --- a/services/rtc/src/api.rs +++ b/services/rtc/src/api.rs @@ -29,6 +29,7 @@ pub struct DateTime { } pub(crate) const SERVER_NAME_RTC: &str = "_Real time clock application server_"; +#[allow(dead_code)] pub(crate) const RTC_MODAL_NAME: &'static str = "rtc modal"; #[derive(Debug, num_derive::FromPrimitive, num_derive::ToPrimitive)] diff --git a/services/rtc/src/main.rs b/services/rtc/src/main.rs index 61b6ab9e2..7cf160c64 100644 --- a/services/rtc/src/main.rs +++ b/services/rtc/src/main.rs @@ -613,7 +613,7 @@ fn xmain() -> ! { rtc_radiobox.add_item(ItemName::new(t!("rtc.sunday", xous::LANG))); log::trace!("building rtc ux modal"); let mut modal = gam::Modal::new( - crate::RTC_MODAL_NAME, + crate::api::RTC_MODAL_NAME, gam::ActionType::TextEntry(rtc_textentry), Some(t!("rtc.month", xous::LANG)), None, @@ -626,7 +626,7 @@ fn xmain() -> ! { Opcode::UxQuit.to_u32().unwrap() ); let gam = gam::Gam::new(&xns).expect("couldn't connect to GAM"); - let mut secs: u8 = 0; + let mut secs: u8; let mut mins: u8 = 0; let mut hours: u8 = 0; let mut months: u8 = 0; diff --git a/services/shellchat/src/main.rs b/services/shellchat/src/main.rs index 3e1e85403..c0d84cb2e 100644 --- a/services/shellchat/src/main.rs +++ b/services/shellchat/src/main.rs @@ -264,7 +264,7 @@ pub(crate) const APP_NAME_SHELLCHAT: &str = "shellchat"; // the user-facing name #[xous::xous_main] fn xmain() -> ! { log_server::init_wait().unwrap(); - log::set_max_level(log::LevelFilter::Debug); + log::set_max_level(log::LevelFilter::Info); info!("my PID is {}", xous::process::id()); let xns = xous_names::XousNames::new().unwrap();