1

The goal is to obtain the manufacturer and product ID and the serial number of the display under the Linux platform. I eventually need to get this information in the program in C++. But I also accept the command line acquisition method.

  • How is the display connected? Is this for a generic platform where EDID can be expected to be available, or is it for an embedded platform with more specific requirements? – Stephen Kitt Mar 15 at 9:58
  • A display connected via a video output connector or a built-in display. For a generic platform where EDID can be expected to be available – hxysayhi Mar 16 at 3:46
2

Such information is available via /sys/class/drm subsystem. Tools such as xrandr use it extensively. Now, specifically there is directory for each display in this subsystem, with a file edid, Extended Display Identification Data.

On Debian-based systems there are two packages available, edid-decode and read-edid. Both seem to work alright, but on old and dated models read-edid seems to work well enough, whereas edid-decode returns errors:

EDID block does NOT conform to EDID 1.3!
    Detailed block string not properly terminated
EDID block does not conform at all!
    Bad year of manufacture

So I would recommend installing read-edid package. After you have installed, use parse-edid command as shown below:

$ parse-edid < /sys/class/drm/card0-HDMI-A-1/edid 
Checksum Correct

Section "Monitor"
    Identifier "X20G-NagaIII"
    ModelName "X20G-NagaIII"
    VendorName "SPT"
    # Monitor Manufactured week 42 of 2005
    # EDID version 1.3
    # Digital Display
    DisplaySize 410 310
    Gamma 2.20
    Option "DPMS" "true"
    Horizsync 30-92
    VertRefresh 40-86
    # Maximum pixel clock is 170MHz

The other command get-edid appears to connect to i2c bus and figures out automatically which displays are connected and what data is available. Now, of course this is no C++ method, but these two tools are likely written in C. Consider looking at their source code and note which libraries they use.

  • These two commands really give me some useful information, thank you. But the output I get when I use these two commands has some garbled characters. And there is no product serial number. – hxysayhi Mar 16 at 3:41
  • @hxysayhi Sadly, the problem is likely with displays themselves rather than the commands. Displays often expose EDID information either poorly or not compliantly. I do get serial number for either of my two external displays but not internal laptop display. And as Stephen noted, there might be cases where display simply doesn't expose EDID info at all, for example an I2C or SPI display on Raspberry Pi and other embedded systems. But I'm glad I could help you can find at least some useful information – Sergiy Kolodyazhnyy Mar 16 at 4:05
  • What dose the serial number looks like when you parse the edid file? I parse the edid of a display connected via a video output connector correct, but I didn't get the serial number. The example you gave in the answer does not seem to have a serial number. Can you show me the approximate form of the result you obtained which with serial number? thanks for your help. – hxysayhi Mar 16 at 4:22

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.