diff --git a/src/detection/board/board_apple.c b/src/detection/board/board_apple.c index 56f582215..6381590d8 100644 --- a/src/detection/board/board_apple.c +++ b/src/detection/board/board_apple.c @@ -1,13 +1,21 @@ #include "board.h" #include "common/sysctl.h" +#include "util/apple/cf_helpers.h" const char* ffDetectBoard(FFBoardResult* result) { - const char* error = ffSysctlGetString("hw.model", &result->name); - if (error) - return error; + FF_IOOBJECT_AUTO_RELEASE io_registry_entry_t service = IOServiceGetMatchingService(MACH_PORT_NULL, IOServiceMatching("IOPlatformExpertDevice")); + if (!service) + return "No IOPlatformExpertDevice found"; + + io_name_t name; + if (IORegistryEntryGetName(service, name) == kIOReturnSuccess) + ffStrbufSetS(&result->name, name); + + FF_CFTYPE_AUTO_RELEASE CFTypeRef manufacturer = IORegistryEntryCreateCFProperty(service, CFSTR("manufacturer"), kCFAllocatorDefault, kNilOptions); + if (manufacturer) + ffCfStrGetString(manufacturer, &result->vendor); - ffStrbufSetStatic(&result->vendor, "Apple"); return NULL; }