From 30ca46d2b7a2ebf843210a0957b3e8bd331f284a Mon Sep 17 00:00:00 2001 From: Florian RICHER Date: Mon, 30 Sep 2024 23:31:06 +0200 Subject: [PATCH] Display connectors --- src/card.rs | 5 ++++- src/main.rs | 12 ++++++++++++ 2 files changed, 16 insertions(+), 1 deletion(-) diff --git a/src/card.rs b/src/card.rs index a69b8d0..6383d27 100644 --- a/src/card.rs +++ b/src/card.rs @@ -1,4 +1,5 @@ use drm::Device; +use drm::control::Device as ControlDevice; use std::os::fd::{AsFd, BorrowedFd}; use std::fmt::Debug; @@ -53,4 +54,6 @@ impl Debug for Card { Ok(()) } -} \ No newline at end of file +} + +impl ControlDevice for Card {} \ No newline at end of file diff --git a/src/main.rs b/src/main.rs index cc5a082..dbfdc7e 100644 --- a/src/main.rs +++ b/src/main.rs @@ -1,3 +1,5 @@ +use drm::control::Device; + mod card; fn main() { @@ -9,4 +11,14 @@ fn main() { }; println!("{:?}", gpu); + + let resource_handles = gpu.resource_handles().unwrap(); + + println!("Connectors:"); + for handle in resource_handles.connectors() { + match gpu.get_connector(*handle, false) { + Ok(connector) => println!("\t{} ({:?})", connector.interface().as_str(), connector.state()), + Err(_) => {} + } + } } \ No newline at end of file