MCPcopy Create free account
hub / github.com/emberian/evdev / fmt

Method fmt

src/sync_stream.rs:663–779  ·  view source on GitHub ↗
(&self, f: &mut fmt::Formatter)

Source from the content-addressed store, hash-verified

661
662impl fmt::Display for Device {
663 fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
664 writeln!(f, "{}:", self.name().unwrap_or("Unnamed device"))?;
665 let (maj, min, pat) = self.driver_version();
666 writeln!(f, " Driver version: {maj}.{min}.{pat}")?;
667 if let Some(ref phys) = self.physical_path() {
668 writeln!(f, " Physical address: {phys:?}")?;
669 }
670 if let Some(ref uniq) = self.unique_name() {
671 writeln!(f, " Unique name: {uniq:?}")?;
672 }
673
674 let id = self.input_id();
675
676 writeln!(f, " Bus: {}", id.bus_type())?;
677 writeln!(f, " Vendor: {:#x}", id.vendor())?;
678 writeln!(f, " Product: {:#x}", id.product())?;
679 writeln!(f, " Version: {:#x}", id.version())?;
680 writeln!(f, " Properties: {:?}", self.properties())?;
681
682 if let (Some(supported_keys), Some(key_vals)) =
683 (self.supported_keys(), self.state.key_vals())
684 {
685 writeln!(f, " KeyTypes supported:")?;
686 for key in supported_keys.iter() {
687 let key_idx = key.code() as usize;
688 writeln!(
689 f,
690 " {:?} ({}index {})",
691 key,
692 if key_vals.contains(key) {
693 "pressed, "
694 } else {
695 ""
696 },
697 key_idx
698 )?;
699 }
700 }
701
702 if let Some(supported_relative) = self.supported_relative_axes() {
703 writeln!(f, " Relative Axes: {supported_relative:?}")?;
704 }
705
706 if let (Some(supported_abs), Some(abs_vals)) =
707 (self.supported_absolute_axes(), &self.state.abs_vals)
708 {
709 writeln!(f, " Absolute Axes:")?;
710 for abs in supported_abs.iter() {
711 writeln!(
712 f,
713 " {:?} ({:?}, index {})",
714 abs, abs_vals[abs.0 as usize], abs.0
715 )?;
716 }
717 }
718
719 if let Some(supported_misc) = self.misc_properties() {
720 writeln!(f, " Miscellaneous capabilities: {supported_misc:?}")?;

Callers

nothing calls this directly

Calls 15

key_valsMethod · 0.80
iterMethod · 0.80
switch_valsMethod · 0.80
led_valsMethod · 0.80
containsMethod · 0.80
driver_versionMethod · 0.45
physical_pathMethod · 0.45
unique_nameMethod · 0.45
input_idMethod · 0.45
supported_keysMethod · 0.45
codeMethod · 0.45

Tested by

no test coverage detected