internal static void IORegistryEntrySetCFProperty(IOKitObject entry, string propertyName, bool property) { var handle = Dlfcn.dlopen(Constants.CoreFoundationLibrary, 0); IntPtr macbool = Dlfcn.GetIntPtr(handle, property ? "kCFBooleanTrue" : "kCFBooleanFalse"); IORegistryEntrySetCFProperty((IntPtr)entry, ((CFString)propertyName).Handle, macbool); }
internal static IOKitObject IOServiceOpen(IOKitObject service) { IntPtr connect; CheckResult(IOServiceOpen(service, mach_task_self(), 0, out connect)); return(connect); }
public IOKitMotionSensor() { var matchingDictionary = IOKit.IOServiceMatching("SMCMotionSensor"); using (var iterator = IOKit.IOServiceGetMatchingServices(IOKit.IOMasterPort(), matchingDictionary)) { using (var service = IOKit.IOIteratorNext(iterator)) { connect = IOKit.IOServiceOpen(service); } } }
public IOKitMotionSensor() { var matchingDictionary = IOKit.IOServiceMatching ("SMCMotionSensor"); using (var iterator = IOKit.IOServiceGetMatchingServices(IOKit.IOMasterPort (), matchingDictionary)) { using (var service = IOKit.IOIteratorNext (iterator)) { connect = IOKit.IOServiceOpen (service); } } }
internal static IOKitObject IOIteratorNext(IOKitObject iterator) { IntPtr service = IOIteratorNext ((IntPtr) iterator); if (service.ToInt32() == IOKit.kIOReturnNoDevice) { throw new IOKitException (IOKit.kIOReturnNoDevice); } return service; }
internal static IOKitObject IOIteratorNext(IOKitObject iterator) { IntPtr service = IOIteratorNext((IntPtr)iterator); if (service.ToInt32() == IOKit.kIOReturnNoDevice) { throw new IOKitException(IOKit.kIOReturnNoDevice); } return(service); }
internal static sbyte[] IOConnectCallStructMethod(IOKitObject connect) { uint osize = 40, isize = 40; sbyte[] @out = new sbyte[osize]; if (IOConnectCallStructMethodIn == null) { IOConnectCallStructMethodIn = new sbyte[isize]; for (int i = 0; i<isize; i++) { IOConnectCallStructMethodIn [i] = 1; } } IOKit.CheckResult (IOKit.IOConnectCallStructMethod ( connect, 5, IOConnectCallStructMethodIn, osize, @out, ref isize )); return @out; }
internal static sbyte[] IOConnectCallStructMethod(IOKitObject connect) { uint osize = 40, isize = 40; sbyte[] @out = new sbyte[osize]; if (IOConnectCallStructMethodIn == null) { IOConnectCallStructMethodIn = new sbyte[isize]; for (int i = 0; i < isize; i++) { IOConnectCallStructMethodIn [i] = 1; } } IOKit.CheckResult(IOKit.IOConnectCallStructMethod( connect, 5, IOConnectCallStructMethodIn, osize, @out, ref isize )); return(@out); }
internal static IOKitObject IOServiceOpen(IOKitObject service) { IntPtr connect; CheckResult (IOServiceOpen (service, mach_task_self (), 0, out connect)); return connect; }
internal static void IORegistryEntrySetCFProperty(IOKitObject entry, string propertyName, bool property) { var handle = Dlfcn.dlopen (Constants.CoreFoundationLibrary, 0); IntPtr macbool = Dlfcn.GetIntPtr (handle, property ? "kCFBooleanTrue" : "kCFBooleanFalse"); IORegistryEntrySetCFProperty((IntPtr)entry, ((CFString)propertyName).Handle, macbool); }