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
25 changes: 16 additions & 9 deletions archinstall/lib/hardware.py
Original file line number Diff line number Diff line change
Expand Up @@ -193,6 +193,18 @@ def loaded_modules(self) -> list[str]:

return modules

@cached_property
def graphics_devices(self) -> dict[str, str]:
"""
Returns detected graphics devices (cached)
"""
cards: dict[str, str] = {}
for line in SysCommand('lspci'):
if b' VGA ' in line or b' 3D ' in line:
_, identifier = line.split(b': ', 1)
cards[identifier.strip().decode('UTF-8')] = str(line)
return cards


_sys_info = _SysInfo()

Expand All @@ -209,24 +221,19 @@ def has_uefi() -> bool:

@staticmethod
def _graphics_devices() -> dict[str, str]:
cards: dict[str, str] = {}
for line in SysCommand('lspci'):
if b' VGA ' in line or b' 3D ' in line:
_, identifier = line.split(b': ', 1)
cards[identifier.strip().decode('UTF-8')] = str(line)
return cards
return _sys_info.graphics_devices

@staticmethod
def has_nvidia_graphics() -> bool:
return any('nvidia' in x.lower() for x in SysInfo._graphics_devices())
return any('nvidia' in x.lower() for x in _sys_info.graphics_devices)

@staticmethod
def has_amd_graphics() -> bool:
return any('amd' in x.lower() for x in SysInfo._graphics_devices())
return any('amd' in x.lower() for x in _sys_info.graphics_devices)

@staticmethod
def has_intel_graphics() -> bool:
return any('intel' in x.lower() for x in SysInfo._graphics_devices())
return any('intel' in x.lower() for x in _sys_info.graphics_devices)

@staticmethod
def cpu_vendor() -> CpuVendor | None:
Expand Down