Skip to content

Commit

Permalink
Don't use deprecated kIOMasterPortDefault (#406)
Browse files Browse the repository at this point in the history
`kIOMasterPortDefault` is deprecated since macOS 12.0.
One alternative is to use named constant `kIOMainPortDefault` which is not available before macOS 12.0.

Both named constants are just an alias for `NULL`, so it is simpler to use it directly instead.

Fixes: #377
  • Loading branch information
Youw authored May 2, 2022
1 parent cd95af8 commit 2aeb068
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions mac/hid.c
Original file line number Diff line number Diff line change
Expand Up @@ -790,12 +790,12 @@ static io_registry_entry_t hid_open_service_registry_from_path(const char *path)
char *endptr;
uint64_t entry_id = strtoull(path + 10, &endptr, 10);
if (*endptr == '\0') {
return IOServiceGetMatchingService(kIOMasterPortDefault, IORegistryEntryIDMatching(entry_id));
return IOServiceGetMatchingService(NULL, IORegistryEntryIDMatching(entry_id));
}
}
else {
/* Fallback to older format of the path */
return IORegistryEntryFromPath(kIOMasterPortDefault, path);
return IORegistryEntryFromPath(NULL, path);
}

return MACH_PORT_NULL;
Expand Down

0 comments on commit 2aeb068

Please sign in to comment.