summaryrefslogtreecommitdiff
path: root/examples/list_modes.rs
diff options
context:
space:
mode:
authorInna Palant <ipalant@google.com>2024-03-28 07:02:00 +0000
committerInna Palant <ipalant@google.com>2024-03-28 07:02:00 +0000
commit83e44d41fbd996be3f1600fe48d5698122bcf096 (patch)
tree2022376e2c2ee9bbaa0acf8edb35eaab210576e5 /examples/list_modes.rs
parent3a0cb8eeb1aebb621aeb6079b668a19b3e270738 (diff)
parenta55065196aa142344b2f13f2ab5057b78e7a1acd (diff)
downloaddrm-83e44d41fbd996be3f1600fe48d5698122bcf096.tar.gz
Merge remote-tracking branch 'origin/upstream'platform-tools-35.0.1
Import b/328180645
Diffstat (limited to 'examples/list_modes.rs')
-rw-r--r--examples/list_modes.rs16
1 files changed, 16 insertions, 0 deletions
diff --git a/examples/list_modes.rs b/examples/list_modes.rs
new file mode 100644
index 0000000..bea9b18
--- /dev/null
+++ b/examples/list_modes.rs
@@ -0,0 +1,16 @@
+/// Check the `util` module to see how the `Card` structure is implemented.
+pub mod utils;
+use crate::utils::*;
+
+pub fn main() {
+ let card = Card::open_global();
+
+ let resources = card.resource_handles().unwrap();
+ for connector in resources.connectors().iter() {
+ let info = card.get_connector(*connector, false).unwrap();
+ println!("Connector {:?}: {:?}", info.interface(), info.state());
+ if info.state() == drm::control::connector::State::Connected {
+ println!("\t Modes:\n{:#?}", info.modes());
+ }
+ }
+}