Skip to content

macOS: kIOMasterPortDefault is deprecated #377

Closed

Description

@szechyjs
hidapi/mac/hid.c:795:39: warning: 'kIOMasterPortDefault' is deprecated: first deprecated in macOS 12.0 [-Wdeprecated-declarations]
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/System/Library/Frameworks/IOKit.framework/Headers/IOKitLib.h:123:19: note: 'kIOMasterPortDefault' has been explicitly marked deprecated here
In file included from ../go/pkg/mod/github.com/bearsh/[email protected]/hid_enabled.go:46:
hidapi/mac/hid.c:800:34: warning: 'kIOMasterPortDefault' is deprecated: first deprecated in macOS 12.0 [-Wdeprecated-declarations]
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/System/Library/Frameworks/IOKit.framework/Headers/IOKitLib.h:123:19: note: 'kIOMasterPortDefault' has been explicitly marked deprecated here

Activity

  1. Youw commented on Feb 7, 2022

    @Youw
    Member

    Has Apple provided an alternative?

  2. szechyjs commented on Feb 8, 2022

    @szechyjs
    Author

    Has Apple provided an alternative?

    It looks like its kIOMainPortDefault

    perhaps something like...

    #if (MAC_OS_X_VERSION_MAX_ALLOWED < 120000) // Before macOS 12 Monterey
      #define kIOMainPortDefault kIOMasterPortDefault
    #endif
  3. added
    macOS
    on Feb 9, 2022
  4. mcuee commented on Feb 9, 2022

    @mcuee
    Member

    Interestingly libusb uses a simple way to do this. I am not saying it is a better way though.
    https://github.com/libusb/libusb/blob/master/libusb/os/darwin_usb.c#L57

    /* Both kIOMasterPortDefault or kIOMainPortDefault are synonyms for 0. */
    static const mach_port_t darwin_default_master_port = 0;
    

    Ref:
    https://developer.apple.com/documentation/iokit/kiomasterportdefault
    https://developer.apple.com/documentation/iokit/kiomainportdefault
    This is a synonym for NULL, if you'd rather use a named constant.

  5. Youw commented on Feb 9, 2022

    @Youw
    Member

    Thanks for the alternative

  6. added a commit that references this issue on May 2, 2022
    a4ae913
  7. added a commit that references this issue on May 2, 2022
    2aeb068
  8. added a commit that references this issue on Oct 24, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    macOS

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions