diff options
| author | oldmud0 <oldmud0@users.noreply.github.com> | 2020-05-22 19:17:55 -0500 |
|---|---|---|
| committer | oldmud0 <oldmud0@users.noreply.github.com> | 2020-05-22 19:17:55 -0500 |
| commit | fd1855b8d0ecaa56ae3165ad5d8f3bd65ff77a64 (patch) | |
| tree | 9c27d658dd8f19e649e1742b0fd39104a50a3ca6 /src/hardware_functions.cpp | |
| parent | 8928aa2718378bc42d20d5bbe6c17be68d65d6f3 (diff) | |
| parent | 4617e3135ed14a28c4129154486022947fda9d82 (diff) | |
Merge KFO source unconditionally into AO2
Diffstat (limited to 'src/hardware_functions.cpp')
| -rw-r--r-- | src/hardware_functions.cpp | 21 |
1 files changed, 19 insertions, 2 deletions
diff --git a/src/hardware_functions.cpp b/src/hardware_functions.cpp index 4dbc4380..c898aefe 100644 --- a/src/hardware_functions.cpp +++ b/src/hardware_functions.cpp @@ -51,8 +51,25 @@ QString get_hdid() #elif defined __APPLE__ QString get_hdid() { - // hdids are broken at this point anyways - return "just a mac passing by"; + CFStringRef serial; + char buffer[64] = {0}; + QString hdid; + io_service_t platformExpert = IOServiceGetMatchingService( + kIOMasterPortDefault, IOServiceMatching("IOPlatformExpertDevice")); + if (platformExpert) { + CFTypeRef serialNumberAsCFString = IORegistryEntryCreateCFProperty( + platformExpert, CFSTR(kIOPlatformSerialNumberKey), kCFAllocatorDefault, + 0); + if (serialNumberAsCFString) { + serial = (CFStringRef)serialNumberAsCFString; + } + if (CFStringGetCString(serial, buffer, 64, kCFStringEncodingUTF8)) { + hdid = buffer; + } + + IOObjectRelease(platformExpert); + } + return hdid; } #else |
