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;
}
// Read the settings from the registry
void Xbox360Peripheral::readSettings(void)
{
    OSBoolean *value = NULL;
    OSNumber *number = NULL;
    OSDictionary *dataDictionary = OSDynamicCast(OSDictionary, getProperty(kDriverSettingKey));
    
    if (dataDictionary == NULL) return;
    value = OSDynamicCast(OSBoolean, dataDictionary->getObject("InvertLeftX"));
    if (value != NULL) invertLeftX = value->getValue();
    value = OSDynamicCast(OSBoolean, dataDictionary->getObject("InvertLeftY"));
    if (value != NULL) invertLeftY = value->getValue();
    value = OSDynamicCast(OSBoolean, dataDictionary->getObject("InvertRightX"));
    if (value != NULL) invertRightX = value->getValue();
    value = OSDynamicCast(OSBoolean, dataDictionary->getObject("InvertRightY"));
    if (value != NULL) invertRightY = value->getValue();
    number = OSDynamicCast(OSNumber, dataDictionary->getObject("DeadzoneLeft"));
    if (number != NULL) deadzoneLeft = number->unsigned32BitValue();
    number = OSDynamicCast(OSNumber, dataDictionary->getObject("DeadzoneRight"));
    if (number != NULL) deadzoneRight = number->unsigned32BitValue();
    value = OSDynamicCast(OSBoolean, dataDictionary->getObject("RelativeLeft"));
    if (value != NULL) relativeLeft = value->getValue();
    value = OSDynamicCast(OSBoolean, dataDictionary->getObject("RelativeRight"));
    if (value != NULL) relativeRight=value->getValue();
    
#if 0
    IOLog("Xbox360Peripheral preferences loaded:\n  invertLeft X: %s, Y: %s\n   invertRight X: %s, Y:%s\n  deadzone Left: %d, Right: %d\n\n",
            invertLeftX?"True":"False",invertLeftY?"True":"False",
            invertRightX?"True":"False",invertRightY?"True":"False",
            deadzoneLeft,deadzoneRight);
#endif
}
Exemple #3
0
bool IORangeAllocator::serialize(OSSerialize *s) const
{
    OSArray *	array = OSArray::withCapacity( numElements * 2 );
    OSNumber *	num;
    UInt32	index;
    bool	ret;

    if( !array)
	return( false );

    LOCK();

    for( index = 0; index < numElements; index++) {
	if( (num = OSNumber::withNumber( elements[index].start,
					8 * sizeof(IORangeScalar) ))) {
	    array->setObject(num);
	    num->release();
	}
	if( (num = OSNumber::withNumber( elements[index].end,
					8 * sizeof(IORangeScalar) ))) {
	    array->setObject(num);
	    num->release();
	}
    }

    UNLOCK();

    ret = array->serialize(s);
    array->release();

    return( ret );
}
int VoodooI2CHIDDevice::i2c_hid_acpi_pdata(i2c_hid *ihid) {

    UInt32 guid_1 = 0x3CDFF6F7;
    UInt32 guid_2 = 0x45554267;
    UInt32 guid_3 = 0x0AB305AD;
    UInt32 guid_4 = 0xDE38893D;
    
    
    OSObject *result = NULL;
    OSObject *params[3];
    char buffer[16];
    
    memcpy(buffer, &guid_1, 4);
    memcpy(buffer + 4, &guid_2, 4);
    memcpy(buffer + 8, &guid_3, 4);
    memcpy(buffer + 12, &guid_4, 4);
    
    
    params[0] = OSData::withBytes(buffer, 16);
    params[1] = OSNumber::withNumber(0x1, 8);
    params[2] = OSNumber::withNumber(0x1, 8);
    
    ihid->client->provider->evaluateObject("_DSM", &result, params, 3);

    OSNumber* number = OSDynamicCast(OSNumber, result);
    
    ihid->pdata.hid_descriptor_address = number->unsigned32BitValue();
    
    number->release();
    params[0]->release();
    params[1]->release();
    params[2]->release();

    return 0;
}
OSNumber* Xbox360ControllerClass::newLocationIDNumber() const
{
	IOUSBDevice *device;
    OSNumber *number;
    UInt32 location = 0;

	device = GetOwnerProvider(this);
    if (device)
    {
        if ((number = OSDynamicCast(OSNumber, device->getProperty("locationID"))))
        {
            location = number->unsigned32BitValue();
        }
        else
        {
            // Make up an address
            if ((number = OSDynamicCast(OSNumber, device->getProperty("USB Address"))))
                location |= number->unsigned8BitValue() << 24;

            if ((number = OSDynamicCast(OSNumber, device->getProperty("idProduct"))))
                location |= number->unsigned8BitValue() << 16;
        }
    }

    return (location != 0) ? OSNumber::withNumber(location, 32) : 0;
}
IOReturn ApplePS2SynapticsTouchPad::setParamProperties( OSDictionary * dict )
{
    OSNumber * clicking = OSDynamicCast( OSNumber, dict->getObject("Clicking") );

    if ( clicking )
    {    
        UInt8  newModeByteValue = clicking->unsigned32BitValue() & 0x1 ?
                                  kModeByteValueGesturesEnabled :
                                  kModeByteValueGesturesDisabled;

        if (_touchPadModeByte != newModeByteValue)
        {
            _touchPadModeByte = newModeByteValue;

            //
            // Write the TouchPad mode byte value.
            //

            setTouchPadModeByte(_touchPadModeByte, true);

            //
            // Advertise the current state of the tapping feature.
            //

            setProperty("Clicking", clicking);
        }
    }

    return super::setParamProperties(dict);
}
bool IOAudioSelectorControl::init(SInt32 initialValue,
                                    UInt32 channelID,
                                    const char *channelName,
                                    UInt32 cntrlID,
                                    UInt32 subType,
                                    UInt32 usage,
                                    OSDictionary *properties)
{
    bool result = false;
    OSNumber *number;
    
    number = OSNumber::withNumber(initialValue, sizeof(SInt32)*8);
    
    if (number) {
        result = super::init(kIOAudioControlTypeSelector, 
                        number,
                        channelID,
                        channelName,
                        cntrlID,
                        subType,
                        usage,
                        properties);
                        
        number->release();
    }
    
    if (result) {
        availableSelections = OSArray::withCapacity(2);
        setProperty(kIOAudioSelectorControlAvailableSelectionsKey, availableSelections);
    }
    
    return result;
}
bool
IOEthernetInterface::setFilters(
    OSDictionary *   dict,
    const OSSymbol * group,
    UInt32           filters )
{
    OSNumber * num;
    bool       ret = false;

    assert( dict && group );

    num = (OSNumber *) dict->getObject(group);
    if ( num == 0 )
    {
        if (( num = OSNumber::withNumber(filters, 32) ))
        {
            ret = dict->setObject(group, num);
            num->release();
        }
    }
    else
    {
        num->setValue(filters);
        ret = true;
    }
    return ret;
}
bool IOAudioSelectorControl::valueExists(SInt32 selectionValue)
{
    bool found = false;
    OSCollectionIterator *iterator;

    assert(availableSelections);
    
    iterator = OSCollectionIterator::withCollection(availableSelections);
    if (iterator) {
        OSDictionary *selection;
        
        while ( (selection = (OSDictionary *)iterator->getNextObject()) ) {
            OSNumber *sValue;
            
            sValue = (OSNumber *)selection->getObject(kIOAudioSelectorControlSelectionValueKey);
            
            if (sValue && ((SInt32)sValue->unsigned32BitValue() == selectionValue)) {
                found = true;
                break;
            }
        }
        
        iterator->release();
    }
    
    return found;
}
IOReturn IOAudioLevelControl::validateValue(OSObject *newValue)
{
    IOReturn result = kIOReturnBadArgument;
    OSNumber *number;
    
    number = OSDynamicCast(OSNumber, newValue);
	
	DbgLog("+ IOAudioLevelControl::validateValue[%p] (%p)\n", this, newValue);
   
    if (number) {
        SInt32 newIntValue;
        
        newIntValue = (SInt32)number->unsigned32BitValue();

		DbgLog("  IOAudioLevelControl::validateValue[%p] - newIntValue = %ld, min = %ld, max = %ld\n", this, (long int)newIntValue, (long int)minValue, (long int)maxValue);
        
        if ((newIntValue >= minValue) && (newIntValue <= maxValue)) {
            result = kIOReturnSuccess;
        } else {
            result = kIOReturnError;
        }
    }
    
	DbgLog("- IOAudioLevelControl::validateValue[%p] (%p) returns 0x%lX\n", this, newValue, (long unsigned int)result );
    return result;
}
bool IOFireWireNub::init( OSDictionary * propTable )
{
	bool success = true;
	
    OSNumber *offset;
    
	if( !IOService::init(propTable) )
	{
		success = false;
	}

	if( success )
	{
		fAuxiliary = createAuxiliary();
		if( fAuxiliary == NULL )
			success = false;
	}

	if( success )
	{
		offset = OSDynamicCast(OSNumber, propTable->getObject("GUID"));
		if( offset )
			fUniqueID = offset->unsigned64BitValue();
	
		fConfigDirectorySet = OSSet::withCapacity(1);
		if( fConfigDirectorySet == NULL )
			success = false;
	}
	
    return success;
}
bool IOAudioLevelControl::init(SInt32 initialValue,
                               SInt32 minValue,
                               SInt32 maxValue,
                               IOFixed minDB,
                               IOFixed maxDB,
                               UInt32 channelID,
                               const char *channelName,
                               UInt32 cntrlID,
                               UInt32 subType,
                               UInt32 usage,
                               OSDictionary *properties)
{
    bool result = true;
    OSNumber *number;
    
    number = OSNumber::withNumber(initialValue, sizeof(SInt32)*8);
    
    if ((number == NULL) || !super::init(kIOAudioControlTypeLevel, number, channelID, channelName, cntrlID, subType, usage, properties)) {
        result = false;
        goto Done;
    }

    setMinValue(minValue);
    setMaxValue(maxValue);
    setMinDB(minDB);
    setMaxDB(maxDB);

Done:
    if (number) {
        number->release();
    }
            
    return result;
}
// GetPlistValue
UInt32 
VoodooPState::getPlistValue(OSDictionary * dictionary,
						   const char * symbol)
{
	OSObject * object = 0;
	OSBoolean * boolean = false;
	OSNumber * number = 0;
	OSString * string = 0;
	object = dictionary->getObject(symbol);
	if (object && (OSTypeIDInst(object) == OSTypeID(OSBoolean)))
	{
		boolean = OSDynamicCast(OSBoolean, object);
		return boolean->getValue();
	}
	if (object && (OSTypeIDInst(object) == OSTypeID(OSNumber)))
	{
		number = OSDynamicCast(OSNumber, object);
		return number->unsigned32BitValue();
	}
	if (object && (OSTypeIDInst(object) == OSTypeID(OSString)))
	{
		string = OSDynamicCast(OSString, object);
		// Implement string to number conversion
	}
	return 0;
}
IOReturn
VoodooPState::setProperties(OSObject * properties)
{
	if (!Ready) {
		return kIOReturnNotReady;
	}
	OSDictionary * dictionary = OSDynamicCast(OSDictionary, properties);

	// to fix p-state
	OSObject * object = dictionary->getObject(keyCurrentPState);
	if (object) {
		// reset
		CpuCount = getCpuCount();

		OSNumber * number = OSDynamicCast(OSNumber, object);
		UInt32 pstate = number->unsigned32BitValue();
		if(pstate >= PStateCount)
			pstate = PStateCount-1;
		Request = pstate;

		// InfoLog("Requested : %d",Request);
		return kIOReturnSuccess;
	}
	return kIOReturnUnsupported;
}
bool IOBSDConsole::publishNotificationHandler(
			    IOBSDConsole * self,
                            void * ref,
                            IOService * newService )

