-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #3 from andrewdavidmackenzie/main
Update edition, fix clippies and add an example
- Loading branch information
Showing
7 changed files
with
89 additions
and
41 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,23 +2,27 @@ | |
name = "ddc-macos" | ||
version = "0.2.0" | ||
authors = ["Haim Gelfenbeyn <[email protected]>"] | ||
edition = "2018" | ||
description = "DDC/CI monitor control on MacOS" | ||
documentation = "http://haimgel.github.io/ddc-macos-rs/ddc_macos" | ||
readme = "README.md" | ||
repository = "https://github.com/haimgel/ddc-macos-rs" | ||
license = "MIT" | ||
keywords = ["ddc", "mccs", "vcp", "vesa", "macos"] | ||
categories = ["hardware-support", "os::macos-apis"] | ||
edition = "2021" | ||
|
||
[dependencies] | ||
core-foundation = "^0.9.1" | ||
core-foundation-sys = "^0.8.1" | ||
core-graphics = "^0.22.1" | ||
ddc = "^0.2.0" | ||
io-kit-sys = "0.1.0" | ||
mach = "^0.3.2" | ||
thiserror = "^1" | ||
core-foundation = "0.9" | ||
core-foundation-sys = "0.8" | ||
core-graphics = "0.23" | ||
ddc = "0.2" | ||
io-kit-sys = "0.3" | ||
mach = "0.3" | ||
thiserror = "1" | ||
|
||
[dev-dependencies] | ||
edid-rs = "0.1" | ||
nom = "*" | ||
|
||
[badges] | ||
maintenance = { status = "actively-developed" } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
extern crate ddc; | ||
extern crate ddc_macos; | ||
|
||
use ddc::Ddc; | ||
use ddc_macos::Monitor; | ||
|
||
fn main() { | ||
let monitors = Monitor::enumerate() | ||
.expect("Could not enumerate external monitors"); | ||
|
||
if monitors.is_empty() { | ||
println!("No external monitors found"); | ||
} else { | ||
for mut monitor in monitors { | ||
println!("Monitor"); | ||
println!("\tDescription: {}", monitor.description()); | ||
if let Some(desc) = monitor.product_name() { | ||
println!("\tProduct Name: {}", desc); | ||
} | ||
if let Some(number) = monitor.serial_number() { | ||
println!("\tSerial Number: {}", number); | ||
} | ||
if let Ok(input) = monitor.get_vcp_feature(0x60) { | ||
println!("\tCurrent input: {:04x}", input.value()); | ||
} | ||
|
||
if let Some(data) = monitor.edid() { | ||
let mut cursor = std::io::Cursor::new(&data); | ||
let mut reader = edid_rs::Reader::new(&mut cursor); | ||
match edid_rs::EDID::parse(&mut reader) { | ||
Ok(edid) => println!("\tEDID Info: {:?}", edid), | ||
_ => println!("\tCould not parse provided EDID information"), | ||
} | ||
} | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file not shown.