Display connectors

This commit is contained in:
Florian RICHER 2024-09-30 23:31:06 +02:00
parent 2d40952aab
commit 30ca46d2b7
2 changed files with 16 additions and 1 deletions

View file

@ -1,4 +1,5 @@
use drm::Device; use drm::Device;
use drm::control::Device as ControlDevice;
use std::os::fd::{AsFd, BorrowedFd}; use std::os::fd::{AsFd, BorrowedFd};
use std::fmt::Debug; use std::fmt::Debug;
@ -53,4 +54,6 @@ impl Debug for Card {
Ok(()) Ok(())
} }
} }
impl ControlDevice for Card {}

View file

@ -1,3 +1,5 @@
use drm::control::Device;
mod card; mod card;
fn main() { fn main() {
@ -9,4 +11,14 @@ fn main() {
}; };
println!("{:?}", gpu); 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(_) => {}
}
}
} }