2 * Copyright (c) 1998-2000 Apple Computer, Inc. All rights reserved.
4 * @APPLE_LICENSE_HEADER_START@
6 * The contents of this file constitute Original Code as defined in and
7 * are subject to the Apple Public Source License Version 1.1 (the
8 * "License"). You may not use this file except in compliance with the
9 * License. Please obtain a copy of the License at
10 * http://www.apple.com/publicsource and read it before using this file.
12 * This Original Code and all software distributed under the License are
13 * distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, EITHER
14 * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
15 * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
16 * FITNESS FOR A PARTICULAR PURPOSE OR NON-INFRINGEMENT. Please see the
17 * License for the specific language governing rights and limitations
20 * @APPLE_LICENSE_HEADER_END@
22 #include <IOKit/adb/IOADBDevice.h>
23 #include <IOKit/hidsystem/IOHIKeyboard.h>
26 kgestaltPwrBkEKDomKbd
= 0xc3,
27 kgestaltPwrBkEKISOKbd
= 0xc4,
28 kgestaltPwrBkEKJISKbd
= 0xc5,
29 kgestaltPwrBk99JISKbd
= 0xc9
32 class AppleADBKeyboard
: public IOHIKeyboard
34 OSDeclareDefaultStructors(AppleADBKeyboard
)
38 void setAlphaLockFeedback ( bool to
);
39 void setNumLockFeedback ( bool to
);
40 UInt32
maxKeyCodes ( void );
41 const unsigned char * defaultKeymapOfLength (UInt32
* length
);
42 UInt32
interfaceID ( void );
43 bool doesKeyLock ( unsigned key
);
44 unsigned getLEDStatus (void );
46 AbsoluteTime programmerKeyTime
;
47 AbsoluteTime rebootTime
;
48 AbsoluteTime debuggerTime
;
52 UInt32
deviceType ( void );
53 IOADBDevice
* adbDevice
;
54 UInt16 turnLEDon
; // used by setAlphaLockFeedback mechanism
55 UInt16 LEDStatus
; //For ADB device TALK commands
57 bool start ( IOService
* theNub
);
58 IOReturn
packet (UInt8
* data
, IOByteCount length
, UInt8 adbCommand
);
59 void dispatchKeyboardEvent(unsigned int keyCode
,
60 /* direction */ bool goingDown
,
61 /* timeStamp */ AbsoluteTime time
);
68 #define ADBK_LEFT 0x3B
69 #define ADBK_RIGHT 0x3C
71 #define ADBK_DOWN 0x3D
72 #define ADBK_PGUP 0x74
73 #define ADBK_PGDN 0x79
74 #define ADBK_HOME 0x73
76 #define ADBK_CONTROL 0x36
77 #define ADBK_CONTROL_R 0x7D
78 #define ADBK_FLOWER 0x37
79 #define ADBK_SHIFT 0x38
80 #define ADBK_SHIFT_R 0x7B
81 #define ADBK_CAPSLOCK 0x39
82 #define ADBK_OPTION 0x3A
83 #define ADBK_OPTION_R 0x7C
84 #define ADBK_NUMLOCK 0x47
85 #define ADBK_SPACE 0x31
101 #define ADBK_POWER 0x7f /* actual 0x7f 0x7f */
103 #define ADBK_KEYVAL(key) ((key) & 0x7f)
104 #define ADBK_PRESS(key) (((key) & 0x80) == 0)
105 #define ADBK_KEYDOWN(key) (key)
106 #define ADBK_KEYUP(key) ((key) | 0x80)
107 #define ADBK_MODIFIER(key) ((((key) & 0x7f) == ADBK_SHIFT) || \
108 (((key) & 0x7f) == ADBK_SHIFT_R) || \
109 (((key) & 0x7f) == ADBK_CONTROL) || \
110 (((key) & 0x7f) == ADBK_CONTROL_R) || \
111 (((key) & 0x7f) == ADBK_FLOWER) || \
112 (((key) & 0x7f) == ADBK_OPTION) || \
113 (((key) & 0x7f) == ADBK_OPTION_R) || \
114 (((key) & 0x7f) == ADBK_NUMLOCK) || \
115 (((key) & 0x7f) == ADBK_CAPSLOCK))
117 /* ADB Keyboard Status - ADB Register 2 */
119 #define ADBKS_LED_NUMLOCK 0x0001
120 #define ADBKS_LED_CAPSLOCK 0x0002
121 #define ADBKS_LED_SCROLLLOCK 0x0004
122 #define ADBKS_SCROLL_LOCK 0x0040
123 #define ADBKS_NUMLOCK 0x0080
124 /* Bits 3 to 5 are reserved */
125 #define ADBKS_APPLE_CMD 0x0100
126 #define ADBKS_OPTION 0x0200
127 #define ADBKS_SHIFT 0x0400
128 #define ADBKS_CONTROL 0x0800
129 #define ADBKS_CAPSLOCK 0x1000
130 #define ADBKS_RESET 0x2000
131 #define ADBKS_DELETE 0x4000
132 /* bit 16 is reserved */