feature: Improve device quirks support

This commit is contained in:
Tera << 8 2025-06-10 22:37:09 -04:00
parent 79c7846ecd
commit ad451ac014
Signed by: imterah
GPG key ID: 8FA7DD57BA6CEA37
6 changed files with 50 additions and 23 deletions

View file

@ -2,13 +2,13 @@ import subprocess
import os
from libunreal.supported_devices import supported_devices
from libunreal.edid import EvdiDisplaySpec
from libunreal.edid import UnrealXRDisplayMetadata
import pyedid
def upload_new_device_edid(display_spec: EvdiDisplaySpec, edid: bytes | bytearray):
def upload_new_device_edid(display_spec: UnrealXRDisplayMetadata, edid: bytes | bytearray):
pass
def fetch_xr_glass_edid(allow_unsupported_devices) -> EvdiDisplaySpec:
def fetch_xr_glass_edid(allow_unsupported_devices) -> UnrealXRDisplayMetadata:
# Scan for all VGA devices and their IDs
pci_device_comand = subprocess.run(["lspci"], capture_output=True)
@ -72,11 +72,11 @@ def fetch_xr_glass_edid(allow_unsupported_devices) -> EvdiDisplaySpec:
max_refresh = int(manufacturer_supported_devices[edid.name]["max_refresh"])
return EvdiDisplaySpec(raw_edid_file, edid.manufacturer_pnp_id, max_width, max_height, max_refresh, card_device, monitor.replace(f"{card_device}-", ""))
return UnrealXRDisplayMetadata(raw_edid_file, edid.manufacturer_pnp_id, manufacturer_supported_devices[edid.name], max_width, max_height, max_refresh, card_device, monitor.replace(f"{card_device}-", ""))
raise ValueError("Could not find supported device. Check if the device is plugged in. If it is plugged in and working correctly, check the README or open an issue.")
def upload_edid_firmware(display: EvdiDisplaySpec, fw: bytes | bytearray):
def upload_edid_firmware(display: UnrealXRDisplayMetadata, fw: bytes | bytearray):
if display.linux_drm_connector == "" or display.linux_drm_card == "":
raise ValueError("Linux DRM connector and/or Linux DRM card not specified!")