1.\" $NetBSD: edid.9,v 1.4 2010/12/02 12:54:13 wiz Exp $ 2.\" 3.\" Copyright 2006 Itronix Inc. 4.\" All rights reserved. 5.\" 6.\" Written by Garrett D'Amore for Itronix Inc. 7.\" 8.\" Redistribution and use in source and binary forms, with or without 9.\" modification, are permitted provided that the following conditions 10.\" are met: 11.\" 1. Redistributions of source code must retain the above copyright 12.\" notice, this list of conditions and the following disclaimer. 13.\" 2. Redistributions in binary form must reproduce the above copyright 14.\" notice, this list of conditions and the following disclaimer in the 15.\" documentation and/or other materials provided with the distribution. 16.\" 3. The name of Intronix Inc. may not be used to endorse 17.\" or promote products derived from this software without specific prior 18.\" written permission. 19.\" 20.\" THIS SOFTWARE IS PROVIDED BY INTRONIX INC. ``AS IS'' AND 21.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED 22.\" TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 23.\" PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL ITRONIX INC. BE LIABLE FOR ANY 24.\" DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 25.\" CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 26.\" SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 27.\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 28.\" CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 29.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 30.\" POSSIBILITY OF SUCH DAMAGE. 31.\" 32.Dd May 11, 2006 33.Dt EDID 9 34.Os 35.Sh NAME 36.Nm edid 37.Nd VESA Extended Display Identification Data 38.Sh SYNOPSIS 39.In dev/videomode/edidvar.h 40.In dev/videomode/edidreg.h 41.Ft int 42.Fo edid_is_valid 43.Fa "uint8_t *data" 44.Fc 45.Ft int 46.Fo edid_parse 47.Fa "uint8_t *data" 48.Fa "struct edid_info *info" 49.Fc 50.Ft void 51.Fo edid_print 52.Fa "struct edid_info *info" 53.Fc 54.Sh DESCRIPTION 55These 56functions provide support parsing the Extended Display Identification Data 57which describes a display device such as a monitor or flat panel display. 58.Pp 59The 60.Fn edid_is_valid 61function simply tests if the EDID block in 62.Fa data 63contains valid data. This test includes a verification of the checksum, 64and that valid vendor and product idenfication data is present. The data 65block contain at least 128 bytes. 66.Pp 67The 68.Fn edid_parse 69function parses the supplied 70.Fa data 71block (which again, must be at least 128 bytes), writing the relevant 72data into the structure pointed to by 73.Fa info . 74.Pp 75The 76.Fn edid_print 77function prints the data in the given 78.Fa info 79structure to the console device. 80.Pp 81.\" XXX 82.\" XXX It sure would be nice to have documentation about the details of the 83.\" XXX edid_info structure itself. This takes more time, though, and 84.\" XXX hopefully someone else will write it up. In the meantime, the code 85.\" XXX references should be useful. 86.\" XXX 87.Sh RETURN VALUES 88The 89.Fn edid_is_valid 90function returns 0 if the data block is valid, and 91.Er EINVAL 92otherwise. 93The 94.Fn edid_parse 95function returns zero if the data was successfully parsed, and 96non-zero otherwise. 97.Sh CODE REFERENCES 98The EDID subsystem is implemented within the file 99.Pa sys/dev/videomode/edid.c . 100.Pp 101The EDID subsystem also makes use of VESA Generalized Timing Formula located 102located in 103.Pa sys/dev/videomode/vesagtf.c 104and the generic videomode database located in 105.Pa sys/dev/videomode/videomode.c . 106.Sh EXAMPLES 107The following code uses these functions 108to retrieve and print information about a monitor: 109.Pp 110.Bd -literal -compact 111 struct edid_info info; 112 i2c_tag_t tag; 113 char buffer[128]; 114 115 ... 116 /* initialize i2c tag... */ 117 ... 118 if ((ddc_read_edid(tag, buffer, 128) == 0) && 119 (edid_parse(buffer, &info) == 0)) 120 edid_print(info); 121 ... 122.Ed 123.Sh SEE ALSO 124.Xr ddc 9 , 125.Xr iic 9 126.Sh HISTORY 127These routines were added in 128.Nx 4.0 . 129.Sh AUTHORS 130.An Garrett D'Amore Aq gdamore@NetBSD.org 131