# Detecting monitors (for the clientreport script)

The current clientreport script uses a rather crude method to determine the monitor connected to a DICE desktop. It greps through /var/log/Xorg.0.log to pick out the monitor model name, serial number and year of manufacture.

Whilst this has worked for many, many years, it is obviously rather risky. That log file is not designed to be processed and the format could change at any time. Moreover, the current code only reports on one monitor and doesn’t work for monitors attached via an nVidia graphics card.

The obvious solution was to detect monitors using the “proper” mechanism – that is, to read and decode the EDID data for each monitor. A monitor’s EDID data is usually available via /sys/class/drm/{port}/edid. On machines with nVidia cards (at least using the nVidia drivers), the EDID data is not available via /sys/class and must instead be obtained using the VBE interface. This is done using the monitor-get-edid script which is part of the monitor-edid package. However, only one monitor can be detected using this method.

Having obtained the EDID data, it can be parsed either by edid-decode, part of the xorg-x11-utils package, or monitor-parse-edid which is part of the monitor-edid package. Unfortunately, neither of these scripts display the serial number of the monitor, so it was decided to ship a patched version of the monitor-parse-edid script with clientreport which does display the serial number and other useful information.

The new clientreport script first attempts to locate the EDID data using /sys/class. If that fails it falls back to using the VBE method.

This entry was posted in Inventory project. Bookmark the permalink.