sys_patch: Allow only wifi patches when no KDK/internet available

This commit is contained in:
Mykola Grymalyuk
2022-12-19 17:01:06 -07:00
parent 907ce75295
commit 5fdde346cf
3 changed files with 36 additions and 2 deletions

View File

@@ -4,6 +4,8 @@
- Resolve external NVMe reporting regression from 0.5.2
- Implement Legacy Wireless support for Ventura
- Applicable for BCM94328, BCM94322 and Atheros chipsets
- Implement Wifi-only patches when no internet connection available but required (ie. KDKs)
- Allows users to install Legacy Wireless patches, then connect to the internet to install remaining patches
- Increment Binaries:
- PatcherSupportPkg 0.7.2 - release

View File

@@ -51,6 +51,7 @@ class detect_root_patch:
self.fv_enabled = False
self.dosdude_patched = False
self.missing_kdk = False
self.has_network = False
self.missing_whatever_green = False
self.missing_nv_web_nvram = False
@@ -206,6 +207,31 @@ class detect_root_patch:
if self.requires_root_kc is True:
self.missing_kdk = not self.check_kdk()
if (self.legacy_wifi is True and \
self.requires_root_kc is True and \
self.missing_kdk is True and \
self.constants.detected_os >= os_data.os_data.ventura
):
if self.has_network is False:
# Due to the reliance of KDKs for most older patches, we'll allow KDK-less
# installs for Legacy Wifi patches and remove others
self.missing_kdk = False
self.requires_root_kc = False
# Reset patches needing KDK
self.nvidia_tesla = False
self.nvidia_web = False
self.amd_ts1 = False
self.amd_ts2 = False
self.iron_gpu = False
self.sandy_gpu = False
self.legacy_gcn = False
self.legacy_polaris = False
self.brightness_legacy = False
self.legacy_audio = False
self.legacy_gmux = False
self.legacy_keyboard_backlight = False
def check_dgpu_status(self):
dgpu = self.constants.computer.dgpu
@@ -303,7 +329,8 @@ class detect_root_patch:
return (sip, sip_value, sip_hex)
def detect_patch_set(self):
self.detect_gpus()
self.has_network = utilities.verify_network_connection()
if self.model in model_array.LegacyBrightness:
if self.constants.detected_os > os_data.os_data.catalina:
self.brightness_legacy = True
@@ -338,6 +365,8 @@ class detect_root_patch:
else:
self.legacy_gmux = True
self.detect_gpus()
self.root_patch_dict = {
"Graphics: Nvidia Tesla": self.nvidia_tesla,
"Graphics: Nvidia Kepler": self.kepler_gpu,
@@ -371,6 +400,7 @@ class detect_root_patch:
"Validation: Force OpenGL property missing": self.missing_nv_web_opengl if self.nvidia_web is True else False,
"Validation: Force compat property missing": self.missing_nv_compat if self.nvidia_web is True else False,
"Validation: nvda_drv(_vrl) variable missing": self.missing_nv_web_nvram if self.nvidia_web is True else False,
"Validation: Network Connection Required": not self.has_network if (self.requires_root_kc and self.missing_kdk and self.constants.detected_os >= os_data.os_data.ventura.value) else False,
}
return self.root_patch_dict

View File

@@ -360,7 +360,9 @@ def get_firmware_vendor(*, decode: bool = False):
value = value.strip("\0")
return value
def verify_network_connection(url):
def verify_network_connection(url=None):
if url is None:
url = "https://www.google.com"
try:
response = SESSION.head(url, timeout=5, allow_redirects=True)
return True