[BACK]Return to edid.9 CVS log [TXT][DIR] Up to [cvs.NetBSD.org] / src / share / man / man9

File: [cvs.NetBSD.org] / src / share / man / man9 / edid.9 (download)

Revision 1.7, Thu Jul 25 14:10:30 2013 UTC (4 years ago) by tcort
Branch: MAIN
Changes since 1.6: +4 -3 lines

edid.9: fixes for example code

- 'struct edid_info' in edidvar.h uses 'struct videomode' so
videomode.h needs to be included too.
- edid_print takes a pointer to 'struct edid_info' so add the & operator.

OK by wiz@

.\"	$NetBSD: edid.9,v 1.7 2013/07/25 14:10:30 tcort Exp $
.\"
.\" Copyright 2006 Itronix Inc.
.\" All rights reserved.
.\"
.\" Written by Garrett D'Amore for Itronix Inc.
.\"
.\" Redistribution and use in source and binary forms, with or without
.\" modification, are permitted provided that the following conditions
.\" are met:
.\" 1. Redistributions of source code must retain the above copyright
.\"    notice, this list of conditions and the following disclaimer.
.\" 2. Redistributions in binary form must reproduce the above copyright
.\"    notice, this list of conditions and the following disclaimer in the
.\"    documentation and/or other materials provided with the distribution.
.\" 3. The name of Intronix Inc. may not be used to endorse
.\"    or promote products derived from this software without specific prior
.\"    written permission.
.\"
.\" THIS SOFTWARE IS PROVIDED BY INTRONIX INC. ``AS IS'' AND
.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
.\" TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
.\" PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL ITRONIX INC.  BE LIABLE FOR ANY
.\" DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
.\" CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
.\" SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
.\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
.\" CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
.\" POSSIBILITY OF SUCH DAMAGE.
.\"
.Dd July 24, 2013
.Dt EDID 9
.Os
.Sh NAME
.Nm edid
.Nd VESA Extended Display Identification Data
.Sh SYNOPSIS
.In dev/videomode/videomode.h
.In dev/videomode/edidvar.h
.In dev/videomode/edidreg.h
.Ft int
.Fo edid_is_valid
.Fa "uint8_t *data"
.Fc
.Ft int
.Fo edid_parse
.Fa "uint8_t *data"
.Fa "struct edid_info *info"
.Fc
.Ft void
.Fo edid_print
.Fa "struct edid_info *info"
.Fc
.Sh DESCRIPTION
These
functions provide support parsing the Extended Display Identification Data
which describes a display device such as a monitor or flat panel display.
.Pp
The
.Fn edid_is_valid
function simply tests if the EDID block in
.Fa data
contains valid data.
This test includes a verification of the checksum,
and that valid vendor and product idenfication data is present.
The data block contain at least 128 bytes.
.Pp
The
.Fn edid_parse
function parses the supplied
.Fa data
block (which again, must be at least 128 bytes), writing the relevant
data into the structure pointed to by
.Fa info .
.Pp
The
.Fn edid_print
function prints the data in the given
.Fa info
structure to the console device.
.Pp
.\" XXX
.\" XXX It sure would be nice to have documentation about the details of the
.\" XXX edid_info structure itself.  This takes more time, though, and
.\" XXX hopefully someone else will write it up.  In the meantime, the code
.\" XXX references should be useful.
.\" XXX
.Sh RETURN VALUES
The
.Fn edid_is_valid
function returns 0 if the data block is valid, and
.Er EINVAL
otherwise.
The
.Fn edid_parse
function returns zero if the data was successfully parsed, and
non-zero otherwise.
.Sh CODE REFERENCES
The EDID subsystem is implemented within the file
.Pa sys/dev/videomode/edid.c .
.Pp
The EDID subsystem also makes use of VESA Generalized Timing Formula located
located in
.Pa sys/dev/videomode/vesagtf.c
and the generic videomode database located in
.Pa sys/dev/videomode/videomode.c .
.Sh EXAMPLES
The following code uses these functions
to retrieve and print information about a monitor:
.Pp
.Bd -literal -compact
	struct edid_info info;
	i2c_tag_t        tag;
	char		 buffer[128];

	...
	/* initialize i2c tag... */
	...
	if ((ddc_read_edid(tag, buffer, 128) == 0) &&
	    (edid_parse(buffer, &info) == 0))
		edid_print(&info);
	...
.Ed
.Sh SEE ALSO
.Xr ddc 9 ,
.Xr iic 9
.Sh HISTORY
These routines were added in
.Nx 4.0 .
.Sh AUTHORS
.An Garrett D'Amore Aq Mt gdamore@NetBSD.org