backend/drm: make serial optional

The EDID 1.4 spec says that the serial number is optional:

> If this field is not used, then enter “00h, 00h, 00h, 00h”.

Leave the wlr_output.serial field NULL in that case, and hide it
from the output description.
This commit is contained in:
Simon Ser 2022-06-07 11:54:57 +02:00 committed by Isaac Freund
parent 1b27d537d1
commit 1f96f388e9
2 changed files with 15 additions and 5 deletions

View file

@ -1343,9 +1343,13 @@ void scan_drm_connectors(struct wlr_drm_backend *drm,
struct wlr_output *output = &wlr_conn->output;
char description[128];
snprintf(description, sizeof(description), "%s %s %s (%s%s%s)",
output->make, output->model, output->serial, output->name,
subconnector ? " via " : "", subconnector ? subconnector : "");
snprintf(description, sizeof(description), "%s %s%s%s (%s%s%s)",
output->make, output->model,
output->serial ? " " : "",
output->serial ? output->serial : "",
output->name,
subconnector ? " via " : "",
subconnector ? subconnector : "");
wlr_output_set_description(output, description);
free(subconnector);