NAME

DDCCI - Perl extension for control monitors via DDC/CI protocol

SYNOPSIS

use DDCCI;

# list the connected monitors
my $monitors = scan_devices();
for (@{$monitors}) {
	print "Found monitor at $_->{'dev'}: $_->{'id'} s/n $_->{'sn'}\n";
}

# create a new object, using first found monitor
my $ddcci = DDCCI->new($monitors->[0]->{'dev'});

# get monitor EDID and decode it
my $edid = $ddcci->read_edid();
my $decoded = decode_edid($edid);
print "id: $decoded->{'id'}, s/n: $decoded->{'sn'}, type: $decoded->{'type'}\n";

# get monitor capabilities (from the firmware)
my $caps = $ddcci->read_caps();
print "Monitor capabilities: $cap\n";

# get brightness VCP address
my $brt_addr = get_vcp_addr('brightness');	

# get brightness
my $brightness = $ddcci->read_vcp($brt_addr);
print "Monitor brightness is: $brightness\n";

# set brightness to 50%
$ddcci->write_vcp($brt_addr, 50);

DESCRIPTION

DDC/CI (Display Data Channel Command Interface) standard specifies a means for a computer to send commands to its monitor, or to receive data from the monitor, as settings and sensors; it works over a bidirectional link realized though the video interface cable. Specific commands to control monitors are defined in a Monitor Control Command Set (MCCS) standard.

This module allow to control the monitor via DDC/CI commands.

It may work on all compatible monitors connected via VGA, DVI and HDMI ports, where the video card, its drivers and the video cable support this function.

On Linux platform, manual or automated loading of the kernel module 'i2c-dev' may be required, depending on the platform and system configuration.

The current release of this module doesn't work under Windows (sorry guys!).

EXPORT

list_vcp_names()

Returns a ref to an array containing the list of all available VCP names.

get_vcp_name($vcp_addr)

Returns the VCP name corresponding to a given VCP register address. The result is '???' if an unknown address is requested.

get_vcp_addr($vcp_name)

Returns the VCP register address corresponding to a given VCP register name (case insensitive). The result is -1 if an unknown name is requested.

decode_edid($edid)

Returns a ref to an hash containing some details from the given EDID block. Please give a look to the section "LIMITATIONS". The result is undef on error.

scan_devices()

Returns a ref to an array containing the list of the detected monitor; each array element is a ref to an hash describing dev (device), id (ID), sn (serial number), type (input type: analog/digital). The result is undef on error.

new($dev)

Returns a new object associated to the monitor device provided; there are several methods that can be used to intact with the returned object (see "OBJECT METHODS"). The result is undef on error.

OBJECT METHODS

read_edid()

Returns a binary string of exactly 128 bytes, containing the monitor EDID base block (raw format). It may be interpreted using the "decode_edid" function, but please give a look to the section "LIMITATIONS". The result is undef on error.

read_caps()

Returns the string returned by monitor firmware due to capabilities report request. The result is undef on error.

read_vcp(addr)

Returns the value stored in the VCP pointed by the given address. The result is undef on error.

write_vcp(addr, value)

Set the value of the VCP pointed by the given address, and returns the value on success. The result is undef on error.

LIMITATIONS

  • the VCPs addresses for each monitor brand/model may differ from standards, depending also on firmware version and production date. Nothing is guaranteed to work in the same way everywhere, so some testing may be required. Please refer to specific monitor technical manual.

  • at the current stage of development the EDID decoding is pretty crude; a more useful function may be added at application level to replace the function supplied by this module. Give a look at "SEE ALSO" section.

  • reading the VCPs max valid value is not currently supported; on the other hand the max values defined in monitors firmware are often wrong or obsolete - so who cares?

  • some monitors may require an activation sequence to begin accepting DDC/CI commands (i.e. some Samsung monitors). Please refer to specific monitor technical manual.

SEE ALSO

  • https://en.wikipedia.org/wiki/Display_Data_Channel

  • https://en.wikipedia.org/wiki/Extended_Display_Identification_Data

SUPPORT

To get some help or report bugs you may try to contact the author. Nevertheless, since this module is really simple, you might also try to correct the bugs for yourself, and then let me know the fixes.

AUTHOR

R.Scussat - DSP LABS Srl, <rscussat@dsplabs.net>

COPYRIGHT AND LICENSE

Copyright (C) 2019 R.Scussat - DSP LABS Srl

This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself, either Perl version 5.10.1 or, at your option, any later version of Perl 5 you may have available.