1.\" $NetBSD: edid.9,v 1.9 2014/01/04 15:40:55 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 July 24, 2013 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/videomode.h 40.In dev/videomode/edidvar.h 41.In dev/videomode/edidreg.h 42.Ft int 43.Fo edid_is_valid 44.Fa "uint8_t *data" 45.Fc 46.Ft int 47.Fo edid_parse 48.Fa "uint8_t *data" 49.Fa "struct edid_info *info" 50.Fc 51.Ft void 52.Fo edid_print 53.Fa "struct edid_info *info" 54.Fc 55.Sh DESCRIPTION 56These 57functions provide support parsing the Extended Display Identification Data 58which describes a display device such as a monitor or flat panel display. 59.Pp 60The 61.Fn edid_is_valid 62function simply tests if the EDID block in 63.Fa data 64contains valid data. 65This test includes a verification of the checksum, 66and that valid vendor and product idenfication data is present. 67The data block contain at least 128 bytes. 68.Pp 69The 70.Fn edid_parse 71function parses the supplied 72.Fa data 73block (which again, must be at least 128 bytes), writing the relevant 74data into the structure pointed to by 75.Fa info . 76.Pp 77The 78.Fn edid_print 79function prints the data in the given 80.Fa info 81structure to the console device. 82.\" XXX 83.\" XXX It sure would be nice to have documentation about the details of the 84.\" XXX edid_info structure itself. This takes more time, though, and 85.\" XXX hopefully someone else will write it up. In the meantime, the code 86.\" XXX references should be useful. 87.\" XXX 88.Sh RETURN VALUES 89The 90.Fn edid_is_valid 91function returns 0 if the data block is valid, and 92.Er EINVAL 93otherwise. 94The 95.Fn edid_parse 96function returns zero if the data was successfully parsed, and 97non-zero otherwise. 98.Sh EXAMPLES 99The following code uses these functions 100to retrieve and print information about a monitor: 101.Pp 102.Bd -literal -compact 103 struct edid_info info; 104 i2c_tag_t tag; 105 char buffer[128]; 106 107 ... 108 /* initialize i2c tag... */ 109 ... 110 if ((ddc_read_edid(tag, buffer, 128) == 0) && 111 (edid_parse(buffer, &info) == 0)) 112 edid_print(&info); 113 ... 114.Ed 115.Sh CODE REFERENCES 116The EDID subsystem is implemented within the file 117.Pa sys/dev/videomode/edid.c . 118.Pp 119The EDID subsystem also makes use of VESA Generalized Timing Formula located 120located in 121.Pa sys/dev/videomode/vesagtf.c 122and the generic videomode database located in 123.Pa sys/dev/videomode/videomode.c . 124.Sh SEE ALSO 125.Xr ddc 9 , 126.Xr iic 9 127.Sh HISTORY 128These routines were added in 129.Nx 4.0 . 130.Sh AUTHORS 131.An Garrett D'Amore Aq Mt gdamore@NetBSD.org 132