EDID(9)
π edid β VESA Extended Display Identification Data π
okay so this is from the EDID(9) page in the Kernel Developer's Manual β it's the little kernel API that reads what your monitor is, bestie. let's get into it β¨
πΈ NAME πΈ
edid β VESA Extended Display Identification Data
like, it's the vibe check your monitor does on itself so the kernel knows what it's working with π
β¨ SYNOPSIS β¨
grab these headers first, they're the whole entrance fee:
#include <dev/videomode/videomode.h>
#include <dev/videomode/edidvar.h>
#include <dev/videomode/edidreg.h>
and here's the three functions, exactly as they are, no cap:
int
edid_is_valid(uint8_t *data);
int
edid_parse(uint8_t *data, struct edid_info *info);
void
edid_print(struct edid_info *info);
π¦ DESCRIPTION π¦
so these functions are literally the support squad for parsing Extended Display Identification Data β that's the data that describes a display device, like a monitor or a flat panel display π₯οΈβ¨
edid_is_valid()β this one just tests if the EDID block indatacontains valid data. simple as that. and what's the test, you ask? it includes a verification of the checksum, and it also checks that valid vendor and product idenfication data is present. also lowkey important: the data block must contain at least 128 bytes. no 128 bytes, no deal π«Άedid_parse()β this one parses the supplieddatablock (and again, it must be at least 128 bytes, same rule, fr fr) and writes the relevant data into the structure pointed to byinfo. it's giving "read the room and take notes" πedid_print()β and this one prints the data in the giveninfostructure to the console device. that's it, that's the whole job π
π RETURN VALUES π
edid_is_valid()returns0if the data block is valid, andEINVALotherwise. so zero = slay,EINVAL= something's off πedid_parse()returns zero if the data was successfully parsed, and non-zero otherwise. like, "0 = we ate" and "non-zero = we did not" π
π EXAMPLES π
okay here's the moment you've been waiting for β actual code that uses these functions to retrieve and print information about a monitor π
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);
...
see how the 128 keeps showing up? that's not a coincidence bestie, that's the minimum π
π§ CODE REFERENCES π§
the EDID subsystem is implemented within the file sys/dev/videomode/edid.c β
it also makes use of VESA Generalized Timing Formula, located located in sys/dev/videomode/vesagtf.c, and the generic videomode database, located in sys/dev/videomode/videomode.c π¦
yeah, the original really does say "located located" twice. iconic of it, honestly. we're keeping it exactly as it is π
π₯ SEE ALSO π₯
go read those next, iykyk π
πΈ HISTORY πΈ
these routines were added in NetBSD 4.0. vintage. retro. a little throwback moment π
π AUTHORS π
Garrett D'Amore <gdamore@NetBSD.org> β the main character who wrote this whole thing π«Ά
and that's the page!! this gorgeous little document came to you from the Debian edition, dated July 24, 2013, and it lives at the bottom of the page as EDID(9) β so like, that's the whole sign-off. mwah πβ¨
π¦ where this page comes from
- nixpkgs unstable: netbsd-source 11.0
- Copyright 2006 Itronix Inc
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms