]> git.saurik.com Git - apple/xnu.git/blob - iokit/Drivers/hidsystem/drvAppleADBDevices/AppleADBButtons.h
467ea3a2585c1c5e3224ec65439f8f5de1a133a3
[apple/xnu.git] / iokit / Drivers / hidsystem / drvAppleADBDevices / AppleADBButtons.h
1 #ifndef _APPLEADBBUTTONS_H
2 #define _APPLEADBBUTTONS_H
3
4 /*
5 * Copyright (c) 1998-2000 Apple Computer, Inc. All rights reserved.
6 *
7 * @APPLE_LICENSE_HEADER_START@
8 *
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.
14 *
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
21 * under the License.
22 *
23 * @APPLE_LICENSE_HEADER_END@
24 */
25
26 #include <IOKit/hidsystem/IOHIKeyboard.h>
27 #include <IOKit/adb/IOADBDevice.h>
28
29 #define kVolume_up 0x06
30 #define kVolume_down 0x07
31 #define kMute 0x08
32 #define kVolume_up_AV 0x03 //Apple ADB AV monitors have different button codes
33 #define kVolume_down_AV 0x02
34 #define kMute_AV 0x01
35 #define kBrightness_up 0x09
36 #define kBrightness_down 0x0a
37 #define kEject 0x0b
38 #define kNum_lock_on_laptops 0x7f
39
40 #define kMax_registrations 10
41 #define kMax_keycode 0x0a
42 #define kNullKey 0xFF
43
44 typedef void (*button_handler)(void * );
45
46 class AppleADBButtons : public IOHIKeyboard
47 {
48 OSDeclareDefaultStructors(AppleADBButtons)
49
50 private:
51
52 unsigned int keycodes[kMax_registrations];
53 void * registrants[kMax_registrations];
54 button_handler downHandlers[kMax_registrations];
55
56 void dispatchButtonEvent (unsigned int, bool );
57 UInt32 _initial_handler_id;
58
59 public:
60
61 const unsigned char * defaultKeymapOfLength (UInt32 * length );
62 UInt32 interfaceID();
63 UInt32 deviceType();
64 UInt64 getGUID();
65
66 public:
67
68 IOService * displayManager; // points to display manager
69 IOADBDevice * adbDevice;
70
71 bool start ( IOService * theNub );
72 IOReturn packet (UInt8 * data, IOByteCount length, UInt8 adbCommand );
73 IOReturn registerForButton ( unsigned int, IOService *, button_handler, bool );
74
75 IOReturn setParamProperties(OSDictionary *dict);
76 };
77
78 #endif /* _APPLEADBBUTTONS_H */