Skip to content
This repository was archived by the owner on Mar 15, 2026. It is now read-only.

Commit c7c6bc0

Browse files
authored
Fix deprecation warnings when building on macOS 12.0 (#26)
Fixes #25
1 parent 4c5740d commit c7c6bc0

File tree

3 files changed

+8
-4
lines changed

3 files changed

+8
-4
lines changed

hidapi/mac/hid.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -690,7 +690,7 @@ hid_device * HID_API_EXPORT hid_open_path(const char *path)
690690
return NULL;
691691

692692
/* Get the IORegistry entry for the given path */
693-
entry = IORegistryEntryFromPath(kIOMasterPortDefault, path);
693+
entry = IORegistryEntryFromPath(kIOMainPortDefault, path);
694694
if (entry == MACH_PORT_NULL) {
695695
/* Path wasn't valid (maybe device was removed?) */
696696
goto return_error;

libusb/libusb/os/darwin_usb.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -250,7 +250,7 @@ static int usb_setup_device_iterator (io_iterator_t *deviceIterator, UInt32 loca
250250
CFRelease (locationCF);
251251
}
252252

253-
return IOServiceGetMatchingServices(kIOMasterPortDefault, matchingDict, deviceIterator);
253+
return IOServiceGetMatchingServices(kIOMainPortDefault, matchingDict, deviceIterator);
254254
}
255255

256256
/* Returns 1 on success, 0 on failure. */
@@ -387,7 +387,7 @@ static void darwin_hotplug_poll (void)
387387
/* since a kernel thread may nodify the IOInterators used for
388388
* hotplug notidication we can't just clear the iterators.
389389
* instead just wait until all IOService providers are quiet */
390-
(void) IOKitWaitQuiet (kIOMasterPortDefault, &timeout);
390+
(void) IOKitWaitQuiet (kIOMainPortDefault, &timeout);
391391
}
392392

393393
static void darwin_clear_iterator (io_iterator_t iter) {
@@ -438,7 +438,7 @@ static void *darwin_event_thread_main (void *arg0) {
438438
CFRunLoopAddSource(runloop, libusb_darwin_acfls, kCFRunLoopDefaultMode);
439439

440440
/* add the notification port to the run loop */
441-
libusb_notification_port = IONotificationPortCreate (kIOMasterPortDefault);
441+
libusb_notification_port = IONotificationPortCreate (kIOMainPortDefault);
442442
libusb_notification_cfsource = IONotificationPortGetRunLoopSource (libusb_notification_port);
443443
CFRunLoopAddSource(runloop, libusb_notification_cfsource, kCFRunLoopDefaultMode);
444444

libusb/libusb/os/darwin_usb.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,10 @@
2929

3030
/* IOUSBInterfaceInferface */
3131

32+
#if (MAC_OS_X_VERSION_MAX_ALLOWED < 120000) // Before macOS 12 Monterey
33+
#define kIOMainPortDefault kIOMasterPortDefault
34+
#endif
35+
3236
/* New in OS 10.12.0. */
3337
#if defined (kIOUSBInterfaceInterfaceID800) && (MAC_OS_X_VERSION_MIN_REQUIRED >= 101200)
3438

0 commit comments

Comments
 (0)