Finding a Driver

The first step in communicating with a kernel driver from a user space application is to locate the running instances of the driver of interest. On a system such as Mac OS X, hardware devices can be plugged into the machine at any time and there may be several instances of a driver loaded if the user has connected multiple hardware devices that are supported by your driver. To handle these cases, the I/O Kit framework provides functions to not only iterate over all devices and drivers in the I/O Registry that match certain criteria, but also allows a callback function to be installed to watch for the arrival or removal of a driver or a device that matches certain criteria.

To locate a specific driver in the I/O Registry, the ...

Get OS X and iOS Kernel Programming now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.