Skip to content

Commit

Permalink
ddc_open_display(): only check sysfs status attribute if driver is kn…
Browse files Browse the repository at this point in the history
…own to set it properly

addreses issue #413
  • Loading branch information
rockowitz committed May 8, 2024
1 parent 3787e40 commit e32a4fd
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion src/ddc/ddc_packet_io.c
Original file line number Diff line number Diff line change
Expand Up @@ -149,6 +149,12 @@ void ddc_dbgrpt_valid_display_handles(int depth) {
}


// TODO: generalize, move to more appropriate location
static bool is_drm_conformant_driver(const char * driver_name) {
return streq(driver_name, "amdgpu") || streq(driver_name, "i915");
}


//
// Open/Close Display
//
Expand Down Expand Up @@ -184,7 +190,10 @@ ddc_open_display(
int fd = -1;

// DBGTRC_NOPREFIX(false, DDCA_TRC_NONE, "driver_name: %s", dref->driver_name);
if (dref->drm_connector && strlen(dref->drm_connector) > 0) {
if (is_drm_conformant_driver(dref->driver_name) &&
dref->drm_connector &&
strlen(dref->drm_connector) > 0)
{
char * status;
RPT_ATTR_TEXT(-1, &status, "/sys/class/drm", dref->drm_connector, "status");
if (streq(status, "disconnected"))
Expand Down

0 comments on commit e32a4fd

Please sign in to comment.