Skip to content
Discussion options

You must be logged in to vote

I found a solution that allows me to query the physical dimensions of a monitor using the piaf library.

https://docs.rs/piaf/latest/piaf/struct.DisplayCapabilities.html

Code Example:

[dependencies]
piaf = "0.4"
fn parse_display_capabilities(edid_bytes: &[u8]) -> Result<piaf::DisplayCapabilities, piaf::model::diagnostics::EdidError> {
    let library = piaf::ExtensionLibrary::with_standard_handlers();
    let parsed = piaf::parse_edid(&edid_bytes, &library)?;
    Ok(piaf::capabilities_from_edid(&parsed, &library))
}

fn main() -> Result<(), Box<dyn std::error::Error>> {
    // "/sys/class/drm/card0-HDMI-A-1/edid"
    // "/sys/class/drm/card1-HDMI-A-1/edid"
    let path = "/sys/class/drm/ca…

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by luozhonghe
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
1 participant