Can't add custom property into IORegistry on iPadOS 16

We are developing driver for our USB device. Our approach is to run and test driver on macOS first and then verify on iPadOS 16. In the driver we add custom property -"kUSBSerialNumberString" into default properties:

OSDictionary * Driver::devicePropertiesWithSerialNumber() {
    kern_return_t ret;
    OSDictionary *properties = NULL;
    OSDictionary *dictionary = NULL;
    OSObjectPtr value;

    const IOUSBDeviceDescriptor *deviceDescriptor;

    deviceDescriptor = ivars->device->CopyDeviceDescriptor();
    
    ret = CopyProperties(&properties);
    value = copyStringAtIndex(deviceDescriptor->iSerialNumber, kIOUSBLanguageIDEnglishUS);

    Log("Serial number: %{public}s", ((OSString *)value)->getCStringNoCopy());

    
    dictionary = OSDictionary::withDictionary(properties, 0);
    OSSafeReleaseNULL(properties);

    if (value) {
        OSDictionarySetValue(dictionary, "kUSBSerialNumberString", value);
        OSSafeReleaseNULL(value);
    }

    return  dictionary;
}

next in kern_return_t IMPL(Driver, Start) we call SetProperties:

    ret = SetProperties(devicePropertiesWithSerialNumber());
    if(ret != kIOReturnSuccess) {
        Log("Start() - Failed to set properties: 0x%08x.", ret);
        goto Exit;
    }

We can read our property on macOS using:

    func getDeviceProperty(device: io_object_t, key: String) -> AnyObject? {
        IORegistryEntryCreateCFProperty(
            device, key as CFString, kCFAllocatorDefault, .zero
        )?.takeRetainedValue()
    }

        if let serialNumber = getDeviceProperty(device: driver, key: "kUSBSerialNumberString") {
            print("serialNumber: \(serialNumber)")
        }

However getDevicePropertyon iPadOS returns nil. We are wondering is any limitation for IORegistry entries(properties) on iPadOS16? Is any way to add custom property to IORegistry?

BTW, we added debug method to print all the available properties for IORegistry:

    private func debugRegistry(device: io_object_t) {
        var dictionary: Unmanaged<CFMutableDictionary>?

        IORegistryEntryCreateCFProperties(device, &dictionary, kCFAllocatorDefault, .zero)

        if let dictionary = dictionary {
            let values = dictionary.takeUnretainedValue()
            print(values)
        }
    }

It returns just 1 property for iPadOS:

{
    IOClass = IOUserService;
}

and much more for macOS including our custom one:

{
    CFBundleIdentifier = "****";
    CFBundleIdentifierKernel = "com.apple.kpi.iokit";
    IOClass = IOUserService;
    IOMatchCategory = "***";
    IOMatchedPersonality =     {
        CFBundleIdentifier = "****";
        CFBundleIdentifierKernel = "com.apple.kpi.iokit";
        IOClass = IOUserService;
        IOMatchCategory = "****";
        IOPersonalityPublisher = "****";
        IOProviderClass = IOUSBHostInterface;
        IOResourceMatch = IOKit;
        IOUserClass = Driver;
        IOUserServerCDHash = 9cfd03b5c1b90da709ffb1455a053c5d7cdf47ac;
        IOUserServerName = "*****";
        UserClientProperties =         {
            IOClass = IOUserUserClient;
            IOUserClass = DriverUserClient;
        };
        bConfigurationValue = 1;
        bInterfaceNumber = 1;
        bcdDevice = 512;
        idProduct = XXXXX;
        idVendor = XXXXX;
    };
    IOPersonalityPublisher = "*****";
    IOPowerManagement =     {
        CapabilityFlags = 2;
        CurrentPowerState = 2;
        MaxPowerState = 2;
    };
    IOProbeScore = 100000;
    IOProviderClass = IOUSBHostInterface;
    IOResourceMatch = IOKit;
    IOUserClass = Driver;
    IOUserServerCDHash = 9cfd03b5c1b90da709ffb1455a053c5d7cdf47ac;
    IOUserServerName = "*****";
    UserClientProperties =     {
        IOClass = IOUserUserClient;
        IOUserClass = DriverUserClient;
    };
    bConfigurationValue = 1;
    bInterfaceNumber = 1;
    bcdDevice = 512;
    idProduct = XXXXX;
    idVendor = XXXXXX;
    kUSBSerialNumberString = XXXXXXXXXXX;
}

Reported Feedback assistance - FB11570579

Hi @myurik2 , did you ever manage to solve this problem?

Can't add custom property into IORegistry on iPadOS 16
 
 
Q