Changeset 104503 in vbox
- Timestamp:
- May 3, 2024 12:33:29 PM (9 months ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Devices/USB/darwin/USBProxyDevice-darwin.cpp
r104502 r104503 51 51 #include <iprt/assert.h> 52 52 #include <iprt/critsect.h> 53 #include <iprt/ldr.h> 53 54 #include <iprt/list.h> 54 55 #include <iprt/mem.h> … … 66 67 /** An experiment... */ 67 68 //#define USE_LOW_LATENCY_API 1 68 /** Some older SDKs we build with don't know about this. */69 #define OSX_kIOServiceInteractionAllowed 0x0000000170 69 71 70 … … 75 74 /** Forward declaration of the Darwin interface structure. */ 76 75 typedef struct USBPROXYIFOSX *PUSBPROXYIFOSX; 76 77 78 /** @name IOKitLib declarations and definitions for IOServiceAuthorize() which is not available in all SDKs. 79 * @{ */ 80 /** IOServiceAuthorize in IOKit. */ 81 typedef kern_return_t (* PFNIOSERVICEAUTHORIZE)(io_service_t, uint32_t options); 82 83 #ifndef kIOServiceInteractionAllowed 84 # define kIOServiceInteractionAllowed 0x00000001 85 #endif 86 /** @} */ 77 87 78 88 … … 281 291 * Not worth cleaning up. */ 282 292 static mach_port_t g_MasterPort = MACH_PORT_NULL; 293 /** Pointer to the IOServiceAuthorize() method. */ 294 static PFNIOSERVICEAUTHORIZE g_pfnIOServiceAuthorize = NULL; 283 295 284 296 … … 294 306 RT_NOREF(pvUser1); 295 307 296 int rc; 308 RTLDRMOD hMod = NIL_RTLDRMOD; 309 int rc = RTLdrLoadEx("/System/Library/Frameworks/IOKit.framework/Versions/Current/IOKit", &hMod, RTLDRLOAD_FLAGS_NO_SUFFIX | RTLDRLOAD_FLAGS_NO_UNLOAD, 310 NULL); 311 if (RT_SUCCESS(rc)) 312 { 313 rc = RTLdrGetSymbol(hMod, "IOServiceAuthorize", (void **)&g_pfnIOServiceAuthorize); 314 if (RT_FAILURE(rc)) 315 LogRel(("USB: Failed to resolve IOServiceAuthorize(), capturing USB devices might not work (%Rrc)\n", rc)); 316 RTLdrClose(hMod); 317 } 318 297 319 RT_GCC_NO_WARN_DEPRECATED_BEGIN 298 320 kern_return_t krc = IOMasterPort(MACH_PORT_NULL, &g_MasterPort); /* Deprecated since 12.0. */ … … 1222 1244 * Ask for authorization (which only works with the com.apple.vm.device-access entitlement). 1223 1245 */ 1224 irc = IOServiceAuthorize(USBDevice, OSX_kIOServiceInteractionAllowed); 1225 if (irc != kIOReturnSuccess) 1226 LogRel(("Failed to get device authorization, capturing the device might now work: irc=%#x\n", irc)); 1246 if (g_pfnIOServiceAuthorize) 1247 { 1248 irc = g_pfnIOServiceAuthorize(USBDevice, kIOServiceInteractionAllowed); 1249 if (irc != kIOReturnSuccess) 1250 LogRel(("USB: Failed to get authorization for device '%s', capturing the device might now work: irc=%#x\n", 1251 pszAddress, irc)); 1252 } 1227 1253 1228 1254 /*
Note:
See TracChangeset
for help on using the changeset viewer.