本文整理匯總了C++中OSBoolean::isTrue方法的典型用法代碼示例。如果您正苦於以下問題:C++ OSBoolean::isTrue方法的具體用法?C++ OSBoolean::isTrue怎麽用?C++ OSBoolean::isTrue使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類OSBoolean
的用法示例。
在下文中一共展示了OSBoolean::isTrue方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C++代碼示例。
示例1: init
bool iTCOWatchdog::init (OSDictionary* dict)
{
OSNumber *nkey;
OSBoolean *bkey;
bool res;
//DbgPrint(drvid, "init\n");
res = super::init(dict);
Timeout = DEFAULT_TIMEOUT;
SelfFeeding = false;
WorkaroundBug = false;
if ((conf = OSDynamicCast(OSDictionary, getProperty("Settings"))) &&
(nkey = OSDynamicCast(OSNumber, conf->getObject("Timeout"))))
Timeout = nkey->unsigned32BitValue();
if (conf && (bkey = OSDynamicCast(OSBoolean, conf->getObject("SelfFeeding"))))
SelfFeeding = bkey->isTrue();
if (conf && (bkey = OSDynamicCast(OSBoolean, conf->getObject("UnsafeWorkaroundBIOSBug"))))
WorkaroundBug = bkey->isTrue();
first_run = true;
is_active = SMIWereEnabled = false;
GCSMem.range = NULL; GCSMem.map = NULL;
lock = IOSimpleLockAlloc();
return res;
}
示例2: queryACPICurentBrightnessLevel
UInt32 ACPIBacklightPanel::queryACPICurentBrightnessLevel()
{
//DbgLog("%s::%s()\n", this->getName(),__FUNCTION__);
if (_backlightHandler)
return _backlightHandler->getBacklightLevel();
UInt32 level = minAC;
const char* method = _extended ? "XBQC" : "_BQC";
if (kIOReturnSuccess == backLightDevice->evaluateInteger(method, &level))
{
//DbgLog("%s: queryACPICurentBrightnessLevel %s = %d\n", this->getName(), method, level);
OSBoolean * useIdx = OSDynamicCast(OSBoolean, getProperty("BQC use index"));
if (useIdx && useIdx->isTrue())
{
OSArray * levels = queryACPISupportedBrightnessLevels();
if (levels)
{
OSNumber *num = OSDynamicCast(OSNumber, levels->getObject(level));
if (num)
level = num->unsigned32BitValue();
levels->release();
}
}
//DbgLog("%s: queryACPICurentBrightnessLevel returning %d\n", this->getName(), level);
}
else {
IOLog("ACPIBacklight: Error in queryACPICurentBrightnessLevel %s\n", method);
}
//some laptops didn't return anything on startup, return then max value (first entry in _BCL):
return level;
}
示例3: start
bool TZSensors::start(IOService * provider)
{
if (!super::start(provider))
return false;
acpiDevice = (IOACPIPlatformDevice *)provider;
if (!acpiDevice) {
HWSensorsFatalLog("ACPI device not ready");
return false;
}
if (OSDictionary *configuration = getConfigurationNode()) {
OSBoolean* disable = OSDynamicCast(OSBoolean, configuration->getObject("DisableDevice"));
if (disable && disable->isTrue())
return false;
}
// On some computers (eg. RehabMan's ProBook 4530s), the system will hang on startup
// if kernel cache is used, because of the early call to updateTemperatures and/or
// updateTachometers. At least that is the case with an SSD and a valid pre-linked
// kernel, along with kernel cache enabled. This 1000ms sleep seems to fix the problem,
// enabling a clean boot with TZSensors enabled.
//
// On the ProBook this is the case with both TZSensors and PTIDSensors, although
// PTIDSensors can be avoided by using DropSSDT=Yes (because PTID device is in an SSDT)
//
// And in the case of TZSensors it even happens (intermittently) without kernel cache.
IOSleep(1000);
OSObject *object = NULL;
if(kIOReturnSuccess == acpiDevice->evaluateObject("_TMP", &object) && object) {
for (UInt8 i = 0; i < 0xf; i++) {
char key[5];
snprintf(key, 5, KEY_FORMAT_THERMALZONE_TEMPERATURE, i);
if (!isKeyHandled(key)) {
if (addSensor(key, TYPE_SP78, TYPE_SPXX_SIZE, kFakeSMCTemperatureSensor, 0)) {
break;
}
}
}
}
registerService();
HWSensorsInfoLog("started on %s", acpiDevice->getName());
return true;
}
示例4: OSDynamicCast
IOService *AppleUSBCDC::probe(IOService *provider, SInt32 *score)
{
IOUSBDevice *newDevice = NULL;
UInt8 classValue = 0;
OSNumber *classInfo = NULL;
SInt32 newScore = 0;
IOService *res;
XTRACE(this, 0, *score, "probe");
OSBoolean *boolObj = OSDynamicCast(OSBoolean, provider->getProperty("kCDCDoNotMatchThisDevice"));
if (boolObj && boolObj->isTrue())
{
XTRACE(this, 0, *score, "probe - provider doesn't want us to match");
return NULL;
}
// Check the device class, we need to handle Miscellaneous or Composite class a little different
classInfo = (OSNumber *)provider->getProperty("bDeviceClass");
if (classInfo)
{
classValue = classInfo->unsigned32BitValue();
if ((classValue == kUSBCompositeClass) || (classValue == kUSBMiscellaneousClass))
{
newDevice = OSDynamicCast(IOUSBDevice, provider);
if(!newDevice)
{
XTRACE(this, 0, 0, "probe - provider invalid");
} else {
// Check if it has CDC interfaces
if (checkDevice(newDevice))
{
newScore = 1; // We need to see the device before the Composite driver does
} else {
XTRACE(this, 0, 0, "probe - Composite or Micsellaneous class but not CDC");
return NULL; // We're not interested
}
}
}
}
*score += newScore;
res = super::probe(provider, score);
XTRACE(this, 0, *score, "probe - Exit");
return res;
}/* end probe */
示例5: OSDynamicCast
ApplePS2CypressTouchPad* ApplePS2CypressTouchPad::probe( IOService * provider, SInt32 * score )
{
DEBUG_LOG("ApplePS2CypressTouchPad::probe entered...\n");
//
// The driver has been instructed to verify the presence of the actual
// hardware we represent. We are guaranteed by the controller that the
// mouse clock is enabled and the mouse itself is disabled (thus it
// won't send any asynchronous mouse data that may mess up the
// responses expected by the commands we send it).
//
bool success = false;
if (!super::probe(provider, score))
return 0;
OSDictionary* list = OSDynamicCast(OSDictionary, getProperty(kPlatformProfile));
ApplePS2Device* d = (ApplePS2Device*)provider;
OSDictionary* config = d->getController()->makeConfigurationNode(list, "Cypress Touchpad"); //ApplePS2Controller::makeConfigurationNode(list);
if (config)
{
// if DisableDevice is Yes, then do not load at all...
OSBoolean* disable = OSDynamicCast(OSBoolean, config->getObject(kDisableDevice));
if (disable && disable->isTrue())
{
config->release();
return false;
}
#ifdef DEBUG
// save configuration for later/diagnostics...
setProperty(kMergedConfiguration, config);
#endif
}
_device = (ApplePS2MouseDevice *) d;
cypressReset();
success = cypressReadFwVersion();
if (success &&_touchPadVersion > 11)
{
_tapFrameMax = 11;
_lockFrameMin = 80; // sync packet rate is superior on > 11 firmware ... should be good ... (not tested) ...
}
_device = 0;
DEBUG_LOG("CYPRESS: ApplePS2CypressTouchPad::probe leaving.\n");
return (success) ? this : 0;
}
示例6: setParamProperties
IOReturn ApplePS2Mouse::setParamProperties( OSDictionary * config )
{
if (NULL == config)
return 0;
const struct {const char *name; int *var;} int32vars[]={
{"DefaultResolution", &defres},
{"ResolutionMode", &resmode},
{"ScrollResolution", &scrollres},
{"MouseYInverter", &mouseyinverter},
{"WakeDelay", &wakedelay},
};
const struct {const char *name; int *var;} boolvars[]={
{"ForceDefaultResolution", &forceres},
{"ForceSetResolution", &forcesetres},
{"ActLikeTrackpad", &actliketrackpad},
{"DisableLEDUpdating", &noled},
};
const struct {const char* name; bool* var;} lowbitvars[]={
{"TrackpadScroll", &scroll},
{"OutsidezoneNoAction When Typing", &outzone_wt},
{"PalmNoAction Permanent", &palm},
{"PalmNoAction When Typing", &palm_wt},
};
OSNumber *num;
OSBoolean *bl;
// boolean config items
for (int i = 0; i < countof(boolvars); i++)
if ((bl=OSDynamicCast (OSBoolean,config->getObject (boolvars[i].name))))
*boolvars[i].var = bl->isTrue();
// lowbit config items
for (int i = 0; i < countof(lowbitvars); i++)
if ((num=OSDynamicCast (OSNumber,config->getObject(lowbitvars[i].name))))
*lowbitvars[i].var = (num->unsigned32BitValue()&0x1)?true:false;
// 32-bit config items
for (int i = 0; i < countof(int32vars);i++)
if ((num=OSDynamicCast (OSNumber,config->getObject (int32vars[i].name))))
*int32vars[i].var = num->unsigned32BitValue();
// convert to IOFixed format...
defres <<= 16;
return super::setParamProperties(config);
}
示例7: OSDynamicCast
bool ApplePS2SentelicFSP::init(OSDictionary* dict)
{
//
// Initialize this object's minimal state. This is invoked right after this
// object is instantiated.
//
if (!super::init(dict))
return false;
// find config specific to Platform Profile
OSDictionary* list = OSDynamicCast(OSDictionary, dict->getObject(kPlatformProfile));
OSDictionary* config = ApplePS2Controller::makeConfigurationNode(list);
if (config)
{
// if DisableDevice is Yes, then do not load at all...
OSBoolean* disable = OSDynamicCast(OSBoolean, config->getObject(kDisableDevice));
if (disable && disable->isTrue())
{
config->release();
return false;
}
#ifdef DEBUG
// save configuration for later/diagnostics...
setProperty(kMergedConfiguration, config);
#endif
}
// initialize state
_device = 0;
_interruptHandlerInstalled = false;
_packetByteCount = 0;
_resolution = (100) << 16; // (100 dpi, 4 counts/mm)
_touchPadModeByte = kModeByteValueGesturesDisabled;
OSSafeRelease(config);
return true;
}
示例8: start
bool ACPIProbe::start(IOService * provider)
{
ACPISensorsDebugLog("starting...");
if (!super::start(provider))
return false;
if (!(acpiDevice = OSDynamicCast(IOACPIPlatformDevice, provider))) {
ACPISensorsFatalLog("ACPI device not ready");
return false;
}
methods = OSArray::withCapacity(0);
OSNumber *interval = NULL;
OSNumber *timeout = NULL;
OSBoolean *logging = NULL;
OSArray *list = NULL;
// Try to load configuration from info.plist first
if (OSDictionary *configuration = getConfigurationNode())
{
OSBoolean* disable = OSDynamicCast(OSBoolean, configuration->getObject("DisableDevice"));
if (disable && disable->isTrue())
return false;
interval = OSDynamicCast(OSNumber, configuration->getObject("PollingInterval"));
timeout = OSDynamicCast(OSNumber, configuration->getObject("PollingTimeout"));
logging = OSDynamicCast(OSBoolean, configuration->getObject("LoggingEnabled"));
list = OSDynamicCast(OSArray, configuration->getObject("Methods"));
}
// Try to load configuration provided by ACPI device
else {
OSObject *object = NULL;
if (kIOReturnSuccess == acpiDevice->evaluateObject("INVL", &object) && object)
interval = OSDynamicCast(OSNumber, object);
if (kIOReturnSuccess == acpiDevice->evaluateObject("TOUT", &object) && object)
timeout = OSDynamicCast(OSNumber, object);
if (kIOReturnSuccess == acpiDevice->evaluateObject("LOGG", &object) && object) {
if (OSNumber *number = OSDynamicCast(OSNumber, object)) {
logging = OSBoolean::withBoolean(number->unsigned8BitValue() == 1);
}
}
if (kIOReturnSuccess == acpiDevice->evaluateObject("LIST", &object) && object)
list = OSDynamicCast(OSArray, object);
else
ACPISensorsErrorLog("polling methods table (LIST) not found");
}
if (interval) {
pollingInterval = (double)interval->unsigned64BitValue() / (double)1000.0;
ACPISensorsInfoLog("polling interval %lld ms", interval->unsigned64BitValue());
if (pollingInterval) {
if (timeout) {
pollingTimeout = (double)timeout->unsigned64BitValue() / 1000.0;
ACPISensorsInfoLog("polling timeout %lld ms", timeout->unsigned64BitValue());
}
if (logging) {
loggingEnabled = logging->isTrue();
ACPISensorsInfoLog("logging %s", loggingEnabled ? "enabled" : "disabled");
}
if (list) {
for (unsigned int i = 0; i < list->getCount(); i++) {
if (OSString *method = OSDynamicCast(OSString, list->getObject(i))) {
if (method->getLength() && kIOReturnSuccess == acpiDevice->validateObject(method->getCStringNoCopy())) {
methods->setObject(method);
ACPISensorsInfoLog("method \"%s\" registered", method->getCStringNoCopy());
}
else ACPISensorsErrorLog("unable to register method \"%s\"", method->getCStringNoCopy());
}
}
}
}
else ACPISensorsWarningLog("polling interval is set to zero, driver will be disabled");
}
//REVIEW_REHABMAN: just bail if no methods to call... no need to stick around...
if (!methods->getCount())
return false;
if (methods->getCount()) {
// woorkloop
if (!(workloop = getWorkLoop())) {
HWSensorsFatalLog("Failed to obtain workloop");
return false;
}
if (!(timerEventSource = IOTimerEventSource::timerEventSource( this, OSMemberFunctionCast(IOTimerEventSource::Action, this, &ACPIProbe::woorkloopTimerEvent)))) {
ACPISensorsFatalLog("failed to initialize timer event source");
return false;
}
//.........這裏部分代碼省略.........
示例9: USBLog
IOReturn
com_evoluent_driver_VerticalMouse::StartFinalProcessing()
{
OSNumber *curResPtr, *resPrefPtr;
UInt32 curResInt, resPrefInt;
IOFixed curRes, resPref;
IOReturn err = kIOReturnSuccess;
OSBoolean * boolObj;
OSObject * propertyObj = NULL;
USBLog(3, "com_evoluent_driver_VerticalMouse[%p]::StartFinalProcessing", this);
_switchBackOnRestart = FALSE;
propertyObj = copyProperty("SwitchTo800DPI");
boolObj = OSDynamicCast( OSBoolean, propertyObj );
if ( boolObj && boolObj->isTrue() )
{
// USBLog(3, "com_evoluent_driver_VerticalMouse[%p]::StartFinalProcessing - found switchTo800DPI resolution property", this);
_switchTo800dpiFlag = true;
}
if (propertyObj)
propertyObj->release();
propertyObj = copyProperty("SwitchTo2000FPS");
boolObj = OSDynamicCast( OSBoolean, propertyObj );
if ( boolObj && boolObj->isTrue() )
{
// USBLog(3, "com_evoluent_driver_VerticalMouse[%p]::StartFinalProcessing - found switchTo2000fps resolution property", this);
_switchTo2000fpsFlag = true;
}
if (propertyObj)
propertyObj->release();
if ( _switchTo2000fpsFlag )
{
IOUSBDevRequest devReq;
// Write the 2000 FPS value to the mouse
//
devReq.bmRequestType = 0x40;
devReq.bRequest = 0x01;
devReq.wValue = 0x05AC;
devReq.wIndex = 0xd810;
devReq.wLength = 0x0000;
devReq.pData = NULL;
err = _device->DeviceRequest(&devReq, 5000, 0);
if (err)
{
USBLog(3, "com_evoluent_driver_VerticalMouse[%p]::StartFinalProcessing - sending 1st part of FPS change received error 0x%x", this, err);
}
else
{
devReq.bmRequestType = 0x40;
devReq.bRequest = 0x01;
devReq.wValue = 0x05AC;
devReq.wIndex = 0xdc11;
devReq.wLength = 0x0000;
devReq.pData = NULL;
err = _device->DeviceRequest(&devReq, 5000, 0);
if (err)
{
USBLog(3, "com_evoluent_driver_VerticalMouse[%p]::StartFinalProcessing - sending 2nd part of FPS change received error 0x%x", this, err);
}
}
#if FORMOUSETESTING
UInt8 hi,lo;
UInt16 fps;
// Read back the value:
//
devReq.bmRequestType = 0xc0;
devReq.bRequest = 0x01;
devReq.wValue = 0x05AC;
devReq.wIndex = 0x0011;
devReq.wLength = 1;
devReq.pData = &hi;
err = _device->DeviceRequest(&devReq, 5000, 0);
if (err)
USBLog(3, "com_evoluent_driver_VerticalMouse[%p]::StartFinalProcessing - error reading hi byte: 0x%x", this, err);
devReq.bmRequestType = 0xc0;
devReq.bRequest = 0x01;
devReq.wValue = 0x05AC;
devReq.wIndex = 0x0010;
devReq.wLength = 1;
devReq.pData = &lo;
err = _device->DeviceRequest(&devReq, 5000, 0);
if (err)
USBLog(3, "com_evoluent_driver_VerticalMouse[%p]::StartFinalProcessing - read reading lo byte: 0x%x", this, err);
fps = hi;
fps = (fps << 8) | lo;
USBLog(3, "com_evoluent_driver_VerticalMouse[%p]::StartFinalProcessing - read : 0x%x", this, fps );
//.........這裏部分代碼省略.........
示例10: if
//.........這裏部分代碼省略.........
else if (name->isEqualTo("Ambient")) {
if (!addSensor(KEY_AMBIENT_TEMPERATURE, TYPE_SP78, 2, kSuperIOTemperatureSensor,i)) {
WarningLog("error adding Ambient temperature sensor");
}
}
}
}
}
}
else {
if(readTemperature(0)<MAX_TEMP_THRESHOLD) // Need to check if temperature sensor valid
if (!addSensor(KEY_CPU_HEATSINK_TEMPERATURE, TYPE_SP78, 2, kSuperIOTemperatureSensor, 0)) {
WarningLog("error adding heatsink temperature sensor");
}
if(readTemperature(1)<MAX_TEMP_THRESHOLD) // Need to check if temperature sensor valid
if (!addSensor(KEY_AMBIENT_TEMPERATURE, TYPE_SP78, 2, kSuperIOTemperatureSensor, 1)) {
WarningLog("error adding Ambient temperature sensor");
}
if(readTemperature(2)<MAX_TEMP_THRESHOLD) // Need to check if temperature sensor valid
if (!addSensor(KEY_NORTHBRIDGE_TEMPERATURE, TYPE_SP78, 2, kSuperIOTemperatureSensor, 2)) {
WarningLog("error adding system temperature sensor");
}
}
// Voltage
UInt8 tmp = readByte(address, ITE_ADC_CHANNEL_ENABLE);
DebugLog("ADC Enable register = %X",tmp);
vbat_updates = false;
if(configuration)
{
OSBoolean* smartGuard = OSDynamicCast(OSBoolean, configuration->getObject("VBATNeedUpdates"));
if(smartGuard && smartGuard->isTrue())
vbat_updates=true;
}
// Refresh VBAT reading on each access to the key
if(vbat_updates)
writeByte(address, ITE_CONFIGURATION_REGISTER, readByte(address, ITE_CONFIGURATION_REGISTER) | 0x40);
if (configuration) {
for (int i = 0; i < 9; i++) {
char key[5];
OSString * name;
long Ri=0;
long Rf=1;
long Vf=0;
snprintf(key, 5, "VIN%X", i);
if (process_sensor_entry(configuration->getObject(key), &name, &Ri, &Rf, &Vf)) {
if (name->isEqualTo("CPU")) {
if (!addSensor(KEY_CPU_VRM_SUPPLY0, TYPE_FP2E, 2, kSuperIOVoltageSensor, i,Ri,Rf,Vf))
WarningLog("error adding CPU voltage sensor");
}
else if (name->isEqualTo("Memory")) {
if (!addSensor(KEY_MEMORY_VOLTAGE, TYPE_FP2E, 2, kSuperIOVoltageSensor, i,Ri,Rf,Vf))
WarningLog("error adding memory voltage sensor");
}
else if (name->isEqualTo("+5VC")) {
if (!addSensor(KEY_5VC_VOLTAGE, TYPE_SP4B, 2, kSuperIOVoltageSensor, i,Ri,Rf,Vf)) {
WarningLog("ERROR Adding AVCC Voltage Sensor!");
}
}
else if (name->isEqualTo("+5VSB")) {
if (!addSensor(KEY_5VSB_VOLTAGE, TYPE_SP4B, 2, kSuperIOVoltageSensor, i,Ri,Rf,Vf)) {
示例11: start
bool ACPISensors::start(IOService * provider)
{
ACPISensorsDebugLog("starting...");
if (!super::start(provider))
return false;
if (!(acpiDevice = OSDynamicCast(IOACPIPlatformDevice, provider))) {
ACPISensorsFatalLog("ACPI device not ready");
return false;
}
methods = OSArray::withCapacity(0);
// Try to load configuration provided by ACPI device
OSObject *object = NULL;
// Use Kelvins?
if (kIOReturnSuccess == acpiDevice->evaluateObject("KLVN", &object) && object) {
if (OSNumber *kelvins = OSDynamicCast(OSNumber, object)) {
useKelvins = kelvins->unsigned8BitValue() == 1;
}
OSSafeReleaseNULL(object);
}
// Allow the device to be completely disabled depending on Platform
OSDictionary *configuration = getConfigurationNode();
if (configuration)
{
OSBoolean* disable = OSDynamicCast(OSBoolean, configuration->getObject("DisableDevice"));
if (disable && disable->isTrue()) {
return false;
}
}
// Parse temperature table
if (kIOReturnSuccess == acpiDevice->evaluateObject("TEMP", &object) && object) {
addSensorsFromArray(OSDynamicCast(OSArray, object), kFakeSMCCategoryTemperature);
OSSafeReleaseNULL(object);
}
else ACPISensorsDebugLog("temprerature description table (TEMP) not found");
// Parse voltage table
if (kIOReturnSuccess == acpiDevice->evaluateObject("VOLT", &object) && object) {
addSensorsFromArray(OSDynamicCast(OSArray, object), kFakeSMCCategoryVoltage);
OSSafeReleaseNULL(object);
}
else ACPISensorsDebugLog("voltage description table (VOLT) not found");
// Parse amperage table
if (kIOReturnSuccess == acpiDevice->evaluateObject("AMPR", &object) && object) {
addSensorsFromArray(OSDynamicCast(OSArray, object), kFakeSMCCategoryCurrent);
OSSafeReleaseNULL(object);
}
else ACPISensorsDebugLog("amperage description table (AMPR) not found");
// Parse power table
if (kIOReturnSuccess == acpiDevice->evaluateObject("POWR", &object) && object) {
addSensorsFromArray(OSDynamicCast(OSArray, object), kFakeSMCCategoryPower);
OSSafeReleaseNULL(object);
}
else ACPISensorsDebugLog("power description table (POWR) not found");
// Parse tachometer table
if (kIOReturnSuccess == acpiDevice->evaluateObject("TACH", &object) && object) {
addSensorsFromArray(OSDynamicCast(OSArray, object), kFakeSMCCategoryFan);
OSSafeReleaseNULL(object);
}
else ACPISensorsDebugLog("tachometer description table (TACH) not found");
// If nothing was found on ACPI device try to load configuration from info.plist
if (object == NULL && configuration)
{
if (OSDictionary *temperatures = OSDynamicCast(OSDictionary, configuration->getObject("Temperatures"))) {
if (OSBoolean *kelvins = OSDynamicCast(OSBoolean, temperatures->getObject("UseKelvins"))) {
useKelvins = kelvins->isTrue();
}
addSensorsFromDictionary(OSDynamicCast(OSDictionary, temperatures), kFakeSMCCategoryTemperature);
}
addSensorsFromDictionary(OSDynamicCast(OSDictionary, configuration->getObject("Voltages")), kFakeSMCCategoryVoltage);
addSensorsFromDictionary(OSDynamicCast(OSDictionary, configuration->getObject("Currents")), kFakeSMCCategoryCurrent);
addSensorsFromDictionary(OSDynamicCast(OSDictionary, configuration->getObject("Powers")), kFakeSMCCategoryPower);
addSensorsFromDictionary(OSDynamicCast(OSDictionary, configuration->getObject("Tachometers")), kFakeSMCCategoryFan);
}
if (methods->getCount())
ACPISensorsInfoLog("%d sensor%s added", methods->getCount(), methods->getCount() > 1 ? "s" : "");
registerService();
ACPISensorsInfoLog("started");
return true;
}
示例12: OSKextLog
void
KLDBootstrap::loadKernelExternalComponents(void)
{
OSDictionary * extensionsDict = NULL; // must release
OSCollectionIterator * keyIterator = NULL; // must release
OSString * bundleID = NULL; // don't release
OSKext * theKext = NULL; // don't release
OSBoolean * isKernelExternalComponent = NULL; // don't release
OSKextLog(/* kext */ NULL,
kOSKextLogStepLevel |
kOSKextLogLoadFlag,
"Loading Kernel External Components.");
extensionsDict = OSKext::copyKexts();
if (!extensionsDict) {
return;
}
keyIterator = OSCollectionIterator::withCollection(extensionsDict);
if (!keyIterator) {
OSKextLog(/* kext */ NULL,
kOSKextLogErrorLevel |
kOSKextLogGeneralFlag,
"Failed to allocate iterator for Kernel External Components.");
goto finish;
}
while ((bundleID = OSDynamicCast(OSString, keyIterator->getNextObject()))) {
const char * bundle_id = bundleID->getCStringNoCopy();
/* Skip extensions whose bundle IDs don't start with "com.apple.kec.".
*/
if (!bundle_id ||
(strncmp(bundle_id, COM_APPLE_KEC, CONST_STRLEN(COM_APPLE_KEC)) != 0)) {
continue;
}
theKext = OSDynamicCast(OSKext, extensionsDict->getObject(bundleID));
if (!theKext) {
continue;
}
isKernelExternalComponent = OSDynamicCast(OSBoolean,
theKext->getPropertyForHostArch(kAppleKernelExternalComponentKey));
if (isKernelExternalComponent && isKernelExternalComponent->isTrue()) {
OSKextLog(/* kext */ NULL,
kOSKextLogStepLevel |
kOSKextLogLoadFlag,
"Loading kernel external component %s.", bundleID->getCStringNoCopy());
OSKext::loadKextWithIdentifier(bundleID->getCStringNoCopy(),
/* allowDefer */ false);
}
}
finish:
OSSafeReleaseNULL(keyIterator);
OSSafeReleaseNULL(extensionsDict);
return;
}
示例13: start
bool PTIDSensors::start(IOService * provider)
{
if (!super::start(provider))
return false;
acpiDevice = (IOACPIPlatformDevice *)provider;
if (!acpiDevice) {
HWSensorsFatalLog("ACPI device not ready");
return false;
}
if (OSDictionary *configuration = getConfigurationNode()) {
OSBoolean* disable = OSDynamicCast(OSBoolean, configuration->getObject("DisableDevice"));
if (disable && disable->isTrue())
return false;
}
// On some computers (eg. RehabMan's ProBook 4530s), the system will hang on startup
// if kernel cache is used, because of the early call to updateTemperatures and/or
// updateTachometers. At least that is the case with an SSD and a valid pre-linked
// kernel, along with kernel cache enabled. This 1000ms sleep seems to fix the problem,
// enabling a clean boot with PTIDSensors enabled.
IOSleep(1000);
// Update timers
temperaturesLastUpdated = ptimer_read() - NSEC_PER_SEC;
tachometersLastUpdated = temperaturesLastUpdated;
acpiDevice->evaluateInteger("IVER", &version);
if (version == 0) {
OSString *name = OSDynamicCast(OSString, provider->getProperty("name"));
if (name && name->isEqualTo("INT3F0D"))
version = 0x30000;
else
return false;
}
setProperty("version", version, 64);
// Parse sensors
switch (version) {
case 0x30000: {
OSObject *object = NULL;
// Temperatures
if(kIOReturnSuccess == acpiDevice->evaluateObject("TSDL", &object) && object) {
if (OSArray *description = OSDynamicCast(OSArray, object)) {
HWSensorsDebugLog("Parsing temperatures...");
for (UInt32 index = 1; index < description->getCount(); index += 2) {
parseTemperatureName(OSDynamicCast(OSString, description->getObject(index)), (index - 1) / 2);
}
}
else HWSensorsErrorLog("failed to parse TSDL table");
}
else HWSensorsErrorLog("failed to evaluate TSDL table");
// Tachometers
if(kIOReturnSuccess == acpiDevice->evaluateObject("OSDL", &object) && object) {
if (OSArray *description = OSDynamicCast(OSArray, object)) {
HWSensorsDebugLog("Parsing tachometers...");
for (UInt32 index = 2; index < description->getCount(); index += 3) {
parseTachometerName(OSDynamicCast(OSString, description->getObject(index)), OSDynamicCast(OSString, description->getObject(index - 1)), (index - 2) / 3);
}
}
else HWSensorsErrorLog("failed to parse OSDL table");
}
else HWSensorsErrorLog("failed to evaluate OSDL table");
break;
}
case 0x20001: {
OSObject *object = NULL;
// Temperatures
if(kIOReturnSuccess == acpiDevice->evaluateObject("TMPV", &object) && object) {
if (OSArray *description = OSDynamicCast(OSArray, object)) {
for (UInt32 index = 1; index < description->getCount(); index += 3) {
parseTemperatureName(OSDynamicCast(OSString, description->getObject(index)), index + 1);
}
}
else HWSensorsErrorLog("failed to parse TMPV table");
}
else HWSensorsErrorLog("failed to evaluate TMPV table");
// Tachometers
if(kIOReturnSuccess == acpiDevice->evaluateObject("OSDV", &object) && object) {
if (OSArray *description = OSDynamicCast(OSArray, object)) {
for (UInt32 index = 2; index < description->getCount(); index += 4) {
parseTachometerName(OSDynamicCast(OSString, description->getObject(index)), OSDynamicCast(OSString, description->getObject(index - 1)), index + 1);
}
}
else HWSensorsErrorLog("failed to parse OSDV table");
}
else HWSensorsErrorLog("failed to evaluate OSDV table");
//.........這裏部分代碼省略.........
示例14: setParamProperties
//.........這裏部分代碼省略.........
}
_dragLock = true;
if (hscroll)
{
_trackpadHorizScroll = hscroll->unsigned32BitValue() & 0x1 ? true : false;
setProperty("TrackpadHorizScroll", hscroll);
}
_trackpadHorizScroll = true;
if (vscroll)
{
_trackpadScroll = vscroll->unsigned32BitValue() & 0x1 ? true : false;
setProperty("TrackpadScroll", vscroll);
}
_trackpadScroll = true;
if (scrollspeed)
{
_twoFingerDivider = (float)(scrollspeed->unsigned32BitValue());
setProperty("HIDTrackpadScrollAcceleration", scrollspeed);
}
if (dragPressureAverage)
{
_dragPressureAverage = dragPressureAverage->unsigned32BitValue();
setProperty("CypressDragPressureAverage", dragPressureAverage);
}
_dragPressureAverage = 85;
if (onefingermaxtaptime)
{
_onefingermaxtaptime = ((onefingermaxtaptime->unsigned32BitValue()) * 1000000);
setProperty("Cypress1FingerMaxTapTime", onefingermaxtaptime);
}
if (twofingermaxtaptime)
{
_twofingermaxtaptime = ((twofingermaxtaptime->unsigned32BitValue()) * 1000000);
setProperty("Cypress2FingerMaxTapTime", twofingermaxtaptime);
}
if (threefingermaxtaptime)
{
_threefingermaxtaptime = ((threefingermaxtaptime->unsigned32BitValue()) * 1000000);
setProperty("Cypress3FingerMaxTapTime", threefingermaxtaptime);
}
if (fourfingermaxtaptime)
{
_fourfingermaxtaptime = ((fourfingermaxtaptime->unsigned32BitValue()) * 1000000);
setProperty("Cypress4FingerMaxTapTime", fourfingermaxtaptime);
}
if (fivefingermaxtaptime)
{
_fivefingermaxtaptime = ((fivefingermaxtaptime->unsigned32BitValue()) * 1000000);
setProperty("Cypress3FingerMaxTapTime", fivefingermaxtaptime);
}
if (fourFingerHorizSwipeGesture)
{
_fourFingerHorizSwipeGesture = fourFingerHorizSwipeGesture->isTrue();
setProperty("CypressFourFingerHorizSwipeGesture", fourFingerHorizSwipeGesture->isTrue());
}
_fourFingerHorizSwipeGesture = true;
if (fourFingerVertSwipeGesture)
{
_fourFingerVertSwipeGesture = fourFingerVertSwipeGesture->isTrue();
setProperty("CypressFourFingerVertSwipeGesture", fourFingerVertSwipeGesture->isTrue());
}
_fourFingerVertSwipeGesture = true;
if (threeFingerDrag)
{
_threeFingerDrag = threeFingerDrag->isTrue();
setProperty("CypressThreeFingerDrag", threeFingerDrag->isTrue());
}
_threeFingerDrag = true;
if (twoFingerRightClick)
{
_twoFingerRightClick = twoFingerRightClick->isTrue();
setProperty("CypressTwoFingerRightClick", twoFingerRightClick->isTrue());
}
if (fiveFingerScreenLock)
{
_fiveFingerScreenLock = fiveFingerScreenLock->isTrue();
setProperty("CypressFiveFingerScreenLock", fiveFingerScreenLock->isTrue());
}
_fiveFingerScreenLock = true;
if (fiveFingerSleep)
{
_fiveFingerSleep = fiveFingerSleep->isTrue();
setProperty("CypressFiveFingerSleep", fiveFingerSleep->isTrue());
}
_fiveFingerSleep = true;
if (fiveFingerSleepTimer)
{
_fivefingersleeptime = ((fiveFingerSleepTimer->unsigned32BitValue()) * 1000000);
setProperty("Cypress5FingerSleepTimer", fiveFingerSleepTimer);
}
_fivefingersleeptime = 4 * 1000000;
if (fiveFingerScreenLockTimer)
{
_fivefingerscreenlocktime = ((fiveFingerScreenLockTimer->unsigned32BitValue()) * 1000000);
setProperty("Cypress5FingerScreenLockTimer", fiveFingerScreenLockTimer);
}
_fivefingerscreenlocktime = 1 * 1000000;
return super::setParamProperties(dict);
}
示例15: setProperty
void ApplePS2Mouse::setParamPropertiesGated(OSDictionary * config)
{
if (NULL == config)
return;
const struct {const char *name; int *var;} int32vars[]={
{"DefaultResolution", &defres},
{"ResolutionMode", &resmode},
{"ScrollResolution", &scrollres},
{"MouseYInverter", &mouseyinverter},
{"ScrollYInverter", &scrollyinverter},
{"WakeDelay", &wakedelay},
{"MouseCount", &mousecount},
{"ButtonCount", &_buttonCount},
};
const struct {const char *name; int *var;} boolvars[]={
{"ForceDefaultResolution", &forceres},
{"ForceSetResolution", &forcesetres},
{"ActLikeTrackpad", &actliketrackpad},
{"DisableLEDUpdating", &noled},
{"FakeMiddleButton", &_fakemiddlebutton},
};
const struct {const char* name; bool* var;} lowbitvars[]={
{"TrackpadScroll", &scroll},
{"OutsidezoneNoAction When Typing", &outzone_wt},
{"PalmNoAction Permanent", &palm},
{"PalmNoAction When Typing", &palm_wt},
{"USBMouseStopsTrackpad", &usb_mouse_stops_trackpad},
};
const struct {const char* name; uint64_t* var; } int64vars[]={
{"MiddleClickTime", &_maxmiddleclicktime},
};
OSNumber *num;
OSBoolean *bl;
int oldmousecount = mousecount;
bool old_usb_mouse_stops_trackpad = usb_mouse_stops_trackpad;
// 64-bit config items
for (int i = 0; i < countof(int64vars); i++)
if ((num=OSDynamicCast(OSNumber, config->getObject(int64vars[i].name))))
{
*int64vars[i].var = num->unsigned64BitValue();
setProperty(int64vars[i].name, *int64vars[i].var, 64);
}
// boolean config items
for (int i = 0; i < countof(boolvars); i++)
if ((bl=OSDynamicCast (OSBoolean,config->getObject (boolvars[i].name))))
{
*boolvars[i].var = bl->isTrue();
setProperty(boolvars[i].name, *boolvars[i].var ? kOSBooleanTrue : kOSBooleanFalse);
}
// lowbit config items
for (int i = 0; i < countof(lowbitvars); i++)
if ((num=OSDynamicCast (OSNumber,config->getObject(lowbitvars[i].name))))
{
*lowbitvars[i].var = (num->unsigned32BitValue()&0x1)?true:false;
setProperty(lowbitvars[i].name, *lowbitvars[i].var ? 1 : 0, 32);
}
// 32-bit config items
for (int i = 0; i < countof(int32vars);i++)
if ((num=OSDynamicCast (OSNumber,config->getObject (int32vars[i].name))))
{
*int32vars[i].var = num->unsigned32BitValue();
setProperty(int32vars[i].name, *int32vars[i].var, 32);
}
// check for special terminating sequence from PS2Daemon
if (-1 == mousecount)
{
// when system is shutting down/restarting we want to force LED off
if (ledpresent && !noled)
setTouchpadLED(0x10);
mousecount = oldmousecount;
}
// disable trackpad when USB mouse is plugged in
// check for mouse count changing...
if ((oldmousecount != 0) != (mousecount != 0) || old_usb_mouse_stops_trackpad != usb_mouse_stops_trackpad)
{
// either last mouse removed or first mouse added
ignoreall = (mousecount != 0) && usb_mouse_stops_trackpad;
updateTouchpadLED();
}
// convert to IOFixed format...
defres <<= 16;
}