#ifndef _APPLEADBBUTTONS_H
#define _APPLEADBBUTTONS_H
#include <IOKit/hidsystem/IOHIKeyboard.h>
#include <IOKit/adb/IOADBDevice.h>
#define kVolume_up 0x06
#define kVolume_down 0x07
#define kMute 0x08
#define kVolume_up_AV 0x03 //Apple ADB AV monitors have different button codes
#define kVolume_down_AV 0x02
#define kMute_AV 0x01
#define kBrightness_up 0x09
#define kBrightness_down 0x0a
#define kEject 0x0b
#define kVideoMirror 0x0c
#define kIllumination_toggle 0x0d
#define kIllumination_down 0x0e
#define kIllumination_up 0x0f
#define kNum_lock_on_laptops 0x7f
#define kMax_registrations 10
#define kMax_keycode 0x0a
#define kNullKey 0xFF
typedef void (*button_handler)(void * );
class AppleADBButtons : public IOHIKeyboard
{
OSDeclareDefaultStructors(AppleADBButtons)
private:
unsigned int keycodes[kMax_registrations];
void * registrants[kMax_registrations];
button_handler downHandlers[kMax_registrations];
void dispatchButtonEvent (unsigned int, bool );
UInt32 _initial_handler_id;
const OSSymbol *register_for_button;
UInt32 _eject_delay;
thread_call_t _peject_timer;
bool _eject_released;
IOService *_pADBKeyboard;
public:
const unsigned char * defaultKeymapOfLength (UInt32 * length );
UInt32 interfaceID();
UInt32 deviceType();
UInt64 getGUID();
void _check_eject_held( void ) ;
public:
IOService * displayManager; IOADBDevice * adbDevice;
bool start ( IOService * theNub );
IOReturn packet (UInt8 * data, IOByteCount length, UInt8 adbCommand );
IOReturn registerForButton ( unsigned int, IOService *, button_handler, bool );
IOReturn setParamProperties(OSDictionary *dict);
virtual IOReturn callPlatformFunction(const OSSymbol *functionName,
bool waitForFunction,
void *param1, void *param2,
void *param3, void *param4);
};
#endif