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

时间:2019-11-19 11:35:44

标签: macos usb macos-catalina iokit kernel-extension

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

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

1 个答案:

答案 0 :(得分:1)

目前我还不太了解您要做什么(您提供的硬信息很少),因此理想情况下,我需要确定一些其他信息-kext info.plist,API调用触发错误等的原因。

但是,考虑到您在注释中列出了“ IOProviderClass(IOUSBInterface)”,并且在引用的回溯中显示了com.apple.iokit.IOUSBFamily,我怀疑您正在遇到维护错误的IOUSBFamily中的错误。您似乎在kext中使用的旧兼容性层。我在Mojave中发现了这一层的各种问题,在Catalina中甚至更多,其中一些问题取决于硬件(例如,某些问题仅在某些Mac型号上出现)。

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