]> sigrok.org Git - libserialport.git/commitdiff
rename deprecated constant kIOMasterPortDefault
authorAndré Fonseca <redacted>
Mon, 28 Aug 2023 13:28:22 +0000 (15:28 +0200)
committerGerhard Sittig <redacted>
Thu, 2 Nov 2023 21:10:36 +0000 (22:10 +0100)
This constant is now deprecated since macOS 12.0 and a new constant
named kIOMainPortDefault is provided. There is a fallback in place
that retains compatibility for older macOS versions.

https://developer.apple.com/documentation/iokit/kiomasterportdefault

[ gsi: tweak style to match existing code base ]

libserialport_internal.h
macosx.c

index ecf8fe95fa51ce4b7993df81d39f873538a5718e..f1d0d8505494c7949af7e60c98589c74309e0a49 100644 (file)
@@ -93,6 +93,9 @@
 #include <IOKit/serial/ioss.h>
 #include <sys/syslimits.h>
 #include <mach/mach_time.h>
+#if MAC_OS_X_VERSION_MAX_ALLOWED < 120000 /* Before macOS 12 */
+#define kIOMainPortDefault kIOMasterPortDefault
+#endif
 #endif
 #ifdef __linux__
 #include <dirent.h>
index a0df84e6b079d4e5ff9fa969a27020631115bbfe..0d22bb6fe10b4fa1877c8c80a87e79f8ddee3550 100644 (file)
--- a/macosx.c
+++ b/macosx.c
@@ -42,7 +42,7 @@ SP_PRIV enum sp_return get_port_details(struct sp_port *port)
        if (!(classes = IOServiceMatching(kIOSerialBSDServiceValue)))
                RETURN_FAIL("IOServiceMatching() failed");
 
-       if (IOServiceGetMatchingServices(kIOMasterPortDefault, classes,
+       if (IOServiceGetMatchingServices(kIOMainPortDefault, classes,
                                         &iter) != KERN_SUCCESS)
                RETURN_FAIL("IOServiceGetMatchingServices() failed");
 
@@ -210,7 +210,7 @@ SP_PRIV enum sp_return list_ports(struct sp_port ***list)
        }
 
        DEBUG("Getting matching services");
-       if (IOServiceGetMatchingServices(kIOMasterPortDefault, classes,
+       if (IOServiceGetMatchingServices(kIOMainPortDefault, classes,
                                         &iter) != KERN_SUCCESS) {
                SET_FAIL(ret, "IOServiceGetMatchingServices() failed");
                goto out_done;