Using Deprecated Kernel-Space IOKit Symbol IOHIDDevice via Kernel.framework-provided Headers

I am using Xcode 15.2 Beta on macOS Sonoma 14.3 Beta with the macOS Sonoma 14.2 SDK. Similarly to post 702244, I am trying to build the same exact repository, partially for my own education. The issue I am running into is that one of the files references IOKit/hid/IOHIDDevice.h, which, in turn, references IOKit/IOReporter.h. Since both of these are searched for, with #include <…>, in a base path of Kernel.framework/Versions/A/Headers, it follows that there should at least be a file somewhere in that folder called IOReporter.h, but there is not. There isn't even a copy in IOKit.framework/Versions/A/Headers, although that folder has another version of hid/IOHIDDevice.h entirely, which does not reference a IOReporter.h file. Is the lack of an IOReporter.h file deliberate, accidental, or is the mere continued existence of a kernel-space IOKit IOHIDDevice.h, containing a deprecated kernel-space IOHIDDevice symbol, an accident; possibly a simple hold-over from a previous version? Is there a way to make this compile? Am I missing anything? Should it be assumed that deprecated kernel-mode APIs will simply not compile?

Replies

I was going to ask you to try reproducing this on released software, but it turns out I was able to do that:

  1. Using Xcode 15.1, create a new project from the macOS > IOKit Driver template.

  2. Add the following to the .cpp file:

    #include <IOKit/IOService.h>
    
  3. Choose Product > Build; it should build fine.

  4. Now add this:

    #include <IOKit/hid/IOHIDDevice.h>
    

It fails with the error …/IOHIDDevice.h:37:10 'IOKit/IOReporter.h' file not found.

This is clearly a bug in the KDK and I recommend that you file it as such. Please post your bug number, just for the record.


You can get this to build by hacking up your own copy of the IOReporter declarations:

  1. At the top of your project, add a file Hack/IOKit/IOReporter.h.

  2. Change the System Header Search Paths build setting to two items: $(SRCROOT)/Hack and $(inherited).

  3. Set the contents of the file to this:

#ifndef IOReporter_h
#define IOReporter_h

#include <IOKit/IOReportTypes.h>

class IOReporter : public OSObject { };
class IOSimpleReporter : public IOReporter { };

#endif /* IOReporter_h */

I can’t promise that this code will actually run, but at least it builds so that you can continue your explorations.

WARNING Do not ship a product based on this hack.

Share and Enjoy

Quinn “The Eskimo!” @ Developer Technical Support @ Apple
let myEmail = "eskimo" + "1" + "@" + "apple.com"

  • Thanks! The number is FB13484559. As for the missing types, it would seem that a lot of APIs that were previously available are either now no longer available, or have been renamed/reworked/refactored so much that I am struggling to piece together working source. I am unsure if this warrants a separate issue post, as the original was about me trying to convert the code anyways; I just ran into this specific issue that I wrote about, and it was the first I could not solve in this dive. That ok?

Add a Comment