Skip to content

Commit

Permalink
Utils.swift: Add handling for Intel Virtual Machines
Browse files Browse the repository at this point in the history
Pallas will override the host’s detected Board ID to “VMM-x86_64” on Intel VMs to allow for software updates regardless of the original board ID.
  • Loading branch information
khronokernel authored and erikng committed Aug 1, 2024
1 parent 34a7e7f commit 5006e8e
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion Nudge/Utilities/Utils.swift
Original file line number Diff line number Diff line change
Expand Up @@ -710,12 +710,23 @@ struct DeviceManager {
func getHardwareModel() -> String {
getSysctlValue(for: "hw.model") ?? ""
}

func getVirtualMachineStatus() -> Bool {
if getSysctlValue(for: "kern.hv_vmm_present") == "1" {
return true
}
return false
}

func getHardwareModelIDs() -> [String] {
let boardID = getIORegInfo(serviceTarget: "board-id") ?? "Unknown"
var boardID = getIORegInfo(serviceTarget: "board-id") ?? "Unknown"
let bridgeID = getBridgeModelID()
let hardwareModelID = getIORegInfo(serviceTarget: "target-sub-type") ?? "Unknown"
let gestaltModelStringID = getKeyResultFromGestalt("HWModelStr")

if getVirtualMachineStatus() && getCPUTypeString() == "Intel" {
boardID = "VMM-x86_64"
}

LogManager.debug("Hardware Board ID: \(boardID)", logger: utilsLog)
LogManager.debug("Hardware Bridge ID: \(bridgeID)", logger: utilsLog)
Expand Down

0 comments on commit 5006e8e

Please sign in to comment.