Migrating from codeless KEXT to DEXT. Usb interfaces disappeared

杀马特。学长 韩版系。学妹 提交于 2020-08-19 10:38:29

问题


I'm trying to migrate from KEXT to DEXT. My USB device should not be matched by the classic driver (in the other case, it does not allow to open the device and interface).

I am using a sample USB application for testing.

So, before installing the system extension, I was able to see 1 device and 3 interfaces. However, when I install the system extension (next), I can not find any interfaces. They seem to be lost. To search for interfaces I use the command “ioreg -lirc IOUSBHostInterface”.

Any idea why this could happen?

my driver Info.plist file

<plist version="1.0">
<dict>
    <key>CFBundleDevelopmentRegion</key>
    <string>$(DEVELOPMENT_LANGUAGE)</string>
    <key>CFBundleExecutable</key>
    <string>$(EXECUTABLE_NAME)</string>
    <key>CFBundleIdentifier</key>
    <string>$(PRODUCT_BUNDLE_IDENTIFIER)</string>
    <key>CFBundleInfoDictionaryVersion</key>
    <string>6.0</string>
    <key>CFBundleName</key>
    <string>$(PRODUCT_NAME)</string>
    <key>CFBundlePackageType</key>
    <string>$(PRODUCT_BUNDLE_PACKAGE_TYPE)</string>
    <key>CFBundleShortVersionString</key>
    <string>1.0</string>
    <key>CFBundleVersion</key>
    <string>1</string>
    <key>IOKitPersonalities</key>
    <dict>
        <key>MyUserUSBInterfaceDriver</key>
        <dict>
            <key>CFBundleIdentifier</key>
            <string>$(PRODUCT_BUNDLE_IDENTIFIER)</string>
            <key>IOClass</key>
            <string>IOService</string>
            <key>IOProviderClass</key>
            <string>IOUSBHostDevice</string>
            <key>IOUserClass</key>
            <string>MyUserUSBInterfaceDriver</string>
            <key>IOUserServerName</key>
            <string>sc.knight.MyUserUSBInterfaceDriver</string>
            <key>idProduct</key>
            <integer>4</integer>
            <key>idVendor</key>
            <integer>10978</integer>
        </dict>
    </dict>
    <key>OSBundleUsageDescription</key>
    <string>Example user space USB driver</string>
</dict>
</plist>

and driver entitlements file

<plist version="1.0">
<dict>
    <key>com.apple.developer.driverkit</key>
    <true/>
    <key>com.apple.developer.driverkit.transport.usb</key>
    <array>
        <dict>
            <key>idVendor</key>
            <integer>10978</integer>
            <key>idProduct</key>
            <integer>4</integer>
        </dict>
    </array>
</dict>
</plist>

Results of the "ioreg -lirc IOUSBHostDevice" command after installing the extension. As you can see... 0 interfaces

admins-MBP:USBApp-updated-master-2 copy admin$ ioreg -lirc IOUSBHostDevice

+-o VXi Point@14300000  <class IORegistryEntry:IOService:IOUSBNub:IOUSBDevice, id 0x100000657, registered, matched, active, busy 0 (210 ms), retain 20>

.......

  | }

  | 

  +-o AppleUSBHostLegacyClient  <class IORegistryEntry:IOService:AppleUSBHostLegacyClient, id 0x10000065a, !registered, !matched, active, busy 0, retain 8>. 
  |   {

  |     "IOPowerManagement" = {"DevicePowerState"=0,"CurrentPowerState"=1,"CapabilityFlags"=65536,"MaxPowerState"=2,"DriverPowerState"=1}

  |   }

  |   

  +-o MyUserUSBInterfaceDriver  <class IORegistryEntry:IOService, id 0x10000065d, !registered, !matched, active, busy 0, retain 7>

      {

        ......

      }

回答1:


I think the problem might be this:

        <key>IOProviderClass</key>
        <string>IOUSBHostDevice</string>

This will match on the root level of the USB device. If you do this, your DEXT would need to implement all the basic USB descriptor stuff that IOKit normally does for free.

Try if changing IOProviderClass to IOUSBHostInterface works for you.



来源:https://stackoverflow.com/questions/62442970/migrating-from-codeless-kext-to-dext-usb-interfaces-disappeared

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