It took forever to figure this out (the documentation for this API is spotty at best), So I’m going to bug everyone else with it. Here’s my method for loading an IORegistry entry and inspecting a known property.
const io_string_t path = kIOServicePlane ":/MacRISC2PE/uni-n@f8000000/AppleUniN/i2c@f8001000/PPCI2CInterface/temp-monitor@92/AppleCPUThermo";io_registry_entry_t obj = IORegistryEntryFromPath( kIOMasterPortDefault, path );
CFTypeRef ref = IORegistryEntryCreateCFProperty( obj, CFSTR("temperature"), NULL, 0 );
The first line sets the path to the entry in the registry tree. I’m not exactly sure how it works, but apparently you can concatenate strings with just spaces in between when you are defining them… never knew that. Also, it appears that you don’t have to specify either “Root” or the 1st level entry name (as discovered in a dump of the ioreg command line tool). This particular path should only be considered valid for PowerMac3,6 computers.
The second line tries to locate the entry given the path.
The third line (error checking not shown here) loads a property from the entry.
Anyway, it works on my development computer, returning 256 times the current core temp (celcius) of my computer (since it is an integer representing the temp with some precision).
There are functions that can be used to scan the registry and traverse the entire tree. There is a function that can create a CFDictionary of all the properties in an entry. But if you already know the path, this is by far the fastest way to get a value from the IO registry.
Posted by UncleTravelingRush