{
    IOHIKeyboard *	keyboard = 0;
    IOService *		audio = 0;

    if( ref) {
        audio = OSDynamicCast(IOService, newService->metaCast("IOAudioStream"));
        if (audio != 0) {
            OSNumber *out = newService->copyProperty("Out");
            if (OSDynamicCast(OSNumber, out)) {
                if (out->unsigned8BitValue() == 1) {
                    self->fAudioOut = newService;
                }
            }
            OSSafeReleaseNULL(out);
        }
    } else {
	audio = 0;
        keyboard = OSDynamicCast( IOHIKeyboard, newService );

        if( keyboard && self->attach( keyboard )) {
            self->arbitrateForKeyboard( keyboard );
        }

        if( newService->metaCast("IODisplayWrangler"))
            self->displayManager = newService;
    }

    return true;
}
Exemple #16
0
bool AppleLVMGroup::addMember(AppleRAIDMember * member)
{
    if (super::addMember(member) == false) return false;

    OSNumber * number = OSDynamicCast(OSNumber, member->getHeaderProperty(kAppleRAIDChunkCountKey));
    if (!number) return false;
    UInt64 memberBlockCount = number->unsigned64BitValue();

    UInt32 memberIndex = member->getMemberIndex();
    arMemberBlockCounts[memberIndex] = memberBlockCount;
    
    // total up the block count as we go
    arSetBlockCount += memberBlockCount;
    arSetMediaSize = arSetBlockCount * arSetBlockSize;

    // read the TOC on this member
    IOBufferMemoryDescriptor * newPrimaryBuffer = readPrimaryMetaData(member);
    if (newPrimaryBuffer && arPrimaryBuffer != newPrimaryBuffer) {
	if (arPrimaryBuffer) arPrimaryBuffer->release();
	arPrimaryBuffer = newPrimaryBuffer;
    }

    // scan the logical volumes in start

    return true;
}
Exemple #17
0
/*---------------------------------------------------------------------------
 * Update all the registry properties associated with an interface
 ---------------------------------------------------------------------------*/
