2023-06-20 11:51:58 +08:00
|
|
|
--- src/hid_osx.c.orig 2023-02-20 16:21:28.000000000 +0800
|
|
|
|
|
+++ src/hid_osx.c 2023-06-20 10:42:18.000000000 +0800
|
|
|
|
|
@@ -12,7 +12,7 @@
|
|
|
|
|
#include <signal.h>
|
|
|
|
|
#include <unistd.h>
|
|
|
|
|
|
|
|
|
|
-#include <Availability.h>
|
|
|
|
|
+#include <AvailabilityMacros.h>
|
|
|
|
|
#include <CoreFoundation/CoreFoundation.h>
|
|
|
|
|
#include <IOKit/IOKitLib.h>
|
|
|
|
|
#include <IOKit/hid/IOHIDKeys.h>
|
|
|
|
|
@@ -169,25 +170,27 @@
|
|
|
|
|
static char *
|
|
|
|
|
get_path(IOHIDDeviceRef dev)
|
|
|
|
|
{
|
|
|
|
|
- io_service_t s;
|
|
|
|
|
- uint64_t id;
|
|
|
|
|
- char *path;
|
|
|
|
|
+ io_service_t s;
|
|
|
|
|
+ io_string_t path;
|
2022-09-05 22:44:52 +07:00
|
|
|
|
2023-06-20 11:51:58 +08:00
|
|
|
+#if MAC_OS_X_VERSION_MIN_REQUIRED > 1050 && !defined(__ppc__)
|
2022-09-05 22:44:52 +07:00
|
|
|
if ((s = IOHIDDeviceGetService(dev)) == MACH_PORT_NULL) {
|
|
|
|
|
fido_log_debug("%s: IOHIDDeviceGetService", __func__);
|
|
|
|
|
return (NULL);
|
|
|
|
|
}
|
|
|
|
|
+#endif
|
|
|
|
|
|
2023-06-20 11:51:58 +08:00
|
|
|
- if (IORegistryEntryGetRegistryEntryID(s, &id) != KERN_SUCCESS) {
|
|
|
|
|
- fido_log_debug("%s: IORegistryEntryGetRegistryEntryID",
|
|
|
|
|
- __func__);
|
|
|
|
|
+ if (IORegistryEntryGetPath(s, kIOServicePlane, path) != KERN_SUCCESS) {
|
|
|
|
|
+ fido_log_debug("%s: IORegistryEntryGetPath", __func__);
|
|
|
|
|
return (NULL);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
+#if MAC_OS_X_VERSION_MIN_REQUIRED > 1050 && !defined(__ppc__)
|
|
|
|
|
if (asprintf(&path, "%s%llu", IOREG, (unsigned long long)id) == -1) {
|
|
|
|
|
fido_log_error(errno, "%s: asprintf", __func__);
|
|
|
|
|
return (NULL);
|
|
|
|
|
}
|
|
|
|
|
+#endif
|
|
|
|
|
|
|
|
|
|
return (path);
|
|
|
|
|
}
|