Post

Replies

Boosts

Views

Activity

DriverKit - IOUSBHostDevice::SetProperties
I am trying to add a few properties to an IOUSBHostDevice but the SetProperties is returning kIOReturnUnsupported. The reason I am trying to modify the IOUSBHostDevice's properties is so we can support a MacBook Air SuperDrive when it is attached to our docking station devices. The MacBook Air SuperDrive needs a high powered port to run and this driver will help the OS realize that our dock can support it. I see that the documentation for SetProperties says: The default implementation of this method returns kIOReturnUnsupported. You can override this method and use it to modify the set of properties and values as needed. The changes you make apply only to the current service. Do I need to override IOUSBHostDevice? This is my current Start implementation (you can also see if in the Xcode project): kern_return_t IMPL(MyUserUSBHostDriver, Start) { kern_return_t ret = kIOReturnSuccess; OSDictionary * prop = NULL; OSDictionary * mergeProperties = NULL; bool success = true; os_log(OS_LOG_DEFAULT, "> %s", __FUNCTION__); os_log(OS_LOG_DEFAULT, "%s:%d", __FUNCTION__, __LINE__); ret = Start(provider, SUPERDISPATCH); __Require(kIOReturnSuccess == ret, Exit); os_log(OS_LOG_DEFAULT, "%s:%d", __FUNCTION__, __LINE__); ivars->host = OSDynamicCast(IOUSBHostDevice, provider); __Require_Action(NULL != ivars->host, Exit, ret = kIOReturnNoDevice); os_log(OS_LOG_DEFAULT, "%s:%d", __FUNCTION__, __LINE__); ret = ivars->host->Open(this, 0, 0); __Require(kIOReturnSuccess == ret, Exit); os_log(OS_LOG_DEFAULT, "%s:%d", __FUNCTION__, __LINE__); ret = CopyProperties(&prop); __Require(kIOReturnSuccess == ret, Exit); __Require_Action(NULL != prop, Exit, ret = kIOReturnError); os_log(OS_LOG_DEFAULT, "%s:%d", __FUNCTION__, __LINE__); mergeProperties = OSDynamicCast(OSDictionary, prop->getObject("IOProviderMergeProperties")); mergeProperties->retain(); __Require_Action(NULL != mergeProperties, Exit, ret = kIOReturnError); os_log(OS_LOG_DEFAULT, "%s:%d", __FUNCTION__, __LINE__); OSSafeReleaseNULL(prop); ret = ivars->host->CopyProperties(&prop); __Require(kIOReturnSuccess == ret, Exit); __Require_Action(NULL != prop, Exit, ret = kIOReturnError); os_log(OS_LOG_DEFAULT, "%s:%d", __FUNCTION__, __LINE__); os_log(OS_LOG_DEFAULT, "%s : %s", "USB Product Name", ((OSString *) prop->getObject("USB Product Name"))->getCStringNoCopy()); os_log(OS_LOG_DEFAULT, "%s : %s", "USB Vendor Name", ((OSString *) prop->getObject("USB Vendor Name"))->getCStringNoCopy()); os_log(OS_LOG_DEFAULT, "%s:%d", __FUNCTION__, __LINE__); success = prop->merge(mergeProperties); __Require_Action(success, Exit, ret = kIOReturnError); os_log(OS_LOG_DEFAULT, "%s:%d", __FUNCTION__, __LINE__); ret = ivars->host->SetProperties(prop); // this is no working __Require(kIOReturnSuccess == ret, Exit); Exit: OSSafeReleaseNULL(mergeProperties); OSSafeReleaseNULL(prop); os_log(OS_LOG_DEFAULT, "err ref %d", kIOReturnUnsupported); os_log(OS_LOG_DEFAULT, "< %s %d", __FUNCTION__, ret); return ret; }
2
0
169
1w
DriverKit USB Transport to support multiple devices with different Vendor IDs
I have two different USB devices with different vendor IDs I would like to connect to. I submitted two separate requests for the com.apple.developer.driverkit.transport.usb entitlement for each vendor ID. However I am noticing the provisioning profile only has one of the vendor IDs. How do I submit a request for the USB Transport entitlement to support more than one vendor ID? I'm new to writing a DriverKit driver, so is this even possible?
3
0
239
Oct ’24
How to only make a notification sound without notification banner
When I call the completion handler from the following User Notification Center delegate function and pass UNNotificationPresentationOptions.sound I still get the notification banner: override func userNotificationCenter( _ center: UNUserNotificationCenter, willPresent notification: UNNotification, withCompletionHandler completionHandler: @escaping (UNNotificationPresentationOptions) -> Void ) { completionHandler(.sound) } All I want is a way to just make a notification sound without showing the notification while the app is in the foreground. Any ideas? This is how I am requesting authorization: [[UNUserNotificationCenter currentNotificationCenter] requestAuthorizationWithOptions: (UNAuthorizationOptionBadge | UNAuthorizationOptionSound) completionHandler: ^ (BOOL granted, NSError * _Nullable error) { }]; This is the notification request: var notification = UNMutableNotificationContent() if (notification != nil) { notification.categoryIdentifier = "id" notification.sound = .default notification.title = "title" notification.body = "body" request = UNNotificationRequest( identifier: NSUUID().uuidString, content: notification, trigger: nil ) UNUserNotificationCenter.current().add(request) { (error) in }
2
0
1.8k
Feb ’22
dyld: Library not loaded
I am facing an issue where I am trying to launch my application that includes a third party's dylib. Every time I launch I get the following error on the xcode console: dyld[8660]: Library not loaded: '[thirdparty].dylib' Referenced from: '/Path/To/Bundle.app/Contents/MacOS/Bundle' '/usr/lib/system/introspection/[thirdparty].dylib' (no such file), '[thirdparty].dylib' (no such file), '/usr/local/lib/[thirdparty].dylib' (no such file), '/usr/lib/[thirdparty].dylib' (no such file), '/usr/lib/system/introspection/[thirdparty].dylib' (no such file), '//[thirdparty].dylib' (no such file), '/usr/local/lib/[thirdparty].dylib' (no such file), '/usr/lib/[thirdparty].dylib' (no such file) I can confirm that the [thirdparty].dylib file is in the Bundle.app/Contents/Frameworks/ folder. I tried to see what happens if I put the [thirdparty].dylib file in /usr/local/lib. The dylib can load but I get the following when I launch: dyld[8743]: Library not loaded: '[thirdparty].dylib' Referenced from: '/Path/To/Bundle.app/Contents/MacOS/Bundle' Reason: tried: '/usr/lib/system/introspection/[thirdparty].dylib' (no such file), '[thirdparty].dylib' (no such file), '/usr/local/lib/[thirdparty].dylib' (code signature in <15232DEE-7E9E-3788-9D5D-5C677821DD10> '/usr/local/lib/[thirdparty].dylib' not valid for use in process: library load disallowed by system policy), '/usr/lib/[thirdparty].dylib' (no such file), '/usr/lib/system/introspection/[thirdparty].dylib' (no such file), '//[thirdparty].dylib' (no such file), '/usr/local/lib/[thirdparty].dylib' (code signature in <15232DEE-7E9E-3788-9D5D-5C677821DD10> '/usr/local/lib/[thirdparty].dylib' not valid for use in process: library load disallowed by system policy), '/usr/lib/[thirdparty].dylib' (no such file) Is not valid for use in process: library load disallowed by system policy a clue? Other things I've tried: Ensure that the dylib files were not symbolic links to see if it was a de-referencing issue Manually resigning Made sure the dylib is "Embeded & Signed" under General>Frameworks, Libraries, and Embedded Content Upgrading from Xcode 13.4 to 14.2. Issue still occurs.
1
0
4.4k
Feb ’23
Using Security Scoped Bookmarks on a folder that was recreated
I have a sandbox application that uses bookmarks and are frequently used on external volumes. Let's say I created a Security Scoped Bookmark on a user's external volume "d" and do read/write operations on it from time to time. What should I do when the user recreates volume "d"? I.e. what if the user goes into Disk Utility and does an Erase on the volume, using the same name. Do I need to wait for the user to allow the app to use the volume again or is there a way for me to manually ask for permission? Any best practices for this case scenario?
2
0
1.2k
Nov ’22
Code Signing With Embedded Provisioning Profiles
Hello, If I have an app that utilizes Push Notifications, my application's entitlements will look like the following: <?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> <plist version="1.0"> <dict> <key>com.apple.developer.aps-environment</key> <string>development</string> </dict> </plist> As a result, I see that the app bundle includes a embedded.provisionprofile binary file since Push Notifications requires it. Say I copy the app bundle over to another location on my machine. When I code sign the newly copied app bundle, will I need to do something with the embedded.provisionprofile? Best, Brando
2
0
1.6k
Feb ’22