AppleEmbeddedKeyboard.h [plain text]
#ifndef _IOKIT_HID_APPLEEMBEDDEDKEYBOARD_H
#define _IOKIT_HID_APPLEEMBEDDEDKEYBOARD_H
#include <IOKit/hidevent/IOHIDEventDriver.h>
enum {
kSecondaryKeyFnFunction = 0x01,
kSecondaryKeyFnKeyboard = 0x02,
kSecondaryKeyNumLockKeyboard = 0x04
};
typedef struct _SecondaryKey {
UInt8 bits;
UInt8 swapping;
UInt16 fnFunctionUsagePage;
UInt16 fnFunctionUsage;
UInt16 fnKeyboardUsagePage;
UInt16 fnKeyboardUsage;
UInt16 numLockKeyboardUsagePage;
UInt16 numLockKeyboardUsage;
} SecondaryKey;
class AppleEmbeddedKeyboard: public IOHIDEventDriver
{
OSDeclareDefaultStructors( AppleEmbeddedKeyboard )
bool _fnKeyDownPhysical;
bool _fnKeyDownVirtual;
bool _numLockDown;
bool _virtualMouseKeysSupport;
UInt32 _fKeyMode;
SecondaryKey _secondaryKeys[255];
IOHIDElement * _keyboardRollOverElement;
OSDictionary * _keyboardMap;
void findKeyboardRollOverElement(OSArray * reportElements);
void parseSecondaryUsages();
bool filterSecondaryFnFunctionUsage(
UInt32 * usagePage,
UInt32 * usage,
bool down);
bool filterSecondaryFnKeyboardUsage(
UInt32 * usagePage,
UInt32 * usage,
bool down);
bool filterSecondaryNumLockKeyboardUsage(
UInt32 * usagePage,
UInt32 * usage,
bool down);
bool filterKeyboardUsage(
UInt32 * usagePage,
UInt32 * usage,
bool down);
protected:
virtual bool handleStart( IOService * provider );
virtual void setElementValue (
UInt32 usagePage,
UInt32 usage,
UInt32 value );
virtual void dispatchKeyboardEvent(
AbsoluteTime timeStamp,
UInt32 usagePage,
UInt32 usage,
UInt32 value,
IOOptionBits options = 0 );
public:
virtual bool init(OSDictionary * properties = 0);
virtual void free();
virtual IOReturn setSystemProperties( OSDictionary * properties );
};
#endif