1 #ifndef _APPLEADBBUTTONS_H
2 #define _APPLEADBBUTTONS_H
5 * Copyright (c) 1998-2000 Apple Computer, Inc. All rights reserved.
7 * @APPLE_LICENSE_HEADER_START@
9 * The contents of this file constitute Original Code as defined in and
10 * are subject to the Apple Public Source License Version 1.1 (the
11 * "License"). You may not use this file except in compliance with the
12 * License. Please obtain a copy of the License at
13 * http://www.apple.com/publicsource and read it before using this file.
15 * This Original Code and all software distributed under the License are
16 * distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, EITHER
17 * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
18 * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
19 * FITNESS FOR A PARTICULAR PURPOSE OR NON-INFRINGEMENT. Please see the
20 * License for the specific language governing rights and limitations
23 * @APPLE_LICENSE_HEADER_END@
26 #include <IOKit/hidsystem/IOHIKeyboard.h>
27 #include <IOKit/adb/IOADBDevice.h>
29 #define kVolume_up 0x06
30 #define kVolume_down 0x07
32 #define kVolume_up_AV 0x03 //Apple ADB AV monitors have different button codes
33 #define kVolume_down_AV 0x02
35 #define kBrightness_up 0x09
36 #define kBrightness_down 0x0a
38 #define kNum_lock_on_laptops 0x7f
40 #define kMax_registrations 10
41 #define kMax_keycode 0x0a
44 typedef void (*button_handler
)(void * );
46 class AppleADBButtons
: public IOHIKeyboard
48 OSDeclareDefaultStructors(AppleADBButtons
)
52 unsigned int keycodes
[kMax_registrations
];
53 void * registrants
[kMax_registrations
];
54 button_handler downHandlers
[kMax_registrations
];
56 void dispatchButtonEvent (unsigned int, bool );
57 UInt32 _initial_handler_id
;
61 const unsigned char * defaultKeymapOfLength (UInt32
* length
);
68 IOService
* displayManager
; // points to display manager
69 IOADBDevice
* adbDevice
;
71 bool start ( IOService
* theNub
);
72 IOReturn
packet (UInt8
* data
, IOByteCount length
, UInt8 adbCommand
);
73 IOReturn
registerForButton ( unsigned int, IOService
*, button_handler
, bool );
75 IOReturn
setParamProperties(OSDictionary
*dict
);
78 #endif /* _APPLEADBBUTTONS_H */