Hello to all,

I'm trying to get and set the temperature and the fan RPM from my i2c
microchip (adt7467, from a PowerBook G4).

I tried to do all operations with IORegistry, without touching the i2c
bus, but while read is ok, writing is not (and man page says which
writing is not generally supported, so I don't worry).

Now I'm trying to use directly the I2C bus, and I open the connection
with this function:

CFMutableDictionaryRef dict;

if (dict = IOServiceNameMatching("fan")) {
io_iterator_t iterator = 0;
io_service_t fan;
io_name_t name;
kern_return_t kr;

IOServiceGetMatchingServices(kIOMasterPortDefault, dict, &iterator);

while ((fan = IOIteratorNext(iterator)) != 0) {
if (!strcmp(name,"fan"))

kr = IOI2CInterfaceOpen(fan, 0, &connect);
if (kr == kIOReturnBadArgument)
printf("Bad Argument\n",kr);

I could reach the last if (I get correctly the dictionary, the
services, and I could get the service with name "fan") but when I try
to open it, the result is everytime a kIOReturnBadArgument (connect is
a IOI2CConnectRef).
Man pages of I2CInterfaceOpen refer to IOFBCopyI2CInterfaceForBus, but
I don't know why (and how) use framebuffer when my i2c device is on
the motherboard. I see PPCI2CInterface, but seems it is private to the
kernel, and doesn't expose any public API to user-level.

What I'm doing wrong?
There are others API which I doesn't see?

Any link or reference is appreciated.
Many thanks