1 /// Check the `util` module to see how the `Card` structure is implemented.
2 pub mod utils;
3 use crate::utils::*;
4 
print_properties<T: drm::control::ResourceHandle>(card: &Card, handle: T)5 fn print_properties<T: drm::control::ResourceHandle>(card: &Card, handle: T) {
6     let props = card.get_properties(handle).unwrap();
7 
8     for (&id, &val) in props.iter() {
9         println!("Property: {:?}", id);
10         let info = card.get_property(id).unwrap();
11         println!("{:?}", info.name());
12         println!("{:#?}", info.value_type());
13         println!("Mutable: {}", info.mutable());
14         println!("Atomic: {}", info.atomic());
15         println!("Value: {:?}", info.value_type().convert_value(val));
16         println!();
17     }
18 }
19 
main()20 pub fn main() {
21     let card = Card::open_global();
22 
23     // Enable all possible client capabilities
24     for &cap in capabilities::CLIENT_CAP_ENUMS {
25         if let Err(e) = card.set_client_capability(cap, true) {
26             eprintln!("Unable to activate capability {:?}: {}", cap, e);
27             return;
28         }
29     }
30 
31     let resources = card.resource_handles().unwrap();
32     let plane_res = card.plane_handles().unwrap();
33 
34     for &handle in resources.connectors() {
35         print_properties(&card, handle);
36     }
37 
38     for &handle in resources.framebuffers() {
39         print_properties(&card, handle);
40     }
41 
42     for &handle in resources.crtcs() {
43         print_properties(&card, handle);
44     }
45 
46     for handle in plane_res {
47         print_properties(&card, handle);
48     }
49 }
50