Mike Crawford
Mike Crawford

Reputation: 2278

Kernel extension loads but does not run

Neither init, probe nor start are called. I've placed "PE_enter_debugger" at the beginning of each, but the test machine doesn't fall into the debugger.

I can load my kernel extension with kextutil or kextload, and it shows up in kextstat for a little while, but then goes away. I figure some part of the kernel unloaded it.

$ kextstat | grep MY
155    0 0xffffff7f82940000 0x2000     0x2000     com.mydomain.MY2000 (1) 420AB8E0-E204-3992-90D8-A55A488448E4 <133 4 3>

I can use kextunload to unload it. If I use kextunload a second time, it complains that the kernel extension is not found.

Every file and directory in the kext is owned by root with group wheel.

kextutil -tn doesn't find any problem.

I have System Integrity Protection disabled, and debug mode enabled so I can use the two machine debugger. I have two other kernel extensions that call PE_enter_debugger() and they work.

MY2000 is a composite USB device. This is ultimately intended to be a driver for three of MY2000's four interfaces. The fourth interface is a small storage volume that has the Windows driver installer.

In my Info.plist, I've tried three different IOProvider classes: USBHostDevice, USBHostInterface and AppleUSBHostCompositeDevice.

(Apple changed the names of some of its classes in El Capitan I think, previously they were USBDevice and USBInterface.)

<?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>en</string>
    <key>CFBundleExecutable</key>
    <string>$(EXECUTABLE_NAME)</string>
    <key>CFBundleIdentifier</key>
    <string>com.mydomain.MY2000</string>
    <key>CFBundleInfoDictionaryVersion</key>
    <string>6.0</string>
    <key>CFBundleName</key>
    <string>$(PRODUCT_NAME)</string>
    <key>CFBundlePackageType</key>
    <string>KEXT</string>
    <key>CFBundleShortVersionString</key>
    <string>1.0</string>
    <key>CFBundleVersion</key>
    <string>1</string>
    <key>IOKitPersonalities</key>
    <dict>
        <key>MY2000</key>
        <dict>
            <key>IOKitDebug</key>
            <integer>65535</integer>
            <key>IOClass</key>
            <string>com_mydomain_MY2000</string>
            <key>CFBundleIdentifier</key>
            <string>com.mydomain.MY2000</string>
            <key>IOProviderClass</key>
            <string>AppleUSBHostCompositeDevice</string>
            <key>IOMatchCategory</key>
            <string>com_mydomain_MY2000</string>
            <key>idVendor</key>
            <string>0x1234</string>
            <key>idProduct</key>
            <string>0x2000</string>
            <key>bInterfaceClass</key>
            <string>0x10</string>
            <key>bInterfaceSubclass</key>
            <string>0x0</string>
            <key>bInterfaceProtocol</key>
            <string>0x0</string>
        </dict>
    </dict>
    <key>NSHumanReadableCopyright</key>
    <string>Copyright © 2017 My Company. All rights reserved.</string>
    <key>OSBundleLibraries</key>
    <dict>
        <key>com.doequalsglory.driver.IOProxyFramebuffer</key>
        <string>1.0.0d1</string>
        <key>com.apple.kpi.iokit</key>
        <string>16.5</string>
        <key>com.apple.kpi.libkern</key>
        <string>16.5</string>
    </dict>
</dict>
</plist>

Thank you for any help you can give me.

Upvotes: 0

Views: 133

Answers (1)

Mike Crawford
Mike Crawford

Reputation: 2278

The Info.plist has:

        <key>idVendor</key>
        <string>0x1234</string>
        <key>idProduct</key>
        <string>0x2000</string>

"string" should be "integer"

        <key>idVendor</key>
        <integer>1234</integer>
        <key>idProduct</key>
        <integer>29193</integer>

In the property list editor, change the default String Type to Number.

FACEPALM.

I should not drink and code.

Upvotes: 1

Related Questions