From 76424950e373d3b04ac3dd13019151bfba3e8423 Mon Sep 17 00:00:00 2001 From: sumuel Date: Mon, 17 Aug 2026 20:44:55 +0000 Subject: Add the files --- src/detection/board/board_apple.c | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) create mode 100644 src/detection/board/board_apple.c (limited to 'src/detection/board/board_apple.c') diff --git a/src/detection/board/board_apple.c b/src/detection/board/board_apple.c new file mode 100644 index 0000000..e7c4d38 --- /dev/null +++ b/src/detection/board/board_apple.c @@ -0,0 +1,32 @@ +#include "board.h" + +#include "common/apple/cf_helpers.h" + +const char* ffDetectBoard(FFBoardResult* result) { + FF_IOOBJECT_AUTO_RELEASE io_registry_entry_t service = IOServiceGetMatchingService(MACH_PORT_NULL, IOServiceMatching("IOPlatformExpertDevice")); + if (!service) { + return "No IOPlatformExpertDevice found"; + } + + FF_CFTYPE_AUTO_RELEASE CFTypeRef boardId = IORegistryEntryCreateCFProperty(service, CFSTR("board-id"), kCFAllocatorDefault, kNilOptions); + if (boardId) { + ffCfStrGetString(boardId, &result->name); + } else { + io_name_t name; + if (IORegistryEntryGetName(service, name) == kIOReturnSuccess) { + ffStrbufSetS(&result->name, name); + } + } + + FF_CFTYPE_AUTO_RELEASE CFStringRef version = IORegistryEntryCreateCFProperty(service, CFSTR("version"), kCFAllocatorDefault, kNilOptions); + if (version) { + ffCfStrGetString(version, &result->version); + } + + FF_CFTYPE_AUTO_RELEASE CFTypeRef manufacturer = IORegistryEntryCreateCFProperty(service, CFSTR("manufacturer"), kCFAllocatorDefault, kNilOptions); + if (manufacturer) { + ffCfStrGetString(manufacturer, &result->vendor); + } + + return NULL; +} -- cgit v1.2.3