3

我正在尝试从 KEXT 迁移到 DEXT。我的USB设备不应该被经典驱动匹配(在其他情况下,它不允许打开设备和接口)。

我正在使用示例 USB 应用程序进行测试。

因此,在安装系统扩展之前,我能够看到 1 个设备和 3 个接口。但是,当我安装系统扩展(下一步)时,我找不到任何接口。他们似乎迷路了。要搜索接口,我使用命令“ioreg -lirc IOUSBHostInterface”。

知道为什么会发生这种情况吗?

我的驱动程序 Info.plist 文件

<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>

和驱动程序权利文件

<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>

安装扩展后“ioreg -lirc IOUSBHostDevice”命令的结果。如您所见... 0 个接口

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>

      {

        ......

      }
4

1 回答 1

3

我认为问题可能是这样的:

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

这将匹配 USB 设备的根级别。如果你这样做,你的 DEXT 将需要实现 IOKit 通常免费提供的所有基本 USB 描述符。

如果更改IOProviderClassIOUSBHostInterface适合您,请尝试。

于 2020-08-04T13:32:17.807 回答