diff options
author | Hans-Christoph Steiner <eighthave@users.sourceforge.net> | 2011-10-10 03:29:30 +0000 |
---|---|---|
committer | Hans-Christoph Steiner <eighthave@users.sourceforge.net> | 2011-10-10 03:29:30 +0000 |
commit | f8d86779612fd82bea792ee665ed41e22c1f734e (patch) | |
tree | 46bd150315c3bf3b8df17d72530ab3cad8be6ebe /smc.c | |
parent | 702b9703734e77e57b206caba6f5355473e25359 (diff) |
updated to use new 10.5 API if available, otherwise use API that was deprecated in 10.5 and removed in 10.6
svn path=/trunk/externals/apple/; revision=15562
Diffstat (limited to 'smc.c')
-rw-r--r-- | smc.c | 36 |
1 files changed, 27 insertions, 9 deletions
@@ -165,15 +165,33 @@ kern_return_t SMCCall(int index, SMCKeyData_t *inputStructure, SMCKeyData_t *out structureInputSize = sizeof(SMCKeyData_t); structureOutputSize = sizeof(SMCKeyData_t); - - return IOConnectMethodStructureIStructureO( - conn, - index, - structureInputSize, - &structureOutputSize, - inputStructure, - outputStructure - ); +#if !defined(__LP64__) + // Check if Mac OS X 10.5 API is available... + if (IOConnectCallStructMethod != NULL) { + // ...and use it if it is. +#endif + return IOConnectCallStructMethod( + conn, // an io_connect_t returned from IOServiceOpen(). + index, // selector of the function to be called via the user client. + inputStructure, // pointer to the input struct parameter. + structureInputSize, // the size of the input structure parameter. + outputStructure, // pointer to the output struct parameter. + &structureOutputSize// pointer to the size of the output structure parameter. + ); +#if !defined(__LP64__) + } + else { + // Otherwise fall back to older API. + return IOConnectMethodStructureIStructureO( + conn, // an io_connect_t returned from IOServiceOpen(). + index, // an index to the function to be called via the user client. + structureInputSize, // the size of the input struct paramter. + &structureOutputSize, // a pointer to the size of the output struct paramter. + inputStructure, // a pointer to the input struct parameter. + outputStructure // a pointer to the output struct parameter. + ); + } +#endif } kern_return_t SMCReadKey(UInt32Char_t key, SMCVal_t *val) |