df_ddc
DDC/CI (VESA MCCS) monitor control backend. Low-level I/O layer for VCP features: brightness, contrast, volume, input, power.
Backends
| OS | Enumeration | I/O |
|---|---|---|
| Windows | EnumDisplayMonitors + GetPhysicalMonitorsFromHMONITOR |
HighLevelMonitorConfigurationAPI |
| Linux | scan of /dev/i2c-* with VCP 0x10 probe |
raw I2C, DDC packets over i2c-dev |
On Linux, buses that do not answer a standard VCP probe are skipped, which
filters out notebook-internal smbus devices.
Usage
use list_monitors;
API
list_monitors() -> Vec<DisplayDevice>— enumerate DDC-capable monitors.DisplayDevice::info: String— OS-supplied description (e.g.\\.\DISPLAY1\Monitor0orI2C Display Bus (i2c-4)).trait DdcControl(ddc_trait.rs):get_capabilities() -> Result<MonitorCapabilities, DdcError>get_vcp_feature(code: u8) -> Result<VcpValue, DdcError>set_vcp_feature(code: u8, value: u16) -> Result<(), DdcError>set_brightness(value: u32)set_contrast(value: u32)set_power(state: PowerState)set_input(source: InputSource)
- Types (
ddc_types.rs):MonitorCapabilities,InputSource,PowerState,VcpCode,VcpValue.
Bundled binary
src/bin/ddc_mgr.rs — small standalone CLI for smoke tests:
Benchmarks
benches/ddc_operations.rs uses criterion.
Platform gates
cfg(target_os = "windows")— pullswindowscrate withWin32_Graphics_GdiandWin32_Devices_Display.cfg(target_os = "linux")— pullslibcfor I2Cioctl.
Safety notes
- The Windows callback in
list_monitors()isunsafe extern "system". The vector must outlive the call toEnumDisplayMonitors; this is guaranteed by the call structure. - On Linux, each I2C bus is briefly
open()/ioctl()-probed. Measured at well under 50 ms for a single-thread enumeration.
License
MIT OR Apache-2.0