views:

402

answers:

2

I have been using Unimotion in my application to read motion sensor values for Apple laptops, but have been unable to port the code to 10.6 64-bit. (I have also tried SMSLib and had the no luck either.)

  • Is there any simple 10.6 compatible SMS API?

If there is no alternative, I am also considering patching one of the libraries. Both Unimotion and SMSLib use the following call, which has been deprecated in 10.5 and removed from 10.6 64-bit:

result = IOConnectMethodStructureIStructureO(
    dataPort, kernFunc, structureInputSize,
    &structureOutputSize, &inputStructure, 
    outputStructure);
  • Is there any simple way to replace this with new IOKit calls?

(This post did not really get me much further)

+1  A: 

I haven't used this in 10.6, but does this work?

http://code.google.com/p/google-mac-qtz-patches/

kubi
Sadly it appears to use Unimotion for the SMS support. (http://code.google.com/p/google-mac-qtz-patches/source/browse/trunk/MotionSensor/ReadMe)
Gavin Brock
+3  A: 

If there is no alternative, I am also considering patching one of the libraries. Both Unimotion and SMSLib use the following call, which has been deprecated in 10.5 and removed from 10.6 64-bit:

result = IOConnectMethodStructureIStructureO(
    dataPort, kernFunc, structureInputSize,
    &structureOutputSize, &inputStructure, 
    outputStructure);

Is there any simple way to replace this with new IOKit calls?

That very document suggests replacements. What about this one?

kern_return_t
IOConnectCallStructMethod(
    mach_port_t  connection,        // In
    uint32_t     selector,      // In
    const void  *inputStruct,       // In
    size_t       inputStructCnt,    // In
    void        *outputStruct,      // Out
    size_t      *outputStructCnt)   // In/Out

As far as I can tell, there should be no difference except for the order of the arguments. That said, I've never used I/O Kit, so I could be missing some critical conceptual difference that will make this call not work as the old one did.

Peter Hosey
Yes, I think you may be right. After some further looking, this example (http://developer.apple.com/mac/library/samplecode/SimpleUserClient/listing6.html) seems to show a mapping of IOConnectMethodScalarIStructureO() to IOConnectCallMethod().I'm giving it a try now. Just need to ask a friend with a 64bit CPU to test it for me.
Gavin Brock
Several build failures later (you know you have hard-coded paths to the 10.4u SDK in your project?), I can confirm that it works on my MBP. I wasn't able to link for 64-bit (my MBP runs Leopard), but I was able to compile cleanly and run the 32-bit build product. Cool feature, BTW. ☺
Peter Hosey
And now you have a patch waiting for you. ☺ http://code.google.com/p/websaver/issues/detail?id=3
Peter Hosey
Ok, I updated the code. I'll mark the question here as done, and follow-up through the google-code issue. Thanks!
Gavin Brock