Skip to content

Commit

Permalink
Detect macOS Ventura and prevent pairing (#457)
Browse files Browse the repository at this point in the history
  • Loading branch information
thp committed Jan 6, 2023
1 parent ecfddd2 commit 1aeeb7f
Showing 1 changed file with 11 additions and 2 deletions.
13 changes: 11 additions & 2 deletions src/platform/psmove_port_osx.mm
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/**
* PS Move API - An interface for the PS Move Motion Controller
* Copyright (c) 2016 Thomas Perl <m@thp.io>
* Copyright (c) 2016, 2023 Thomas Perl <m@thp.io>
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
Expand Down Expand Up @@ -146,7 +146,7 @@
return running;
}

static int
static bool
macosx_blued_is_paired(const std::string &btaddr)
{
FILE *fp = popen("defaults read " OSX_BT_CONFIG_PATH " HIDDevices", "r");
Expand Down Expand Up @@ -197,6 +197,12 @@
return (a.major <= b.major && a.minor < b.minor);
}

bool
operator>=(const MacOSVersionNumber &a, const MacOSVersionNumber &b)
{
return !(a < b);
}

static MacOSVersionNumber
macosx_get_major_minor_version()
{
Expand Down Expand Up @@ -244,6 +250,9 @@
if (!macos_version.valid()) {
OSXPAIR_DEBUG("Cannot detect macOS version.\n");
return false;
} else if (macos_version >= MacOSVersionNumber(13, 0)) {
PSMOVE_WARNING("Pairing not yet supported on macOS Ventura, see https://github.com/thp/psmoveapi/issues/457");
return false;
} else if (macos_version < MacOSVersionNumber(10, 7)) {
OSXPAIR_DEBUG("No need to add entry for macOS before 10.7.\n");
return false;
Expand Down

0 comments on commit 1aeeb7f

Please sign in to comment.