Skip to content

Commit

Permalink
Add ACPI path verification for DeviceProperty injection
Browse files Browse the repository at this point in the history
Ref: #451
  • Loading branch information
khronokernel committed Aug 30, 2021
1 parent 6ca3e35 commit 077af5a
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
2 changes: 1 addition & 1 deletion Resources/Build.py
Original file line number Diff line number Diff line change
Expand Up @@ -539,7 +539,7 @@ def amd_patch(self, backlight_path):
print(f"- Found dGPU ({i + 1}): {Utilities.friendly_hex(device.vendor_id)}:{Utilities.friendly_hex(device.device_id)}")
self.config["#Revision"][f"Hardware-MacPro-dGPU-{i + 1}"] = f"{Utilities.friendly_hex(device.vendor_id)}:{Utilities.friendly_hex(device.device_id)}"

if device.pci_path:
if device.pci_path and device.acpi_path:
print(f"- Found dGPU ({i + 1}) at {device.pci_path}")
if isinstance(device, device_probe.AMD):
print("- Adding Mac Pro, Xserve DRM patches")
Expand Down
3 changes: 3 additions & 0 deletions Resources/device_probe.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ class PCIDevice:
# ioregistryentry: Optional[ioreg.IORegistryEntry] = None
name: Optional[str] = None # Name of IORegistryEntry
model: Optional[str] = None # model property
acpi_path: Optional[str] = None
pci_path: Optional[str] = None

# def __getstate__(self):
Expand All @@ -48,6 +49,8 @@ def from_ioregistry(cls, entry: ioreg.io_registry_entry_t, anti_spoof=False):
device = cls(vendor_id, device_id, int.from_bytes(properties["class-code"][:6], byteorder="little"), name=ioreg.io_name_t_to_str(ioreg.IORegistryEntryGetName(entry, None)[1]))
if "model" in properties:
device.model = properties["model"].strip(b"\0").decode()
if "acpi_path" in properties:
device.acpi_path = properties["acpi-path"].strip(b"\0").decode()
device.populate_pci_path(entry)
return device

Expand Down

0 comments on commit 077af5a

Please sign in to comment.