Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion screeninfo/enumerators/drm.py
Original file line number Diff line number Diff line change
Expand Up @@ -237,6 +237,7 @@ def get_connector_name(connector: "DrmModeConnector") -> str:
prefix = "Unknown"
return f"{prefix}-{connector.connector_type_id}"

got_resources = False
for card_no in range(DRM_MAX_MINOR):
card_path = DRM_DEV_NAME % (DRM_DIR_NAME, card_no)
try:
Expand All @@ -249,7 +250,8 @@ def get_connector_name(connector: "DrmModeConnector") -> str:
try:
res = libdrm.drmModeGetResources(fd)
if not res:
raise ScreenInfoError("Failed to get drm resources")
continue
got_resources = True

res = res.contents
res.fd = fd
Expand All @@ -270,3 +272,6 @@ def get_connector_name(connector: "DrmModeConnector") -> str:

finally:
os.close(fd)

if not got_resources:
raise ScreenInfoError("Failed to get drm resources")