I don’t know why my simple KEXT is not running. Here is the output from kextutil:
$ kextutil -t -n XinputDevice.kext No kernel file specified; using running kernel for linking. Notice: XinputDevice.kext has debug properties set. XinputDevice.kext appears to be loadable (including linkage for on-disk libraries).
Please note that when I download KEXT, it says “downloadable NOT include linkage”, but then it still says that it downloaded it:
$ kextutil -v 4 XinputDevice.kext Kext library architecture set to i386. Kext library recording diagnostics for: validation authentication dependencies warnings. Notice: XinputDevice.kext has debug properties set. XinputDevice.kext appears to be loadable (not including linkage for on-disk libraries). Loading XinputDevice.kext. Reading load info for all kexts. Reading loaded kext info from kernel. Adding /private/tmp/XinputDevice.kext to mkext. /private/tmp/XinputDevice.kext added 29260-byte noncompressed executable to mkext. Created mkext for architecture i386 containing 1 kexts. Loading XinputDevice.kext. (kernel) Received request from user space to load kext ch.digorydoo.driver.XinputDevice. (kernel) Recorded kext ch.digorydoo.driver.XinputDevice as a candidate for inclusion in prelinked kernel. (kernel) Loading kext ch.digorydoo.driver.XinputDevice. (kernel) Allocated link buffer for kext ch.digorydoo.driver.XinputDevice at 0x4d1e6000 (8192 bytes). (kernel) Kext ch.digorydoo.driver.XinputDevice executable loaded; 2 pages at 0x4d1e6000 (load tag 114). (kernel) Kext ch.digorydoo.driver.XinputDevice calling module start function.
In the line above, which I marked with the symbol ####, it says that the start function is called. But this is not so, since my start () calls IOLog, which should write a message to /var/log/system.log, but it is not.
Here is what is displayed in /var/log/kernel.log:
Jan 5 15:20:00 karaboudjan3 kernel[0]: Kext ch.digorydoo.driver.XinputDevice, v1.0 registered and available for loading. Jan 5 15:20:00 karaboudjan3 kernel[0]: Kext ch.digorydoo.driver.XinputDevice resolving dependencies. Jan 5 15:20:00 karaboudjan3 kernel[0]: Kext ch.digorydoo.driver.XinputDevice added dependency com.apple.kpi.mach. Jan 5 15:20:00 karaboudjan3 kernel[0]: Kext ch.digorydoo.driver.XinputDevice added dependency com.apple.kpi.iokit. Jan 5 15:20:00 karaboudjan3 kernel[0]: Kext ch.digorydoo.driver.XinputDevice added dependency com.apple.kpi.libkern. Jan 5 15:20:00 karaboudjan3 kernel[0]: Kext ch.digorydoo.driver.XinputDevice successfully resolved dependencies. Jan 5 15:20:00 karaboudjan3 kernel[0]: Flushing nonloaded kexts and other unused data.
In fact, the class is loading, but the instance is not created:
$ ioclasscount | grep digory ch_digorydoo_driver_XinputDevice = 0 $ kextstat | grep digory 116 0 0x106f000 0x2000 0x1000 ch.digorydoo.driver.XinputDevice (1.0.0) <5 4 3>
The class does not appear in the I / O registry:
$ ioreg | grep Xinput $ ioreg | grep digory
No instance means invoking init or start; therefore, there is no IOLog. If no one uses the class, it is not explicitly displayed in the registry of living objects.
My conclusion is that the textbook must be wrong! A class is never created, although its provider class is IOResources!
I tried replacing IOResources with IOUSBDevice. Since I do not provide idProduct or idVendor, any USB device should fit. If I am mistaken, the daemon, listening to USB devices, must create an instance of the class and call probe () to make sure that this is the correct driver for the device.
Unfortunately, I still did not receive log messages in system.log !! Which daemon is responsible for USB devices? Maybe there is a driver that somehow eats up a recently connected device before my KEXT gets a chance? How can I track which driver selects a daemon?
Any clues?!?