How to set `com.apple.developer.driverkit.transport.usb` entitlement?

风格不统一 提交于 2020-07-01 15:49:30

问题


I am unsure about how to set the com.apple.developer.driverkit.transport.usb key in my dext entitlements file. The Info.plist file already contains the IOKitPersonalities dictionary, and reading about the com.apple.developer.driverkit.transport.usb dictionary it looks like it should contains entries with the same information as the entries of IOKitPersonalities.

The entitlements file for a project that is very similar to what is being shown in the WWDC video about driver kit sets this to:

<key>com.apple.developer.driverkit.transport.usb</key>
<true/>

When I set it to <true/>, the system extension starts. I do see some lines like this before I see log lines from the app:

...
2020-05-06 12:23:19.229709+0200 0x51ac2    Default     0x0                  0      0    kernel: DK: IOUserServer(sc.example.MyUserUSBInterfaceDriver-0x100002aad)::exit(CDHash check failed)

Should this entitlement just reflect what is in the IOKitPersonalities dictionary?

With the key completely removed I get:

...
2020-05-06 12:23:19.229709+0200 0x51ac2    Default     0x0                  0      0    kernel: DK: IOUserServer(sc.example.MyUserUSBInterfaceDriver-0x100002aad)::exit(CDHash check failed)
2020-05-06 12:23:19.253517+0200 0x51ac2    Default     0x0                  0      0    kernel: DK: IOUserServer(sc.example.MyUserUSBInterfaceDriver-0x100002aae)::exit(Entitlements check failed)

.. so I guess the key must be there.

I am viewing log lines related to the app with log stream --source | grep MyUserUSBInterfaceDriver


回答1:


My understanding is you need to effectively list your vendor/device ID matching criteria - that is, use one of these 3 patterns:

<key>com.apple.developer.driverkit.transport.usb</key>
<array>
    <dict>
        <key>idProduct</key>
        <integer>123</integer>
        <key>idVendor</key>
        <integer>1234</integer>
    </dict>
    <dict>
        <key>idProduct</key>
        <integer>1024</integer>
        <key>idProductMask</key>
        <integer>65504</integer>
        <key>idVendor</key>
        <integer>1234</integer>
    </dict>
    <dict>
        <key>idProductArray</key>
        <array>
            <integer>12345</integer>
            <integer>23456</integer>
            <integer>34567</integer>
        </array>
        <key>idVendor</key>
        <integer>1234</integer>
    </dict>
</array>

To be clear, that means the entitlement must be of the type array -> dictionaries.

NB: Apple still haven't approved my client's DriverKit entitlements request after ~4 weeks, so I'm still operating with development signing and parts of SIP disabled, but at least with the above, I don't get any complaints about invalid com.apple.developer.driverkit.transport.usb entitlements in the system log (which I very much do with <true/>).

I assume any idVendor values listed must also be embedded in your signing certificate by Apple when it comes to distribution signing.



来源:https://stackoverflow.com/questions/61634176/how-to-set-com-apple-developer-driverkit-transport-usb-entitlement

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!