多配置 USB 设备 - Catalina 中的问题

Multiconfiguration USB Device - Problems in Catalina

具有第二个配置的 USB 设备接口的驱动程序正在获取 KIOServiceTerminated 。配置 1 中类似接口的相同驱动程序正在加载并正常工作。我得到以下正在加载的接口日志,并在这些消息后立即收到终止消息。有什么问题?

default 16:42:40.813546+0530    kernel  IOUSBHostInterface: not registry member at registerService()
default 16:42:40.813560+0530    kernel  IOUSBHostInterface: bad busy count (0,-1)


Backtrace 0xffffff8000a125c6 0xffffff7f812f4731 0xffffff7f812f38a1 0xffffff7f81129388 0xffffff800037b625 0xffffff800037b151 0xffffff80002e013e

default 16:42:40.813561+0530    kernel        Kernel Extensions in backtrace:

default 16:42:40.813570+0530    kernel           com.apple.iokit.IOUSBHostFamily(1.2)[5E8D1616-2C4B-3E81-B199-59D3531E0759]@0xffffff7f8111a000->0xffffff7f81212fff

default 16:42:40.813577+0530    kernel              dependency: com.apple.driver.AppleBusPowerController(1.0)[5F8013C3-D135-3795-8C05-F5DDA387ADC4]@0xffffff7f81100000

default 16:42:40.813584+0530    kernel              dependency: com.apple.driver.usb.AppleUSBCommon(1.0)[98454AB6-B806-330F-98C6-FEA7F44D22BA]@0xffffff7f81108000

default 16:42:40.813590+0530    kernel              dependency: com.apple.driver.AppleUSBHostMergeProperties(1.2)[A7569701-C592-31CF-8740-439114078F9F]@0xffffff7f81116000

default 16:42:40.813597+0530    kernel           com.apple.iokit.IOUSBFamily(900.4.2)[3FCD6CD5-5077-374F-AD7A-6A0EA61E1FC5]@0xffffff7f812a2000->0xffffff7f8133bfff

default 16:42:40.813602+0530    kernel              dependency: com.apple.iokit.IOPCIFamily(2.9)[AA7C7A4F-9F5D-3533-9E78-177C3B6A72BF]@0xffffff7f810a2000

default 16:42:40.813608+0530    kernel              dependency: com.apple.iokit.IOUSBHostFamily(1.2)[5E8D1616-2C4B-3E81-B199-59D3531E0759]@0xffffff7f8111a000

default 16:42:40.813615+0530    kernel              dependency: com.apple.driver.usb.AppleUSBCommon(1.0)[98454AB6-B806-330F-98C6-FEA7F44D22BA]@0xffffff7f81108000

cdc usb 设备信息列表

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
    <key>CFBundleDevelopmentRegion</key>
    <string>English</string>
    <key>CFBundleExecutable</key>
    <string>xxandroid_usbbus</string>
    <key>CFBundleGetInfoString</key>
    <string>5.5, xx Mobile USB CDC driver for MAV</string>
    <key>CFBundleIdentifier</key>
    <string>com.xx.driver.xxAndroidusbbus</string>
    <key>CFBundleInfoDictionaryVersion</key>
    <string>6.0</string>
    <key>CFBundleName</key>
    <string>USB CDC driver</string>
    <key>CFBundlePackageType</key>
    <string>KEXT</string>
    <key>CFBundleShortVersionString</key>
    <string>5.5</string>
    <key>CFBundleSignature</key>
    <string>????</string>
    <key>CFBundleVersion</key>
    <string>5.5</string>
    <key>IOKitPersonalities</key>
    <dict>
        <key>AndroidUSBCDCDevice</key>
        <dict>
            <key>CFBundleIdentifier</key>
            <string>com.xx.driver.xxAndroidusbbus</string>
            <key>IOClass</key>
            <string>xxUSBCDC</string>
            <key>IOProbeScore</key>
            <integer>99999</integer>
            <key>IOProviderClass</key>
            <string>IOUSBDevice</string>
            <key>bDeviceClass</key>
            <integer>0</integer>
            <key>bDeviceProtocol</key>
            <integer>0</integer>
            <key>bDeviceSubClass</key>
            <integer>0</integer>
            <key>idProduct</key>
            <integer>1000</integer>
            <key>idVendor</key>
            <integer>1000</integer>
        </dict>
    </dict>
    <key>OSBundleLibraries</key>
    <dict>
        <key>com.apple.iokit.IOUSBFamily</key>
        <string>650.4.1</string>
        <key>com.apple.kpi.iokit</key>
        <string>13.0.0</string>
        <key>com.apple.kpi.libkern</key>
        <string>13.0.0</string>
        <key>com.apple.kpi.mach</key>
        <string>13.0.0</string>
        <key>com.apple.kpi.unsupported</key>
        <string>13.0.0</string>
    </dict>
