Skip to content

Commit 0970082

Browse files
committed
Improve handling of missing EDIDs in SysFiles method (#45)
1 parent df30be2 commit 0970082

File tree

1 file changed

+12
-9
lines changed

1 file changed

+12
-9
lines changed

screen_brightness_control/linux.py

Lines changed: 12 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -90,15 +90,18 @@ def get_display_info(cls, display: Optional[DisplayIdentifier] = None) -> List[d
9090
device['uid'] = device['uid'] or i2c_bus_from_drm_device(drm_paths[pci_path])
9191

9292
if os.path.isfile('%s/device/edid' % device['path']):
93-
device['edid'] = EDID.hexdump('%s/device/edid' % device['path'])
94-
95-
for key, value in zip(
96-
('manufacturer_id', 'manufacturer', 'model', 'name', 'serial'),
97-
EDID.parse(device['edid'])
98-
):
99-
if value is None:
100-
continue
101-
device[key] = value
93+
device['edid'] = EDID.hexdump('%s/device/edid' % device['path']) or None
94+
95+
if device['edid'] is None:
96+
cls._logger.warning(f'EDID file exists but is empty for display {device["path"]}')
97+
else:
98+
for key, value in zip(
99+
('manufacturer_id', 'manufacturer', 'model', 'name', 'serial'),
100+
EDID.parse(device['edid'])
101+
):
102+
if value is None:
103+
continue
104+
device[key] = value
102105

103106
displays_by_edid[device['edid']] = device
104107
index += 1

0 commit comments

Comments
 (0)