summaryrefslogtreecommitdiff
path: root/examples/list_modes.rs
diff options
context:
space:
mode:
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());
+ }
+ }
+}