mirror of
https://github.com/saymrwulf/xous-core.git
synced 2026-11-18 08:52:45 +00:00
add debug telemetry for keyboard connect error
sometimes on boot, a process tries to send keyboard an incorrectly formatted message. I think this might be the IOX interrupt handler firing due to random noise. Corrective action towards debugging includes instrumenting the keyboard call with debug info, and also ensuring that the iox interrupt handler banks are initialized to 0.
This commit is contained in:
parent
18dd921cb8
commit
7d7fa75e7d
2 changed files with 28 additions and 12 deletions
|
|
@ -244,6 +244,13 @@ fn main() {
|
||||||
.expect("couldn't claim IRQ control page");
|
.expect("couldn't claim IRQ control page");
|
||||||
let irq_csr = CSR::new(irq_page.as_mut_ptr() as *mut u32);
|
let irq_csr = CSR::new(irq_page.as_mut_ptr() as *mut u32);
|
||||||
let mut irq = IrqHandler { irq_csr, cid: self_cid };
|
let mut irq = IrqHandler { irq_csr, cid: self_cid };
|
||||||
|
// ensure that iox interrupts are gated off by default
|
||||||
|
for index in 0..8 {
|
||||||
|
unsafe {
|
||||||
|
iox.csr.base().add(utralib::utra::iox::SFR_INTCR_CRINT0.offset()).add(index).write_volatile(0);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
iox.csr.wo(utra::iox::SFR_INTFR, 0);
|
||||||
xous::claim_interrupt(
|
xous::claim_interrupt(
|
||||||
utralib::utra::irqarray10::IRQARRAY10_IRQ,
|
utralib::utra::irqarray10::IRQARRAY10_IRQ,
|
||||||
iox_irq_handler,
|
iox_irq_handler,
|
||||||
|
|
|
||||||
|
|
@ -306,20 +306,29 @@ fn keyboard_service() {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Some(KeyboardOpcode::RegisterKeyObserver) => {
|
Some(KeyboardOpcode::RegisterKeyObserver) => {
|
||||||
let buffer = unsafe { Buffer::from_memory_message(msg.body.memory_message().unwrap()) };
|
if msg.body.has_memory() {
|
||||||
let kr = buffer.as_flat::<KeyboardRegistration, _>().unwrap();
|
let buffer = unsafe { Buffer::from_memory_message(msg.body.memory_message().unwrap()) };
|
||||||
if observer_conn.is_none() {
|
let kr = buffer.as_flat::<KeyboardRegistration, _>().unwrap();
|
||||||
match xns.request_connection_blocking(kr.server_name.as_str()) {
|
if observer_conn.is_none() {
|
||||||
Ok(cid) => {
|
match xns.request_connection_blocking(kr.server_name.as_str()) {
|
||||||
observer_conn = Some(cid);
|
Ok(cid) => {
|
||||||
observer_op = Some(<u32 as From<u32>>::from(kr.listener_op_id.into()) as usize);
|
observer_conn = Some(cid);
|
||||||
}
|
observer_op =
|
||||||
Err(e) => {
|
Some(<u32 as From<u32>>::from(kr.listener_op_id.into()) as usize);
|
||||||
log::error!("couldn't connect to observer: {:?}", e);
|
}
|
||||||
observer_conn = None;
|
Err(e) => {
|
||||||
observer_op = None;
|
log::error!("couldn't connect to observer: {:?}", e);
|
||||||
|
observer_conn = None;
|
||||||
|
observer_op = None;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
log::error!(
|
||||||
|
"RegisterKeyObserver got incorrect argument; ignoring! From PID {:?}: {:?}",
|
||||||
|
msg.sender.pid(),
|
||||||
|
msg
|
||||||
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Some(KeyboardOpcode::SelectKeyMap) => {
|
Some(KeyboardOpcode::SelectKeyMap) => {
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue