Configure outputs with make, model, serial in rootston

Added fallbacks in DRM backend in case EDID extension data for model and serial is missing.

Updates #403
master
emersion 7 years ago
parent aead5019a7
commit 91d72040e5
No known key found for this signature in database
GPG Key ID: 0FDE7BE0E88F5E48

@ -93,6 +93,12 @@ void parse_edid(struct wlr_output *restrict output, size_t len, const uint8_t *d
uint16_t id = (data[8] << 8) | data[9]; uint16_t id = (data[8] << 8) | data[9];
snprintf(output->make, sizeof(output->make), "%s", get_manufacturer(id)); snprintf(output->make, sizeof(output->make), "%s", get_manufacturer(id));
uint16_t model = data[10] | (data[11] << 8);
snprintf(output->model, sizeof(output->model), "0x%04X", model);
uint32_t serial = data[12] | (data[13] << 8) | (data[14] << 8) | (data[15] << 8);
snprintf(output->serial, sizeof(output->serial), "0x%08X", serial);
output->phys_width = ((data[68] & 0xf0) << 4) | data[66]; output->phys_width = ((data[68] & 0xf0) << 4) | data[66];
output->phys_height = ((data[68] & 0x0f) << 8) | data[67]; output->phys_height = ((data[68] & 0x0f) << 8) | data[67];

@ -466,10 +466,15 @@ void roots_config_destroy(struct roots_config *config) {
struct roots_output_config *roots_config_get_output(struct roots_config *config, struct roots_output_config *roots_config_get_output(struct roots_config *config,
struct wlr_output *output) { struct wlr_output *output) {
struct roots_output_config *o_config; char name[83];
wl_list_for_each(o_config, &config->outputs, link) { snprintf(name, sizeof(name), "%s %s %s", output->make, output->model,
if (strcmp(o_config->name, output->name) == 0) { output->serial);
return o_config;
struct roots_output_config *oc;
wl_list_for_each(oc, &config->outputs, link) {
if (strcmp(oc->name, output->name) == 0 ||
strcmp(oc->name, name) == 0) {
return oc;
} }
} }

@ -291,7 +291,7 @@ 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 %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->serial, wlr_output->phys_width, wlr_output->model, wlr_output->serial, wlr_output->phys_width,
wlr_output->phys_height); wlr_output->phys_height);
if (wl_list_length(&wlr_output->modes) > 0) { if (wl_list_length(&wlr_output->modes) > 0) {

Loading…
Cancel
Save