void EInterfaces::update_interface_property(void)
{
	int n;
	
	debug("update_interface_property - m_nInterfacesInUse=%d\n", m_nInterfacesInUse);

	if ( m_pProvider )
	{
		m_pProvider->removeProperty(ENABLED_INTERFACES_PROPERTY);
		
		if ( m_nInterfacesInUse )
		{
			OSArray* pInterfaces = OSArray::withCapacity(m_nInterfacesInUse);
			if ( pInterfaces )
			{
				for(n=0; n<numberof(m_aInterfaces); n++)
					if ( m_aInterfaces[n].m_fEnabled )
					{
						OSNumber* pNumber = OSNumber::withNumber(n, 32);
						if ( pNumber )
						{
							pInterfaces->setObject(pNumber);
							pNumber->release();
						}
					}
				
				m_pProvider->setProperty(ENABLED_INTERFACES_PROPERTY, (OSObject* )pInterfaces);
				pInterfaces->release();
			}
		}
	}
}
bool CompareNumberPropertyArray( IOService * owner, OSDictionary * matching, const char * arrayName, const char * key, SInt32 * score, SInt32 increment)
{
	OSNumber    *registryProperty = (OSNumber *)owner->copyProperty(key);
    OSArray     *propertyArray = (OSArray *)matching->getObject(arrayName);
    CONVERT_TO_STACK_RETAIN(registryProperty);
	
    // If the property in the matching doesn't exist return true
	if ( OSDynamicCast(OSArray, propertyArray) )
    {
        if ( OSDynamicCast(OSNumber, registryProperty ) )
        {
            OSNumber *propertyFromArray;
            int i = 0;
            
            for ( i = 0; i < propertyArray->getCount(); i ++ )
            {
                propertyFromArray = OSDynamicCast(OSNumber, propertyArray->getObject(i));
                if ( propertyFromArray && propertyFromArray->isEqualTo(registryProperty) )
                {
                    if ( score )
                        *score += increment;
                    return true;
                }
            }
        }
    }
    else
        return true;
    
	return false;
}
Exemple #19
0
IOReturn net_habitue_device_SC101::reportMaxValidBlock(UInt64 *maxBlock)
{
  OSNumber *size = OSDynamicCast(OSNumber, getProperty(gSC101DeviceSizeKey));  
  *maxBlock = (size ? size->unsigned64BitValue() / SECTOR_SIZE - 1 : 0);

  return kIOReturnSuccess;
}
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;
}
/******************************************************************************
 * CodecCommander::parseAudioEngineState - repeats the action when timer fires
 ******************************************************************************/
