Skip to content

Commit 3fcbd80

Browse files
committed
Board (macOS): detect board-id if available
Ref: GuillaumeGomez/sysinfo#1545
1 parent 38887e7 commit 3fcbd80

File tree

2 files changed

+17
-3
lines changed

2 files changed

+17
-3
lines changed

src/detection/board/board_apple.c

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,19 @@ const char* ffDetectBoard(FFBoardResult* result)
99
if (!service)
1010
return "No IOPlatformExpertDevice found";
1111

12-
io_name_t name;
13-
if (IORegistryEntryGetName(service, name) == kIOReturnSuccess)
14-
ffStrbufSetS(&result->name, name);
12+
FF_CFTYPE_AUTO_RELEASE CFTypeRef boardId = IORegistryEntryCreateCFProperty(service, CFSTR("board-id"), kCFAllocatorDefault, kNilOptions);
13+
if (boardId)
14+
ffCfStrGetString(boardId, &result->name);
15+
else
16+
{
17+
io_name_t name;
18+
if (IORegistryEntryGetName(service, name) == kIOReturnSuccess)
19+
ffStrbufSetS(&result->name, name);
20+
}
21+
22+
FF_CFTYPE_AUTO_RELEASE CFStringRef version = IORegistryEntryCreateCFProperty(service, CFSTR("version"), kCFAllocatorDefault, kNilOptions);
23+
if (version)
24+
ffCfStrGetString(version, &result->version);
1525

1626
FF_CFTYPE_AUTO_RELEASE CFTypeRef manufacturer = IORegistryEntryCreateCFProperty(service, CFSTR("manufacturer"), kCFAllocatorDefault, kNilOptions);
1727
if (manufacturer)

src/detection/host/host_apple.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,10 @@ const char* getOthersByIokit(FFHostResult* host)
3636
if (manufacturer)
3737
ffCfStrGetString(manufacturer, &host->vendor);
3838

39+
FF_CFTYPE_AUTO_RELEASE CFStringRef version = IORegistryEntryCreateCFProperty(registryEntry, CFSTR("version"), kCFAllocatorDefault, kNilOptions);
40+
if (version)
41+
ffCfStrGetString(version, &host->version);
42+
3943
return NULL;
4044
}
4145

0 commit comments

Comments
 (0)