const OSString * AppleLVMVolume::getDiskName(void) { if (!getPropertyTable()) return NULL; // this panics if not set (unpublished) const OSMetaClassBase * name = getProperty(kIOBSDNameKey); if (!name) return NULL; return OSDynamicCast(OSString, name); }
bool ACPIBacklightPanel::start( IOService * provider ) { DbgLog("%s::%s()\n", this->getName(),__FUNCTION__); #if 0 if (!provider) return false; _provider = provider; _provider->retain(); #endif _lock = IORecursiveLockAlloc(); if (!_lock) return false; findDevices(provider); getDeviceControl(); hasSaveMethod = hasSAVEMethod(backLightDevice); min = 0; max = setupIndexedLevels(); if (min == max) { IOLog("ACPIBacklight: setupIndexedLevels failed (min==max)... aborting"); return false; } // add interrupt source for delayed actions... _workSource = IOInterruptEventSource::interruptEventSource(this, OSMemberFunctionCast(IOInterruptEventAction, this, &ACPIBacklightPanel::processWorkQueue)); if (!_workSource) return false; IOWorkLoop* workLoop = getWorkLoop(); if (!workLoop) { _workSource->release(); _workSource = NULL; return false; } workLoop->addEventSource(_workSource); _workPending = 0; // add timer for smooth fade ins if (_extended && !(_options & kDisableSmooth)) { _smoothTimer = IOTimerEventSource::timerEventSource(this, OSMemberFunctionCast(IOTimerEventSource::Action, this, &ACPIBacklightPanel::onSmoothTimer)); if (_smoothTimer) workLoop->addEventSource(_smoothTimer); } _cmdGate = IOCommandGate::commandGate(this); if (_cmdGate) workLoop->addEventSource(_cmdGate); // initialize from properties OSDictionary* dict = getPropertyTable(); setPropertiesGated(dict); // write current values from smoothData for (int i = 0; i < countof(smoothData); i++) { char buf[kSmoothBufSize]; snprintf(buf, sizeof(buf), kSmoothDelta, i); setProperty(buf, smoothData[i].delta, 32); snprintf(buf, sizeof(buf), kSmoothStep, i); setProperty(buf, smoothData[i].step, 32); snprintf(buf, sizeof(buf), kSmoothTimeout, i); setProperty(buf, smoothData[i].timeout, 32); } #ifdef DEBUG setProperty("CycleTest", 1, 32); setProperty("KLVX", 1, 32); #endif // make the service available for clients like 'ioio'... registerService(); // load and set default brightness level UInt32 value = loadFromNVRAM(); DbgLog("%s: loadFromNVRAM returns %d\n", this->getName(), value); // registerService above must be called before we wait for the BacklightHandler if (useBacklightHandler()) { DbgLog("%s: Waiting for BacklightHandler\n", this->getName()); waitForService(serviceMatching("BacklightHandler")); } // after backlight handler is in place, now we can manipulate backlight level UInt32 current = queryACPICurentBrightnessLevel(); setProperty(kRawBrightness, current, 32); #if 0 _provider->setProperty("AppleBacklightAtBoot", current, 32); _provider->setProperty("AppleMaxBrightness", BCLlevels[BCLlevelsCount-1], 32); #endif _committed_value = _value = _from_value = levelForValue(current); DbgLog("%s: current brightness: %d (%d)\n", this->getName(), _from_value, current); if (-1 != value) { _committed_value = value; DbgLog("%s: setting to value from nvram %d\n", this->getName(), value); setBrightnessLevelSmooth(value); } _saved_value = _committed_value; DbgLog("%s: min = %u, max = %u\n", this->getName(), min, max); // announce version extern kmod_info_t kmod_info; IOLog("ACPIBacklight: Version %s starting on OS X Darwin %d.%d.\n", kmod_info.version, version_major, version_minor); // place version/build info in ioreg properties RM,Build and RM,Version char buf[128]; snprintf(buf, sizeof(buf), "%s %s", kmod_info.name, kmod_info.version); setProperty("RM,Version", buf); #ifdef DEBUG setProperty("RM,Build", "Debug-" LOGNAME); #else setProperty("RM,Build", "Release-" LOGNAME); #endif return true; }