Skip to content

Commit d17f299

Browse files
committed
sync dortania
1 parent c77bc1c commit d17f299

File tree

4 files changed

+25
-7
lines changed

4 files changed

+25
-7
lines changed

oclp_r/detections/device_probe.py

Lines changed: 21 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
import subprocess
88
import plistlib
99
import hashlib
10-
10+
import re
1111
from pathlib import Path
1212
from dataclasses import dataclass, field
1313
from typing import Any, ClassVar, Optional, Type, Union
@@ -214,8 +214,26 @@ def populate_pci_path(self, original_entry: ioreg.io_registry_entry_t):
214214
# Virtual PCI devices provide a botched IOService path (us.electronic.kext.vusb)
215215
# We only care about physical devices, so skip them
216216
try:
217-
location = [hex(int(i, 16)) for i in ioreg.io_name_t_to_str(ioreg.IORegistryEntryGetLocationInPlane(entry, "IOService".encode(), None)[1]).split(",") + ["0"]]
218-
paths.append(f"Pci({location[0]},{location[1]})")
217+
# Extract location string and handle possible non-numeric prefixes
218+
location_str = ioreg.io_name_t_to_str(ioreg.IORegistryEntryGetLocationInPlane(entry, "IOService".encode(), None)[1])
219+
location_parts = location_str.split(",")
220+
location_hex = []
221+
222+
for i in location_parts + ["0"]:
223+
i_clean = i.strip()
224+
# Try to extract numeric part from end of string
225+
match = re.search(r'(\d+)$', i_clean)
226+
if match:
227+
# Use the numeric part found
228+
location_hex.append(hex(int(match.group(1))))
229+
elif i_clean and i_clean.isdigit():
230+
# Already a plain number
231+
location_hex.append(hex(int(i_clean)))
232+
else:
233+
# Cannot parse, use default 0
234+
location_hex.append("0x0")
235+
236+
paths.append(f"Pci({location_hex[0]},{location_hex[1]})")
219237
except ValueError:
220238
break
221239
elif ioreg.IOObjectConformsTo(entry, "IOACPIPlatformDevice".encode()):

oclp_r/wx_gui/gui_main_menu.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,8 @@
1212
import threading
1313
import webbrowser
1414

15+
from . import gui_KDK_download, gui_metallib_download
16+
1517
from .. import constants
1618

1719
from ..support import (
@@ -30,8 +32,6 @@
3032
gui_settings,
3133
gui_sys_patch_display,
3234
gui_update,
33-
gui_kdk_dl,
34-
gui_ml_dl,
3535
)
3636

3737

@@ -353,14 +353,14 @@ def on_create_macos_installer(self, event: wx.Event = None):
353353
screen_location=self.GetPosition()
354354
)
355355
def on_download_kdk(self, event: wx.Event = None):
356-
gui_kdk_dl.KDKDownloadFrame(
356+
gui_KDK_download.KDKDownloadFrame(
357357
parent=self,
358358
title=self.title,
359359
global_constants=self.constants,
360360
screen_location=self.GetPosition()
361361
)
362362
def on_download_ml(self, event: wx.Event = None):
363-
gui_ml_dl.MetallibDownloadFrame(
363+
gui_metallib_download.MetallibDownloadFrame(
364364
parent=self,
365365
title=self.title,
366366
global_constants=self.constants,

0 commit comments

Comments
 (0)