From: André Fonseca Date: Mon, 28 Aug 2023 13:28:22 +0000 (+0200) Subject: rename deprecated constant kIOMasterPortDefault X-Git-Url: https://sigrok.org/gitweb/?a=commitdiff_plain;h=323881f8a48c582df8789240e666cc23ad21bf48;hp=6f9b03e597ea7200eb616a4e410add3dd1690cb1;p=libserialport.git rename deprecated constant kIOMasterPortDefault 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 ] --- diff --git a/libserialport_internal.h b/libserialport_internal.h index ecf8fe9..f1d0d85 100644 --- a/libserialport_internal.h +++ b/libserialport_internal.h @@ -93,6 +93,9 @@ #include #include #include +#if MAC_OS_X_VERSION_MAX_ALLOWED < 120000 /* Before macOS 12 */ +#define kIOMainPortDefault kIOMasterPortDefault +#endif #endif #ifdef __linux__ #include diff --git a/macosx.c b/macosx.c index a0df84e..0d22bb6 100644 --- 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;