mirror of
https://github.com/fastfetch-cli/fastfetch.git
synced 2026-11-09 14:40:10 +01:00
macOS: Add support for old MacOS version (#936)
* Add support for old MacOS version, fix-1. * Add support for old MacOS version, fix-2. * Add support for old MacOS version with fixing metal gpu api. * Update disk_bsd.c * Update disk_bsd.c * Update gpu_apple.m * Update monitor_apple.m * Update os_apple.m * Update wifi_apple.m * Update camera_apple.m * Update camera_apple.m --------- Co-authored-by: Carter Li <CarterLi@users.noreply.github.com>
This commit is contained in:
@@ -7,17 +7,22 @@
|
||||
#include <IOKit/storage/IOBlockStorageDriver.h>
|
||||
#include <IOKit/storage/IOStorageDeviceCharacteristics.h>
|
||||
#include <IOKit/storage/IOStorageProtocolCharacteristics.h>
|
||||
#include <IOKit/storage/nvme/NVMeSMARTLibExternal.h>
|
||||
#ifdef MAC_OS_X_VERSION_10_15
|
||||
#include <IOKit/storage/nvme/NVMeSMARTLibExternal.h>
|
||||
#endif
|
||||
|
||||
#ifdef MAC_OS_X_VERSION_10_15
|
||||
static inline void wrapIoDestroyPlugInInterface(IOCFPlugInInterface*** pluginInf)
|
||||
{
|
||||
assert(pluginInf);
|
||||
if (*pluginInf)
|
||||
IODestroyPlugInInterface(*pluginInf);
|
||||
}
|
||||
#endif
|
||||
|
||||
static const char* detectSsdTemp(io_service_t entryPhysical, double* temp)
|
||||
{
|
||||
#ifdef MAC_OS_X_VERSION_10_15
|
||||
__attribute__((__cleanup__(wrapIoDestroyPlugInInterface))) IOCFPlugInInterface** pluginInf = NULL;
|
||||
int32_t score;
|
||||
if (IOCreatePlugInInterfaceForService(entryPhysical, kIONVMeSMARTUserClientTypeID, kIOCFPlugInInterfaceID, &pluginInf, &score) != kIOReturnSuccess)
|
||||
@@ -36,6 +41,9 @@ static const char* detectSsdTemp(io_service_t entryPhysical, double* temp)
|
||||
|
||||
(*pluginInf)->Release(smartInf);
|
||||
return error;
|
||||
#else
|
||||
return "No support for old MacOS version";
|
||||
#endif
|
||||
}
|
||||
|
||||
const char* ffDetectPhysicalDisk(FFlist* result, FFPhysicalDiskOptions* options)
|
||||
@@ -117,12 +125,14 @@ const char* ffDetectPhysicalDisk(FFlist* result, FFPhysicalDiskOptions* options)
|
||||
}
|
||||
}
|
||||
|
||||
#ifdef MAC_OS_X_VERSION_10_15
|
||||
if (options->temp)
|
||||
{
|
||||
FF_CFTYPE_AUTO_RELEASE CFBooleanRef nvmeSMARTCapable = IORegistryEntryCreateCFProperty(entryPhysical, CFSTR(kIOPropertyNVMeSMARTCapableKey), kCFAllocatorDefault, kNilOptions);
|
||||
if (nvmeSMARTCapable && CFBooleanGetValue(nvmeSMARTCapable))
|
||||
detectSsdTemp(entryPhysical, &device->temperature);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user