input_synthesis

Function keyboard_event_command

Source
pub async fn keyboard_event_command(
    usage: u32,
    key_event_duration: Duration,
) -> Result<(), Error>
Expand description

Simulates a key press of specified usage.

key_event_duration is the time spent between key-press and key-release events.

§Resolves to

  • Ok(()) if the events were successfully injected.
  • Err(Error) otherwise.

§Corner case handling

  • key_event_duration of zero is permitted, and will result in events being generated as quickly as possible.

§Future directions

Per https://fxbug.dev/42142047, this method will be replaced with a method that deals in fuchsia.input.Keys, instead of HID Usage IDs.