MCPcopy Create free account
hub / github.com/cloud-hypervisor/cloud-hypervisor / trigger_key

Method trigger_key

devices/src/legacy/gpio_pl061.rs:224–240  ·  view source on GitHub ↗
(&mut self, key: u32)

Source from the content-addressed store, hash-verified

222 }
223
224 pub fn trigger_key(&mut self, key: u32) -> Result<()> {
225 let mask = (1 << key) as u32;
226 if (!self.dir & mask) > 0 {
227 // emulate key event
228 // By default, Input Pin is configured to detect both rising and falling edges.
229 // So reverse the input pin data to generate a pulse.
230 self.data |= !(self.data & mask) & mask;
231 self.pl061_internal_update();
232
233 match self.trigger_gpio_interrupt() {
234 Ok(_) | Err(Error::GpioInterruptDisabled) => return Ok(()),
235 Err(e) => return Err(e),
236 }
237 }
238
239 Err(Error::GpioTriggerKeyFailure(key))
240 }
241
242 fn trigger_gpio_interrupt(&self) -> Result<()> {
243 // Bits set to high in GPIOIE(Interrupt mask register) allow the corresponding pins to

Callers 1

notify_power_buttonMethod · 0.80

Calls 2

pl061_internal_updateMethod · 0.80

Tested by

no test coverage detected