</dict>
</plist>

acm cdc控制界面plist信息

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
    <key>CFBundleDevelopmentRegion</key>
    <string>English</string>
    <key>CFBundleExecutable</key>
    <string>xxandroid_mdmcontrol</string>
    <key>CFBundleGetInfoString</key>
    <string>5.5, xx Mobile USB CDC ACM driver Control Interface for MAV</string>
    <key>CFBundleIdentifier</key>
    <string>com.xx.driver.xxAndroidmdmcontrol</string>
    <key>CFBundleInfoDictionaryVersion</key>
    <string>6.0</string>
    <key>CFBundleName</key>
    <string>xxUSBCDCACMControl</string>
    <key>CFBundlePackageType</key>
    <string>KEXT</string>
    <key>CFBundleShortVersionString</key>
    <string>5.5</string>
    <key>CFBundleSignature</key>
    <string>????</string>
    <key>CFBundleVersion</key>
    <string>5.5</string>
    <key>IOKitPersonalities</key>
    <dict>
        <key>AndroidUSBCDCACMControl </key>
        <dict>
            <key>CFBundleIdentifier</key>
            <string>com.xxxdriver.xxAndroidmdmcontrol</string>
            <key>IOClass</key>
            <string>xxUSBCDCACMControl</string>
            <key>IOProviderClass</key>
            <string>IOUSBInterface</string>
            <key>bConfigurationValue</key>
            <integer>2</integer>
            <key>bInterfaceNumber</key>
            <integer>1</integer>
            <key>IOProbeScore</key>
            <integer>99999</integer>
            <key>bInterfaceSubClass</key>
            <integer>2</integer>
            <key>bInterfaceProtocol</key>
            <integer>1</integer>
            <key>idProduct</key>
            <integer>1000</integer>
            <key>idVendor</key>
            <integer>1000</integer>
        </dict>
    </dict>
    <key>OSBundleLibraries</key>
    <dict>
        <key>com.apple.iokit.IOSerialFamily</key>
        <string>10.0.7</string>
        <key>com.apple.iokit.IOUSBFamily</key>
        <string>650.4.1</string>
        <key>com.apple.kpi.iokit</key>
        <string>13.0.0</string>
        <key>com.apple.kpi.libkern</key>
        <string>13.0.0</string>
        <key>com.apple.kpi.mach</key>
        <string>13.0.0</string>
        <key>com.apple.kpi.unsupported</key>
        <string>13.0.0</string>
    </dict>
</dict>
</plist>

