diff options
| author | sumuel <samuel@yakubos.org> | 2026-08-17 20:44:55 +0000 |
|---|---|---|
| committer | sumuel <samuel@yakubos.org> | 2026-08-17 20:44:55 +0000 |
| commit | 76424950e373d3b04ac3dd13019151bfba3e8423 (patch) | |
| tree | 4c3cfdbda039e592b9186be3e28f8d7cfd439e8a /src/detection/board/board_apple.c | |
Add the files
Diffstat (limited to 'src/detection/board/board_apple.c')
| -rw-r--r-- | src/detection/board/board_apple.c | 32 |
1 files changed, 32 insertions, 0 deletions
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; +} |