Merge pull request #413 from emersion/output-serial

Add wlr_output.serial
This commit is contained in:
Drew DeVault 2017-11-11 17:36:14 -05:00 committed by GitHub
commit c1eff3d3af
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 12 additions and 3 deletions

View File

@ -106,8 +106,15 @@ void parse_edid(struct wlr_output *restrict output, size_t len, const uint8_t *d
if (nl) { if (nl) {
*nl = '\0'; *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';
}
} }
} }
} }

View File

@ -43,6 +43,7 @@ struct wlr_output {
char name[16]; char name[16];
char make[48]; char make[48];
char model[16]; char model[16];
char serial[16];
uint32_t scale; uint32_t scale;
int32_t width, height; int32_t width, height;
int32_t phys_width, phys_height; // mm int32_t phys_width, phys_height; // mm

View File

@ -210,8 +210,9 @@ void output_add_notify(struct wl_listener *listener, void *data) {
struct roots_config *config = desktop->config; struct roots_config *config = desktop->config;
wlr_log(L_DEBUG, "Output '%s' added", wlr_output->name); 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_log(L_DEBUG, "%s %s %s %"PRId32"mm x %"PRId32"mm", wlr_output->make,
wlr_output->model, wlr_output->phys_width, wlr_output->phys_height); wlr_output->model, wlr_output->serial, wlr_output->phys_width,
wlr_output->phys_height);
if (wl_list_length(&wlr_output->modes) > 0) { if (wl_list_length(&wlr_output->modes) > 0) {
struct wlr_output_mode *mode = NULL; struct wlr_output_mode *mode = NULL;
mode = wl_container_of((&wlr_output->modes)->prev, mode, link); mode = wl_container_of((&wlr_output->modes)->prev, mode, link);