aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authoremersion <contact@emersion.fr>2017-11-11 19:09:34 +0100
committeremersion <contact@emersion.fr>2017-11-11 19:09:34 +0100
commit09279b90a63c5fdb2e28a61f2dfc936285126177 (patch)
treea6f72b67564c0e0552f3cd9a5eaf81c158197558
parent2bee288090d930a09be5f9176a519c1ec02c63de (diff)
Add wlr_output.serial
-rw-r--r--backend/drm/util.c9
-rw-r--r--include/wlr/types/wlr_output.h1
-rw-r--r--rootston/output.c5
3 files changed, 12 insertions, 3 deletions
diff --git a/backend/drm/util.c b/backend/drm/util.c
index 656c070a..c27d7b67 100644
--- a/backend/drm/util.c
+++ b/backend/drm/util.c
@@ -106,8 +106,15 @@ void parse_edid(struct wlr_output *restrict output, size_t len, const uint8_t *d
if (nl) {
*nl = '\0';
}
+ } else if (flag == 0 && data[i + 3] == 0xFF) {
+ sprintf(output->serial, "%.13s", &data[i + 5]);
- break;
+ // Monitor serial numbers are terminated by newline if they're too
+ // short
+ char *nl = strchr(output->serial, '\n');
+ if (nl) {
+ *nl = '\0';
+ }
}
}
}
diff --git a/include/wlr/types/wlr_output.h b/include/wlr/types/wlr_output.h
index df123639..cf000019 100644
--- a/include/wlr/types/wlr_output.h
+++ b/include/wlr/types/wlr_output.h
@@ -43,6 +43,7 @@ struct wlr_output {
char name[16];
char make[48];
char model[16];
+ char serial[16];
uint32_t scale;
int32_t width, height;
int32_t phys_width, phys_height; // mm
diff --git a/rootston/output.c b/rootston/output.c
index d853c45f..a929e6be 100644
--- a/rootston/output.c
+++ b/rootston/output.c
@@ -210,8 +210,9 @@ void output_add_notify(struct wl_listener *listener, void *data) {
struct roots_config *config = desktop->config;
wlr_log(L_DEBUG, "Output '%s' added", wlr_output->name);
- wlr_log(L_DEBUG, "%s %s %"PRId32"mm x %"PRId32"mm", wlr_output->make,
- wlr_output->model, wlr_output->phys_width, wlr_output->phys_height);
+ wlr_log(L_DEBUG, "%s %s %s %"PRId32"mm x %"PRId32"mm", wlr_output->make,
+ wlr_output->model, wlr_output->serial, wlr_output->phys_width,
+ wlr_output->phys_height);
if (wl_list_length(&wlr_output->modes) > 0) {
struct wlr_output_mode *mode = NULL;
mode = wl_container_of((&wlr_output->modes)->prev, mode, link);