acm数据接口plist信息

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
    <key>CFBundleDevelopmentRegion</key>
    <string>English</string>
    <key>CFBundleExecutable</key>
    <string>xxandroid_mdmcontrol</string>
    <key>CFBundleGetInfoString</key>
    <string>5.5, xx Mobile USB CDC ACM driver Control Interface for MAV</string>
    <key>CFBundleIdentifier</key>
    <string>com.xx.driver.xxAndroidmdmcontrol</string>
    <key>CFBundleInfoDictionaryVersion</key>
    <string>6.0</string>
    <key>CFBundleName</key>
    <string>xxUSBCDCACMControl</string>
    <key>CFBundlePackageType</key>
    <string>KEXT</string>
    <key>CFBundleShortVersionString</key>
    <string>5.5</string>
    <key>CFBundleSignature</key>
    <string>????</string>
    <key>CFBundleVersion</key>
    <string>5.5</string>
    <key>IOKitPersonalities</key>
    <dict>
        <key>AndroidUSBCDCACMControl </key>
        <dict>
            <key>CFBundleIdentifier</key>
            <string>com.xxxdriver.xxAndroidmdmcontrol</string>
            <key>IOClass</key>
            <string>xxUSBCDCACMControl</string>
            <key>IOProviderClass</key>
            <string>IOUSBInterface</string>
            <key>bConfigurationValue</key>
            <integer>2</integer>
            <key>bInterfaceNumber</key>
            <integer>1</integer>
            <key>IOProbeScore</key>
            <integer>99999</integer>
            <key>bInterfaceSubClass</key>
            <integer>2</integer>
            <key>bInterfaceProtocol</key>
            <integer>1</integer>
            <key>idProduct</key>
            <integer>1000</integer>
            <key>idVendor</key>
            <integer>1000</integer>
        </dict>
    </dict>
    <key>OSBundleLibraries</key>
    <dict>
        <key>com.apple.iokit.IOSerialFamily</key>
        <string>10.0.7</string>
        <key>com.apple.iokit.IOUSBFamily</key>
        <string>650.4.1</string>
        <key>com.apple.kpi.iokit</key>
        <string>13.0.0</string>
        <key>com.apple.kpi.libkern</key>
        <string>13.0.0</string>
        <key>com.apple.kpi.mach</key>
        <string>13.0.0</string>
        <key>com.apple.kpi.unsupported</key>
        <string>13.0.0</string>
    </dict>
</dict>
</plist>

cdc 串行接口 plist 信息

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
    <key>CFBundleDevelopmentRegion</key>
    <string>English</string>
    <key>CFBundleGetInfoString</key>
    <string>5.5, xx Mobile USB CDC DIAG driver Interface for MAV</string>
    <key>CFBundleExecutable</key>
    <string>xxandroid_serial</string>
    <key>CFBundleIdentifier</key>
    <string>com.xxx.driver.xxAndroidserial</string>
    <key>CFBundleName</key>
    <string>xxUSBCDCSerialData</string>
    <key>CFBundleInfoDictionaryVersion</key>
    <string>6.0</string>
    <key>CFBundlePackageType</key>
    <string>KEXT</string>
    <key>CFBundleShortVersionString</key>
    <string>5.5</string>
    <key>CFBundleSignature</key>
    <string>????</string>
    <key>CFBundleVersion</key>
    <string>5.5</string>
    <key>IOKitPersonalities</key>
    <dict>
        <key>AndroidUSBCDCSerail</key>
        <dict>
            <key>CFBundleIdentifier</key>
            <string>com.xx.driver.xxAndroidserial</string>
            <key>IOClass</key>
            <string>xxUSBCDCSerialData</string>
            <key>IOProviderClass</key>
            <string>IOUSBInterface</string>
            <key>InputBuffers</key>
            <integer>8</integer>
            <key>OutputBuffers</key>
            <integer>32</integer>
            <key>bConfigurationValue</key>
            <integer>2</integer>
            <key>bInterfaceNumber</key>
            <integer>3</integer>
            <key>idProduct</key>
            <integer>1000</integer>
            <key>idVendor</key>
            <integer>1000</integer>
        </dict>
    </dict>
    <key>OSBundleLibraries</key>
    <dict>
        <key>com.apple.iokit.IOSerialFamily</key>
        <string>10.0.7</string>
        <key>com.apple.iokit.IOUSBFamily</key>
        <string>650.4.1</string>
        <key>com.apple.kpi.bsd</key>
        <string>13.0.0</string>
        <key>com.apple.kpi.iokit</key>
        <string>13.0.0</string>
        <key>com.apple.kpi.libkern</key>
        <string>13.0.0</string>
        <key>com.apple.kpi.mach</key>
        <string>13.0.0</string>
        <key>com.apple.kpi.unsupported</key>
        <string>13.0.0</string>
    </dict>
