edid

package
v0.3.3 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 3, 2026 License: MIT Imports: 8 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package edid reads a display's identity from its EDID: make, model and serial, as outputs are described and matched by.

Index

Constants

View Source
const PNPEnv = "LYS_PNP_IDS"

PNPEnv is the environment variable that points PNPPath at a PNP ID database.

Variables

View Source
var ErrInvalid = errors.New("edid: invalid")

ErrInvalid is a blob that is not an EDID: too short, without the header, or with a bad base block checksum.

Functions

func PNPPath

func PNPPath(getenv func(string) string) string

PNPPath is the PNP ID database to load: the path in PNPEnv when set, read through getenv, and otherwise hwdata's pnp.ids.

Types

type Chromaticity

type Chromaticity struct {
	X, Y float64
}

Chromaticity is a CIE 1931 xy coordinate.

type HDR

type HDR struct {
	Red, Green, Blue, White Chromaticity
	ST2084, HLG             bool
	BT2020                  bool
	StaticMetadata          bool
	MaxLuminance            float64
	MaxAverageLuminance     float64
	MinLuminance            float64
}

HDR is what an EDID says about a display's colour: the primaries of its base block, and the transfer functions, gamut and luminance of its CTA-861 extension's Colorimetry and HDR Static Metadata data blocks. Luminances are in cd/m², and zero where the display leaves them out.

func ParseHDR

func ParseHDR(b []byte) (HDR, error)

ParseHDR reads b's colour characteristics. A display with no CTA-861 extension, or none with the data blocks, has an HDR with only its primaries. It fails with ErrInvalid on a bad base block or a data block that overruns. An extension with a bad checksum fails too, not to promise a signal the display may not take.

type Info

type Info struct {
	PNP    string
	Make   string
	Model  string
	Serial string
}

Info is a display's identity: its PNP manufacturer ID, its make (the manufacturer's name, or the PNP ID when unknown), its model and its serial.

func Parse

func Parse(b []byte, vendors Vendors) (Info, error)

Parse reads the identity from EDID b's base block. The model and serial come from the name and serial descriptors, falling back to the product code and the numeric serial in hex; a zero numeric serial leaves Serial empty. It fails with ErrInvalid.

func (Info) Description

func (i Info) Description() string

Description is make, model and serial joined by spaces, empty ones left out.

type Vendors

type Vendors map[string]string

Vendors maps three-letter PNP IDs to manufacturer names.

func LoadVendors

func LoadVendors(path string) (Vendors, error)

LoadVendors reads a pnp.ids file of tab-separated ID and name lines, skipping lines that are not.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL