New To Mac-Forums?

Welcome to our community! Join the discussion today by registering your FREE account. If you have any problems with the registration process, please contact us!

Get your questions answered by community gurus Advice and insight from world-class Apple enthusiasts Exclusive access to members-only contests, giveaways and deals

Join today!

 
Start a Discussion
 

Mac-Forums Brief

Subscribe to Mac-Forums Brief to receive special offers from Mac-Forums partners and sponsors

Join the conversation RSS
OS X - Development and Darwin Discussion and questions about development for Mac OS X.

i2c communications


Post Reply New Thread Subscribe

 
Thread Tools
danimoth

 
Member Since: Apr 14, 2010
Posts: 1
danimoth is on a distinguished road

danimoth is offline
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) {
IORegistryEntryGetName(fan,name);
if (!strcmp(name,"fan"))
break;
}
IOObjectRelease(iterator);

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
QUOTE Thanks

Post Reply New Thread Subscribe


« C++ and GUI | SendMail configuration »
Thread Tools

Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off
Forum Jump

Similar Threads
Thread
Thread Starter
Forum
Replies
Last Post
Your internet speed hotdog182 Internet, Networking, and Wireless 336 09-17-2010 11:42 PM
Communications port problem windows xp parallels tflorko1617 Running Windows (or anything else) on your Mac 3 09-23-2009 09:22 AM
Anyone have problems with 'HP Communications'? mynameis OS X - Apps and Games 4 04-24-2005 02:37 AM

All times are GMT -4. The time now is 12:29 AM.

Powered by vBulletin
Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
X

Welcome to Mac-Forums.com

Create your username to jump into the discussion!

New members like you have made this community the ultimate source for your Mac since 2003!


(4 digit year)

Already a member?