All pastes #423297 Raw Edit

Unnamed

public text v1 · immutable
·published 2007-04-04 01:31 UTC
rendered paste body
void IRKeyboardEmu::readInput(void)
{
	OSDictionary *dataDictionary;
    OSBoolean *value;
    OSNumber *number;
    
    dataDictionary = OSDynamicCast(OSDictionary, getProperty(kKeyInput));
    if(dataDictionary == NULL) return;
    number = OSDynamicCast(OSNumber,dataDictionary->getObject("keyCode"));
    if(number != NULL) inputCode = number->unsigned32BitValue();
	IOLog("keyCode = %d", inputCode);
}

// Called by the userspace IORegistryEntrySetCFProperties function
IOReturn IRKeyboardEmu::setProperties(OSObject *properties)
{
    OSDictionary *dictionary = OSDynamicCast(OSDictionary,properties);
    if(dictionary != NULL) 
	{
        setProperty(kKeyInput, dictionary);
        readInput();
		issueFakeReport(inputCode);
        return kIOReturnSuccess;
    } else return kIOReturnBadArgument;
}