void CodecCommander::parseAudioEngineState()
{
    IORegistryEntry *hdaEngineOutputEntry = IORegistryEntry::fromPath(engineOutputPath);
    if (hdaEngineOutputEntry != NULL) {
        OSNumber *state = OSDynamicCast(OSNumber, hdaEngineOutputEntry->getProperty("IOAudioEngineState"));
        if (state != NULL) {
            hdaEngineState = state->unsigned8BitValue();
            //DEBUG_LOG("CodecCommander:  EngineOutput power state %d\n", hdaEngineState);
            
            if (hdaEngineState == 0x1)
                DEBUG_LOG("CodecCommander: cc: --> audio stream active\n");
            //else
                //DEBUG_LOG("CodecCommander: cc: --> audio stream inactive\n"); // will produce spam in console
        }
        else {
            DEBUG_LOG("CodecCommander: IOAudioEngineState unknown\n");
            return;
        }
    }
    else {
        DEBUG_LOG("CodecCommander: %s is unreachable\n", engineOutputPath);
        return;
    }
    
    hdaEngineOutputEntry->release();
}
/******************************************************************************
 * CodecCommander::parseCodecPowerState - get codec power state from IOReg
 ******************************************************************************/
void CodecCommander::parseCodecPowerState()
{
    // monitor power state of hda audio codec
    IORegistryEntry *hdaDriverEntry = IORegistryEntry::fromPath(hdaDriverPath);
    if (hdaDriverEntry != NULL) {
        OSNumber *powerState = OSDynamicCast(OSNumber, hdaDriverEntry->getProperty("IOAudioPowerState"));
        if (powerState != NULL) {
            hdaCurrentPowerState = powerState->unsigned8BitValue();
            // if hda codec changed power state
            if (hdaCurrentPowerState != hdaPrevPowerState) {
                // store current power state as previous state for next workloop cycle
                hdaPrevPowerState = hdaCurrentPowerState;
                // notify about codec power loss state
                if (hdaCurrentPowerState == 0x0) {
                    DEBUG_LOG("CodecCommander: cc: --> hda codec lost power\n");
                    eapdPoweredDown = true;
                    coldBoot = false; //codec entered fugue state or sleep - no longer a cold boot
                    updateCount = 0;
                }
            }
        }
        else {
            DEBUG_LOG("CodecCommander: IOAudioPowerState unknown\n");
            return;
        }
    }
    else {
        DEBUG_LOG("CodecCommander: %s is unreachable\n", hdaDriverPath);
        return;
    }
    
    hdaDriverEntry->release();
}
OSNumber * IOHIDDeviceShim::newLocationIDNumber() const
{
    OSNumber *  number;
    UInt32      location = _location;
    
    if (_device && !location)
    {
        if ((number = OSDynamicCast(OSNumber, _device->getProperty("locationID"))) || 
			(number = OSDynamicCast(OSNumber, _device->getProperty(kIOHIDLocationIDKey))))
        {
            location = number->unsigned32BitValue();
        }
        else 
        {
            // Bullshit a location based on the ADB address and handler id        
            if (number = OSDynamicCast(OSNumber, _device->getProperty("address")))
                location |= number->unsigned8BitValue() << 24;
                
            if (number = OSDynamicCast(OSNumber, _device->getProperty("handler id")))
                location |= number->unsigned8BitValue() << 16;
        }
    }
    
    return (location) ? OSNumber::withNumber(location, 32) : 0;
}
Exemple #24
0
UInt32 CLASS::getNumberPropertyValue( const char * propKey ) const
{
    OSNumber * num = OSDynamicCast(OSNumber, getProperty(propKey));
    if (num)
        return num->unsigned32BitValue();
    else
        return 0;
}
void AppleACPIBatteryDevice::setSerialNumber(int sernum)
{
    OSNumber *n = OSNumber::withNumber(sernum, NUM_BITS);
    if (n) {
        properties->setObject(_SerialNumberSym, n);
        n->release();
    }
}
void AppleACPIBatteryDevice::setInstantAmperage(int mA)
{
    OSNumber *n = OSNumber::withNumber(mA, NUM_BITS);
    if (n) {
        properties->setObject(_InstantAmperageSym, n);
        n->release();
    }
}
void AppleACPIBatteryDevice::setInstantaneousTimeToEmpty(int seconds)
{
    OSNumber *n = OSNumber::withNumber(seconds, NUM_BITS);
    if (n) {
        properties->setObject(_InstantTimeToEmptySym, n);
        n->release();
    }
}
void AppleACPIBatteryDevice::setAverageTimeToFull(int seconds)
{
    OSNumber *n = OSNumber::withNumber(seconds, NUM_BITS);
    if (n) {
        properties->setObject(_AvgTimeToFullSym, n);
        n->release();
    }
}
bool ACPIBacklightPanel::doUpdate( void )
{
    DbgLog("enter %s::%s()\n", this->getName(),__FUNCTION__);
    bool result = false;

    OSDictionary* newDict = 0;
	OSDictionary* allParams = OSDynamicCast(OSDictionary, _display->copyProperty(gIODisplayParametersKey));
    if (allParams)
    {
        newDict = OSDictionary::withDictionary(allParams);
        allParams->release();
    }
    
    OSDictionary* backlightParams = OSDictionary::withCapacity(2);
    ////OSDictionary* linearParams = OSDictionary::withCapacity(2);

    //REVIEW_REHABMAN: myParams is not used...
    OSDictionary* myParams  = OSDynamicCast(OSDictionary, copyProperty(gIODisplayParametersKey));
    if (/*linearParams && */backlightParams && myParams)
	{				
		//DbgLog("%s: ACPILevel min %d, max %d, value %d\n", this->getName(), min, max, _value);
		
        IODisplay::addParameter(backlightParams, gIODisplayBrightnessKey, kBacklightLevelMin, kBacklightLevelMax);
        IODisplay::setParameter(backlightParams, gIODisplayBrightnessKey, _committed_value);

        ////IODisplay::addParameter(linearParams, gIODisplayLinearBrightnessKey, 0, 0x710);
        ////IODisplay::setParameter(linearParams, gIODisplayLinearBrightnessKey, ((_index-min) * 0x710 + (max-min)/2) / (max-min));

        OSNumber * num = OSNumber::withNumber(0ULL, 32);
        OSDictionary * commitParams = OSDictionary::withCapacity(1);
        commitParams->setObject("reg", num);
        backlightParams->setObject(gIODisplayParametersCommitKey, commitParams);
        num->release();
        commitParams->release();
                
        if (newDict)
        {
            newDict->merge(backlightParams);
            ////newDict->merge(linearParams);
            _display->setProperty(gIODisplayParametersKey, newDict);
            newDict->release();
        }
        else
            _display->setProperty(gIODisplayParametersKey, backlightParams);

        //refresh properties here too
        setProperty(gIODisplayParametersKey, backlightParams);
        
        backlightParams->release();
        myParams->release();
        ////linearParams->release();

        result = true;
	}

    DbgLog("exit %s::%s()\n", this->getName(),__FUNCTION__);
    return result;
}
static void setNumberInDict(OSDictionary* dict, const char* key, UInt16 value)
{
    OSNumber* num = OSNumber::withNumber(value, 16);
    if (num)
    {
        dict->setObject(key, num);
        num->release();
    }
}