diff --git a/src/detection/battery/battery_apple.c b/src/detection/battery/battery_apple.c index 52f179780..c0950c0ee 100644 --- a/src/detection/battery/battery_apple.c +++ b/src/detection/battery/battery_apple.c @@ -17,12 +17,8 @@ static double detectBatteryTemp(void) const char* ffDetectBattery(FFBatteryOptions* options, FFlist* results) { - CFMutableDictionaryRef matchDict = IOServiceMatching("AppleSmartBattery"); - if (matchDict == NULL) - return "IOServiceMatching(\"AppleSmartBattery\") failed"; - io_iterator_t iterator; - if(IOServiceGetMatchingServices(MACH_PORT_NULL, matchDict, &iterator) != kIOReturnSuccess) + if(IOServiceGetMatchingServices(MACH_PORT_NULL, IOServiceMatching("AppleSmartBattery"), &iterator) != kIOReturnSuccess) return "IOServiceGetMatchingServices() failed"; io_registry_entry_t registryEntry; diff --git a/src/detection/brightness/brightness_apple.c b/src/detection/brightness/brightness_apple.c index 947115bfb..7a05ce87f 100644 --- a/src/detection/brightness/brightness_apple.c +++ b/src/detection/brightness/brightness_apple.c @@ -57,12 +57,8 @@ static const char* detectWithDdcci(FF_MAYBE_UNUSED const FFDisplayServerResult* if (!IOAVServiceCreate || !IOAVServiceReadI2C) return "IOAVService is not available"; - CFMutableDictionaryRef matchDict = IOServiceMatching("DCPAVServiceProxy"); - if (matchDict == NULL) - return "IOServiceMatching(\"DCPAVServiceProxy\") failed"; - io_iterator_t iterator; - if(IOServiceGetMatchingServices(MACH_PORT_NULL, matchDict, &iterator) != kIOReturnSuccess) + if(IOServiceGetMatchingServices(MACH_PORT_NULL, IOServiceMatching("DCPAVServiceProxy"), &iterator) != kIOReturnSuccess) return "IOServiceGetMatchingServices() failed"; FF_STRBUF_AUTO_DESTROY location = ffStrbufCreate(); diff --git a/src/detection/cpu/cpu_apple.c b/src/detection/cpu/cpu_apple.c index ded5e0d89..418ab2165 100644 --- a/src/detection/cpu/cpu_apple.c +++ b/src/detection/cpu/cpu_apple.c @@ -29,12 +29,8 @@ static const char* detectFrequency(FFCPUResult* cpu) { // https://github.com/giampaolo/psutil/pull/2222/files - CFMutableDictionaryRef matchDict = IOServiceMatching("AppleARMIODevice"); - if (matchDict == NULL) - return "IOServiceMatching(\"AppleARMIODevice\") failed"; - io_iterator_t iterator; - if(IOServiceGetMatchingServices(MACH_PORT_NULL, matchDict, &iterator) != kIOReturnSuccess) + if(IOServiceGetMatchingServices(MACH_PORT_NULL, IOServiceMatching("AppleARMIODevice"), &iterator) != kIOReturnSuccess) return "IOServiceGetMatchingServices() failed"; io_registry_entry_t registryEntry; diff --git a/src/detection/disk/disk_bsd.c b/src/detection/disk/disk_bsd.c index 461b31861..a89f9bd6d 100644 --- a/src/detection/disk/disk_bsd.c +++ b/src/detection/disk/disk_bsd.c @@ -53,9 +53,8 @@ void detectDiskType(FFDisk* disk) // Not thread safe io_iterator_t iterator; char temp = *numEnd; *numEnd = '\0'; // Check for root disk directly - CFMutableDictionaryRef matchDict = IOBSDNameMatching(MACH_PORT_NULL, 0, disk->mountFrom.chars + strlen("/dev/")); *numEnd = temp; - if(IOServiceGetMatchingServices(MACH_PORT_NULL, matchDict, &iterator) == kIOReturnSuccess) + if(IOServiceGetMatchingServices(MACH_PORT_NULL, IOBSDNameMatching(MACH_PORT_NULL, 0, disk->mountFrom.chars + strlen("/dev/")), &iterator) == kIOReturnSuccess) { for (io_registry_entry_t registryEntry = IOIteratorNext(iterator); registryEntry; IORegistryEntryGetParentEntry(registryEntry, kIOServicePlane, ®istryEntry)) { diff --git a/src/detection/gpu/gpu_apple.c b/src/detection/gpu/gpu_apple.c index 6cb786d6a..616a62cc9 100644 --- a/src/detection/gpu/gpu_apple.c +++ b/src/detection/gpu/gpu_apple.c @@ -30,9 +30,8 @@ static double detectGpuTemp(const FFstrbuf* gpuName) const char* ffDetectGPUImpl(const FFGPUOptions* options, FFlist* gpus) { - CFMutableDictionaryRef matchDict = IOServiceMatching(kIOAcceleratorClassName); io_iterator_t iterator; - if(IOServiceGetMatchingServices(MACH_PORT_NULL, matchDict, &iterator) != kIOReturnSuccess) + if(IOServiceGetMatchingServices(MACH_PORT_NULL, IOServiceMatching(kIOAcceleratorClassName), &iterator) != kIOReturnSuccess) return "IOServiceGetMatchingServices() failed"; io_registry_entry_t registryEntry; diff --git a/src/detection/poweradapter/poweradapter_apple.c b/src/detection/poweradapter/poweradapter_apple.c index 06d8a8df6..435532ee4 100644 --- a/src/detection/poweradapter/poweradapter_apple.c +++ b/src/detection/poweradapter/poweradapter_apple.c @@ -6,12 +6,8 @@ const char* ffDetectPowerAdapterImpl(FFlist* results) { - CFMutableDictionaryRef matchDict = IOServiceMatching("AppleSmartBattery"); - if (matchDict == NULL) - return "IOServiceMatching(\"AppleSmartBattery\") failed"; - io_iterator_t iterator; - if(IOServiceGetMatchingServices(MACH_PORT_NULL, matchDict, &iterator) != kIOReturnSuccess) + if(IOServiceGetMatchingServices(MACH_PORT_NULL, IOServiceMatching("AppleSmartBattery"), &iterator) != kIOReturnSuccess) return "IOServiceGetMatchingServices() failed"; io_registry_entry_t registryEntry; diff --git a/src/detection/temps/temps_apple.c b/src/detection/temps/temps_apple.c index 7af1e12fe..7054a3ed3 100644 --- a/src/detection/temps/temps_apple.c +++ b/src/detection/temps/temps_apple.c @@ -140,12 +140,8 @@ static const char *smcReadSmcVal(io_connect_t conn, const UInt32Char_t key, SmcV static const char *smcOpen(io_connect_t *conn) { - CFMutableDictionaryRef matchDict = IOServiceMatching("AppleSMC"); - if (matchDict == NULL) - return "IOServiceMatching(\"AppleSmartBattery\") failed"; - io_iterator_t iterator; - if (IOServiceGetMatchingServices(MACH_PORT_NULL, matchDict, &iterator) != kIOReturnSuccess) + if (IOServiceGetMatchingServices(MACH_PORT_NULL, IOServiceMatching("AppleSMC"), &iterator) != kIOReturnSuccess) return "IOServiceGetMatchingServices() failed"; io_object_t device = IOIteratorNext(iterator);