|
|
1.1 root 1: /*
2: * Copyright (c) 1998-2000 Apple Computer, Inc. All rights reserved.
3: *
4: * @APPLE_LICENSE_HEADER_START@
5: *
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.
11: *
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
18: * under the License.
19: *
20: * @APPLE_LICENSE_HEADER_END@
21: */
22: /*
23: * Copyright (c) 1998 Apple Computer, Inc. All rights reserved.
24: *
25: * HISTORY
26: *
27: */
28:
29:
30: #ifndef _IOKIT_APPLEKEYBOARD_H
31: #define _IOKIT_APPLEKEYBOARD_H
32:
33: #include <IOKit/IOLib.h>
34: #include <IOKit/IOService.h>
35:
36: #include <IOKit/usb/IOUSBBus.h>
37: #include <IOKit/usb/IOUSBDevice.h>
38: #include <IOKit/usb/USB.h>
39: #include <IOKit/hidsystem/IOHIKeyboard.h>
40: #include <IOKit/IOBufferMemoryDescriptor.h>
41:
42: enum {
43: kUSB_LEFT_CONTROL_BIT = 0x01,
44: kUSB_LEFT_SHIFT_BIT = 0x02,
45: kUSB_LEFT_ALT_BIT = 0x04,
46: kUSB_LEFT_FLOWER_BIT = 0x08,
47:
48: kUSB_RIGHT_CONTROL_BIT = 0x10,
49: kUSB_RIGHT_SHIFT_BIT = 0x20,
50: kUSB_RIGHT_ALT_BIT = 0x040,
51: kUSB_RIGHT_FLOWER_BIT = 0x80
52: };
53:
54: enum {
55: kUSB_LOWSPEED_MAXPACKET = 8,
56: kUSB_CAPSLOCKLED_SET = 2,
57: kUSB_NUMLOCKLED_SET = 1
58: };
59:
60: class AppleKeyboard : public IOHIKeyboard
61: {
62: OSDeclareDefaultStructors(AppleKeyboard)
63:
64:
65: IOUSBInterface * _interface;
66: const IOUSBDeviceDescriptor *_deviceDescriptor;
67: IOUSBPipe * _interruptPipe;
68: IOBufferMemoryDescriptor * _buffer;
69: IOUSBCompletion _completion;
70: UInt16 _maxPacketSize;
71: UInt8 _capsLockState;
72: bool _prevent_LED_set;
73: IOUSBDevRequest _request;
74: UInt8 _hid_report[8];
75: bool _flower_key; //Mac Command key
76: bool _control_key; //Control needed for 3-finger reboot
77: UInt8 prev_bytes_read;
78: UInt8 oldmodifier;
79: UInt8 old_array[kUSB_LOWSPEED_MAXPACKET];
80:
81:
82:
83: //A.W. The following 5 methods are required for subclasses of IOHIKeyboard
84: UInt32 maxKeyCodes ( void );
85: const unsigned char * defaultKeymapOfLength (UInt32 * length );
86: UInt32 interfaceID ( void );
87: UInt32 handlerID ( void );
88: UInt32 deviceType ( void );
89:
90: void setLEDFeedback ( UInt8 LED_state);
91:
92:
93:
94: public:
95:
96: UInt8 _ledState;
97: virtual bool start(IOService * provider);
98: virtual void stop(IOService * provider);
99: void setLEDHandler(void * parameter,
100: IOReturn status,
101: UInt32 bufferSizeRemaining);
102: void readHandler(void * parameter,
103: IOReturn status,
104: UInt32 bufferSizeRemaining);
105:
106: void Simulate_ADB_Event(UInt8 *key_ptr, UInt32 bytes_read);
107: void test_myusb_f1(void);
108: void Set_LED_States( UInt8);
109:
110: bool turnLEDon; // used by setAlphaLockFeedback mechanism
111:
112: };
113:
114: #endif _IOKIT_APPLEKEYBOARD_H
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.