DDCCI

 view release on metacpan or  search on metacpan

lib/DDCCI.pm  view on Meta::CPAN

		return undef;
	}

    bless $self, $class;
	return $self;
}

sub DESTROY {
	my ($self) = @_;

	_close_dev($self->{'fd'}) unless ($self->{'fd'} < 0);
}

sub read_edid {
	my ($self) = @_;

	return _read_edid($self->{'fd'});
}

sub read_caps {
	my ($self) = @_;

	return _read_caps($self->{'fd'});
}

sub read_vcp {
	my ($self, $addr) = @_;

	return _read_vcp($self->{'fd'}, $addr);
}

sub write_vcp {
	my ($self, $addr, $value) = @_;

	return _write_vcp($self->{'fd'}, $addr, $value);
}

1;

__END__

=head1 NAME

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

=head1 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);

=head1 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!).

=head1 EXPORT

=head2 list_vcp_names()

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

=head2 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.

=head2 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.

=head2 decode_edid($edid)

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

=head2 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 B<dev> (device), B<id> (ID), B<sn> (serial number), B<type> (input type: analog/digital). 
The result is I<undef> on error.

=head2 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 L</OBJECT METHODS>).



( run in 4.028 seconds using v1.01-cache-2.11-cpan-2e0ccfb7a10 )