1
votes

I am writing a DriverKit dext and can activate it using System Extension framework. I have the entitlements in place for usb which is com.apple.developer.driverkit is set to true com.apple.developer.driverkit.transport.usb has been added as dictionary but without any sub values ( it is empty) .

I was expecting getting called at dext's Start method after any USB device being plugged in but I am not seeing any calls.

Any idea whether any step / configuration is missing ?

1

1 Answers

2
votes

There are a number of critical pieces of information you haven't shared:

  • Is SIP disabled on your machine or have you got the necessary entitlements enabled in your signing certificate/provisioning profile?
  • Why is your USB DriverKit entitlement empty? Apple will normally issue USB entitlements with a specific vendor ID, or a set of them.
  • Is your dext activation (from the wrapper app) definitely succeeding?
  • Are you getting any crash reports? (See Console.app)
  • What exactly do you mean by "after any USB device being plugged in" (emphasis mine)? What is your dext's IOKit matching dictionary in the Info.plist? What devices do you expect it to match?
  • Is your driver's service object showing up in the I/O Registry? (ioreg or IORegistryExplorer.app)

Those are common causes but to diagnose the problem regardless - have you looked at the system log? Specifically, sysextd and kextd will typically complain in the log when there is something about a dext which makes it not loadable.

Try something like this:

  • Uninstall your dext
  • Reboot
  • /Library/SystemExtensions should not have any remnants of your dext. (in any uuid-named subdirectories) If it does, try running sudo kextcache --invalidate /, wait until that finishes, then reboot again. Zombie dexts cause major problems.
  • Launch log stream --info --predicate 'process == "kextd" || process == "sysextd" || processID == 0' in a Terminal window (you might want to add your app to the predicate if you're logging via NSLog/os_log there too)
  • Launch your app, install the dext
  • Check if the log shows anything relevant
  • Plug in your device
  • Check if the log shows anything relevant

You should be seeing some useful information there. Feel free to update your question with the logs you get if you can't make sense of them.