</dict>
</plist>

ioreg -lirc IOUSBHostInterface

-o MTP@0  <class IORegistryEntry:IOService:IOUSBNub:IOUSBInterface, id 0x100002520, registered, matched, active, busy 0 (16 ms), retain 6>
    {
      "USBSpeed" = 3
      "iInterface" = 5
      "IOServiceLegacyMatchingRegistryID" = 4294976802
      "bInterfaceProtocol" = 0
      "bAlternateSetting" = 0
      "idProduct" = 1000
      "bcdDevice" = 1028
      "USB Interface Name" = "MTP"
      "USB Product Name" = “xxx”
      "locationID" = 336592896
      "bInterfaceClass" = 255
      "bInterfaceSubClass" = 255
      "IOCFPlugInTypes" = {"2d9786c6-9ef3-11d4-ad51-000a27052861"="IOUSBHostFamily.kext/Contents/PlugIns/IOUSBLib.bundle"}
      "USBPortType" = 0
      "kUSBString" = "MTP"
      "bInterfaceNumber" = 0
      "bConfigurationValue" = 1
      "USB Vendor Name" = “xxx”
      "idVendor" = 1000
      "IOServiceDEXTEntitlements" = (("com.apple.developer.driverkit.transport.usb"))
      "bNumEndpoints" = 3
      "USB Serial Number" = “xxxxx”
      "IOGeneralInterest" = "IOCommand is not serializable"
      "IOClassNameOverride" = "IOUSBInterface"
    }


+-o ADB Interface@1  <class IORegistryEntry:IOService:IOUSBNub:IOUSBInterface, id 0x100002521, registered, matched, active, busy 0 (16 ms), retain 6>
    {
      "USBSpeed" = 3
      "iInterface" = 6
      "IOServiceLegacyMatchingRegistryID" = 4294976805
      "bInterfaceProtocol" = 1
      "bAlternateSetting" = 0
      "idProduct" = 1000
      "bcdDevice" = 1028
      "USB Interface Name" = "ADB Interface"
      "USB Product Name" = “xxxx”
      "locationID" = 336592896
      "bInterfaceClass" = 255
      "bInterfaceSubClass" = 66
      "IOCFPlugInTypes" = {"2d9786c6-9ef3-11d4-ad51-000a27052861"="IOUSBHostFamily.kext/Contents/PlugIns/IOUSBLib.bundle"}
      "USBPortType" = 0
      "kUSBString" = "ADB Interface"
      "bInterfaceNumber" = 1
      "bConfigurationValue" = 1
      "USB Vendor Name" = “xxx”
      "idVendor" = 1000
      "IOServiceDEXTEntitlements" = (("com.apple.developer.driverkit.transport.usb"))
      "bNumEndpoints" = 2
      "USB Serial Number" = “xxxx”
      "IOGeneralInterest" = "IOCommand is not serializable"
      "IOClassNameOverride" = "IOUSBInterface"
    }

我还不完全明白你现在想做什么(你提供的硬信息很少),所以我最好需要更多信息才能确定 - kext info.plist 、触发错误的 API 个调用等

但是,考虑到您在评论中列出 "IOProviderClass(IOUSBInterface)" 并且 com.apple.iokit.IOUSBFamily 出现在您引用的回溯中,我怀疑您 运行 IOUSBFamily 您似乎在 kext 中使用了旧版兼容层。我在 Mojave 中发现了这一层的各种问题,在 Catalina 中更是如此,其中一些问题与硬件有关(例如,一些问题只发生在某些 Mac 型号上)。

您可以尝试向 Apple 报告错误,但我怀疑您会得到与我将要给您的相同的建议:您应该将您的驱动程序移植到较新的 IOUSBHostFamily API。如果可能,使用 DriverKit 或作为普通用户 space 守护进程,否则作为内核扩展。如果它必须是内核扩展,macOS SDK 中的 IOUSBHost*.h 头文件在每个文件顶部的注释中包含移植说明。