Driver build does not get updated during Development

Hey,

I'currently working on a Driver (and its App) for iPadOS (USB Device). I think have the right entitlements, as my driver gets installed with the app properly (after accepting it in the settings). It also gets loaded once the device is plugged in and so on.

However the Kernel is not using the updated Version after I install a new Version of App and Driver to the iPad (at least most of the times). I'm verifying this by reading out the Logs via Console and the Driver prints its Build number on Start(). Sometimes it works like it should but I found no pattern.

As far as I understand the iPad should automatically install the new Version of the Driver with the new App if its Build is different from the current one. I'm incrementing the Build of App and Driver automatically post-build so each build the iPad gets has its own Build number (This also works).

Steps to reproduce:

  1. Cleaning Xcode Build Folder
  2. Unplugging the USB Device from the iPad.
  3. Building and Installing a new Version of the Driver and the App via Xcode (making sure the build number has changed)
  4. Plugging the USB back into the iPad
  5. Reading Console output of the iPad

However it works (each time if I:

  1. Uninstall the app from the iPad manually or via Devices in Xcode
  2. Build and install the App via Xcode
  3. Open the Settings App and activate the Driver

But uninstalling the App each time is taking a lot of time and manual Steps so I would like to fix this issue.

Do you have any Ideas?

Thanks, Bjarne

Answered by DTS Engineer in 818320022

First off, please file a bug on this. To a large extent this is a known issue (see below), but documenting that these issue are occurring and the difficulties/annoyances they cause is important for prioritizing future work.

Moving on to the issue itself:

However the Kernel is not using the updated Version after I install a new Version of App and Driver to the iPad (at least most of the times). I'm verifying this by reading out the Logs via Console and the Driver prints its Build number on Start(). Sometimes it works like it should but I found no pattern.

So, there are actually a two different things interacting together that cause this to happen.

  1. As a "general" issue, Xcode's doesn't use the "normal" updates process used everywhere else. It has it's own install logic that only update modified data (keep in mind that Xcode was doing differential update LONG before the App Store was) which is significantly faster than the normal update sequence. However, I have seen cases in the past where that logic meant that the system didn't correctly "notice" that something had changed when it "should" have.

  2. Unlikely virtually every other component on the system, DEXTs cannot/should not be forced to terminate.

Taken together, those two factors make it very easy to create a situation where the system either didn't "notice" your DEXT had been updated (#1) or couldn't unload (#2) with the right timing that it would reload properly. Note that while there's some room for improvement in both cases, #2 can't really be solved.

That leads to:

But uninstalling the App each time is taking a lot of time and manual Steps so I would like to fix this issue.

My major recommendation is that I would build and test your DEXT on the mac, NOT iPadOS, even if you have NO intention of ever shipping on macOS. Many developers even go a step beyond that and actually do most of their KEXT/DEXT development in a VM. In practice, particularly during initial development, there is very little difference between a macOS and iPadOS DEXT and macOS is simply a much better DEXT development environment than iPadOS. As a trivial example, IORegistryExplorer is a critical tool for understanding how driver's interact with each other and that tool simply does not exist on iOS.

__
Kevin Elliott
DTS Engineer, CoreOS/Hardware

First off, please file a bug on this. To a large extent this is a known issue (see below), but documenting that these issue are occurring and the difficulties/annoyances they cause is important for prioritizing future work.

Moving on to the issue itself:

However the Kernel is not using the updated Version after I install a new Version of App and Driver to the iPad (at least most of the times). I'm verifying this by reading out the Logs via Console and the Driver prints its Build number on Start(). Sometimes it works like it should but I found no pattern.

So, there are actually a two different things interacting together that cause this to happen.

  1. As a "general" issue, Xcode's doesn't use the "normal" updates process used everywhere else. It has it's own install logic that only update modified data (keep in mind that Xcode was doing differential update LONG before the App Store was) which is significantly faster than the normal update sequence. However, I have seen cases in the past where that logic meant that the system didn't correctly "notice" that something had changed when it "should" have.

  2. Unlikely virtually every other component on the system, DEXTs cannot/should not be forced to terminate.

Taken together, those two factors make it very easy to create a situation where the system either didn't "notice" your DEXT had been updated (#1) or couldn't unload (#2) with the right timing that it would reload properly. Note that while there's some room for improvement in both cases, #2 can't really be solved.

That leads to:

But uninstalling the App each time is taking a lot of time and manual Steps so I would like to fix this issue.

My major recommendation is that I would build and test your DEXT on the mac, NOT iPadOS, even if you have NO intention of ever shipping on macOS. Many developers even go a step beyond that and actually do most of their KEXT/DEXT development in a VM. In practice, particularly during initial development, there is very little difference between a macOS and iPadOS DEXT and macOS is simply a much better DEXT development environment than iPadOS. As a trivial example, IORegistryExplorer is a critical tool for understanding how driver's interact with each other and that tool simply does not exist on iOS.

__
Kevin Elliott
DTS Engineer, CoreOS/Hardware

Driver build does not get updated during Development
 
 
Q