Skip to content

Commit

Permalink
add marketing model to debug output
Browse files Browse the repository at this point in the history
  • Loading branch information
Bart Reardon committed Jun 7, 2023
1 parent 52b1dfd commit 09b1f03
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions Outset/Functions/SystemUtils.swift
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
import Foundation
import SystemConfiguration
import OSLog
import IOKit

struct OutsetPreferences: Codable {
var waitForNetwork: Bool = false
Expand Down Expand Up @@ -277,6 +278,17 @@ func getDeviceHardwareModel() -> String {
return String(cString: model)
}

func getMarketingModel() -> String {
let appleSiliconProduct = IORegistryEntryFromPath(kIOMasterPortDefault, "IOService:/AppleARMPE/product")
let cfKeyValue = IORegistryEntryCreateCFProperty(appleSiliconProduct, "product-description" as CFString, kCFAllocatorDefault, 0)
IOObjectRelease(appleSiliconProduct)
let keyValue: AnyObject? = cfKeyValue?.takeUnretainedValue()
if keyValue != nil, let data = keyValue as? Data {
return String(data: data, encoding: String.Encoding.utf8)?.trimmingCharacters(in: CharacterSet(["\0"])) ?? ""
}
return ""
}

func getDeviceSerialNumber() -> String {
// Returns the current devices serial number
let platformExpert = IOServiceGetMatchingService(kIOMasterPortDefault, IOServiceMatching("IOPlatformExpertDevice") )
Expand Down Expand Up @@ -311,6 +323,7 @@ func writeSysReport() {
// Logs system information to log file
writeLog("User: \(getConsoleUserInfo())", logLevel: .debug)
writeLog("Model: \(getDeviceHardwareModel())", logLevel: .debug)
writeLog("Marketing Model: \(getMarketingModel())", logLevel: .debug)
writeLog("Serial: \(getDeviceSerialNumber())", logLevel: .debug)
writeLog("OS: \(getOSVersion())", logLevel: .debug)
writeLog("Build: \(getOSBuildVersion())", logLevel: .debug)
Expand Down

0 comments on commit 09b1f03

Please sign in to comment.