Root/
Source at commit 1460 created 12 years 10 months ago. By azimutz, rsync contents of the theme's folder, not the folder it self. | |
---|---|
1 | /*␊ |
2 | ␉File:␉␉IOBluetoothHIDDriver.h␊ |
3 | ␉Contains:␉Driver for generic Bluetooth HID devices.␊ |
4 | ␉Copyright:␉(c) 2001-2008 by Apple, all rights reserved.␊ |
5 | */␊ |
6 | ␊ |
7 | #ifndef IOBLUETOOTHHIDDRIVER_H␊ |
8 | #define IOBLUETOOTHHIDDRIVER_H␊ |
9 | ␊ |
10 | #include <IOKit/hid/IOHIDDevice.h>␊ |
11 | #include <IOKit/bluetooth/Bluetooth.h>␊ |
12 | ␊ |
13 | //===========================================================================================================================␊ |
14 | // Forwards␊ |
15 | //===========================================================================================================================␊ |
16 | ␊ |
17 | class IOTimerEventSource;␊ |
18 | class IOWorkLoop;␊ |
19 | ␊ |
20 | class IOBluetoothL2CAPChannel;␊ |
21 | class IOBluetoothDevice;␊ |
22 | class IOWorkQueue;␊ |
23 | ␊ |
24 | //===========================================================================================================================␊ |
25 | // IOBluetoothHIDDriver␊ |
26 | //===========================================================================================================================␊ |
27 | ␊ |
28 | class IOBluetoothHIDDriver : public IOHIDDevice␊ |
29 | {␊ |
30 | ␉OSDeclareDefaultStructors( IOBluetoothHIDDriver )␊ |
31 | ␊ |
32 | IOWorkLoop*␉␉␉␉␉_workLoop;␊ |
33 | ␉IOCommandGate*␉␉␉␉_commandGate;␊ |
34 | ␉␊ |
35 | ␉IOWorkQueue␉␉␉␉␉*_desyncWorkQueue;␊ |
36 | ␉␊ |
37 | ␉IOBluetoothL2CAPChannel*␉_controlChannel;␊ |
38 | IOBluetoothL2CAPChannel*␉_interruptChannel;␊ |
39 | ␊ |
40 | IOBluetoothDevice*␉␉␉_device;␊ |
41 | ␊ |
42 | ␉IOMemoryDescriptor*␉␉␉_memDescriptor;␊ |
43 | ␉IOMemoryDescriptor*␉␉␉_getReportDescriptor;␊ |
44 | ␉IONotifier*␉␉␉␉␉_interruptOpenNotification;␊ |
45 | ␉IOTimerEventSource*␉␉␉_timer;␊ |
46 | IONotifier*␉␉␉␉␉_sleepWakeNotifier;␊ |
47 | ␊ |
48 | ␉bool␉␉␉␉␉␉_deviceReady;␊ |
49 | ␊ |
50 | ␉UInt8␉␉␉␉␉␉_expectedReportID;␊ |
51 | ␉UInt8␉␉␉␉␉␉_expectedReportType;␊ |
52 | ␉UInt8␉␉␉␉␉␉_handshake;␊ |
53 | ␉␊ |
54 | ␉OSDictionary*␉␉␉␉_deviceProperties;␊ |
55 | ␊ |
56 | ␉UInt16␉␉␉␉␉␉_vendorIDSource;␊ |
57 | ␉UInt16␉␉␉␉␉␉_vendorID;␊ |
58 | ␉UInt16␉␉␉␉␉␉_productID;␊ |
59 | ␉UInt16␉␉␉␉␉␉_deviceVersion;␊ |
60 | ␉uint32_t␉␉␉␉␉_classOfDevice;␊ |
61 | UInt16 _countryCode;␊ |
62 | ␉␊ |
63 | ␉BluetoothDeviceAddress␉␉_deviceAddress;␊ |
64 | ␉char␉␉␉␉␉␉_deviceAddressString[20];␊ |
65 | ␉␊ |
66 | ␉uint32_t␉␉␉␉␉_outstandingIO;␊ |
67 | ␉bool␉␉␉␉␉␉_sendOutstanding;␊ |
68 | ␉␊ |
69 | ␉// Debug / Behavior Modifiers␊ |
70 | ␉UInt8␉␉␉␉␉␉_verboseLevel;␊ |
71 | ␉bool␉␉␉␉␉␉_logPackets;␊ |
72 | ␉bool␉␉␉␉␉␉_decodePackets;␊ |
73 | ␉bool␉␉␉␉␉␉_logOutstandingIO;␊ |
74 | ␉bool␉␉␉␉␉␉_suppressDisconnectNotifications;␊ |
75 | ␉bool␉␉␉␉␉␉_suppressSetProtocol;␊ |
76 | ␉bool␉␉␉␉␉␉_driverIsAwake;␊ |
77 | ␉bool␉␉␉␉␉␉_reservedFlag4;␊ |
78 | ␉UInt8␉␉␉␉␉␉_reservedByte;␊ |
79 | ␉␊ |
80 | struct ExpansionData ␊ |
81 | { ␊ |
82 | OSArray* _sendQueue;␊ |
83 | ␉␉␊ |
84 | ␉␉uint8_t␉␉*interruptBuffer;␊ |
85 | ␉␉uint32_t␉interruptBufferUsed;␊ |
86 | ␉␉␊ |
87 | ␉␉uint8_t␉␉*controlBuffer;␊ |
88 | ␉␉uint32_t␉controlBufferUsed;␊ |
89 | ␊ |
90 | ␉␉uint8_t␉␉deviceSupportsSuspend;␊ |
91 | ␊ |
92 | ␉␉uint32_t␉getReportTimeoutMS;␊ |
93 | ␉␉uint32_t␉setReportTimeoutMS;␊ |
94 | ␉␉␊ |
95 | ␉␉uint32_t␉outstandingMemoryBlockCount;␊ |
96 | ␉␉bool␉␉waitingForMemoryBlockCount;␊ |
97 | };␊ |
98 | ExpansionData␉*_expansionData;␊ |
99 | ␉␊ |
100 | public:␊ |
101 | ␉// Standard IOService Methods␊ |
102 | virtual IOService* probe( IOService * provider, SInt32 * score );␊ |
103 | ␉virtual bool␉␉init( OSDictionary *properties );␊ |
104 | ␉virtual void␉␉free();␊ |
105 | ␉virtual bool ␉␉willTerminate( IOService * provider, IOOptionBits options );␊ |
106 | ␉␊ |
107 | ␉// Starting & Stopping␊ |
108 | virtual bool␉␉handleStart( IOService * provider );␊ |
109 | virtual void␉␉handleStop( IOService * provider );␊ |
110 | ␉virtual void␉␉deviceReady();␊ |
111 | ␉virtual void␉␉closeDownServices();␊ |
112 | ␊ |
113 | ␉// Power Management␊ |
114 | virtual void␉␉handleSleep();␊ |
115 | virtual void␉␉handleWake();␊ |
116 | virtual void␉␉handleShutdown();␉␉␉// Does nothing␊ |
117 | virtual void␉␉handleRestart();␉␉␉// Does nothing␊ |
118 | ␉␊ |
119 | ␉// HID Properties␊ |
120 | ␉virtual OSString*␉newTransportString() const;␊ |
121 | ␉virtual OSString*␉newManufacturerString() const;␊ |
122 | ␉virtual OSString*␉newProductString() const;␊ |
123 | ␉virtual OSNumber*␉newVendorIDSourceNumber() const;␊ |
124 | ␉virtual OSNumber*␉newVendorIDNumber() const;␊ |
125 | ␉virtual OSNumber*␉newProductIDNumber() const;␊ |
126 | ␉virtual OSNumber*␉newVersionNumber() const;␊ |
127 | virtual IOReturn␉newReportDescriptor( IOMemoryDescriptor ** descriptor ) const;␊ |
128 | ␉virtual OSString*␉newSerialNumberString() const;␊ |
129 | ␉virtual OSNumber*␉newLocationIDNumber() const;␊ |
130 | virtual OSNumber*␉newCountryCodeNumber() const;␊ |
131 | ␉virtual OSNumber*␉newReportIntervalNumber() const;␊ |
132 | ␊ |
133 | ␉// Main UserLand Entry Points␊ |
134 | virtual IOReturn␉getReport( IOMemoryDescriptor* report, IOHIDReportType reportType, IOOptionBits options = 0 );␊ |
135 | virtual IOReturn ␉setReport( IOMemoryDescriptor* report, IOHIDReportType reportType, IOOptionBits options = 0 );␊ |
136 | virtual IOReturn␉setProperties( OSObject* properties );␊ |
137 | ␊ |
138 | ␉// General IO␊ |
139 | ␉virtual IOReturn␉sendData( IOBluetoothL2CAPChannel* theChannel, void* theData, IOByteCount theSize );␊ |
140 | virtual void␉␉processControlData( UInt8 *buffer, UInt16 length );␊ |
141 | virtual void␉␉processInterruptData( UInt8 *buffer, UInt16 length );␊ |
142 | ␉virtual IOReturn␉waitForData( IOMemoryDescriptor* report, UInt8 btReportType, UInt8 reportID );␊ |
143 | ␉virtual IOReturn␉waitForHandshake();␊ |
144 | ␉␊ |
145 | ␉// HID Transaction Methods␊ |
146 | ␉virtual IOReturn␉hidControl( UInt8 controlOperation );␊ |
147 | ␉virtual int␉␉␉getProtocol();␊ |
148 | ␉virtual IOReturn␉setProtocol( UInt8 protocol );␊ |
149 | ␉virtual int␉␉␉getIdle();␊ |
150 | ␉virtual IOReturn␉setIdle( UInt8 idleRate );␊ |
151 | ␊ |
152 | ␉// Device Introspection␊ |
153 | ␉virtual bool␉␉isKeyboard();␊ |
154 | ␉virtual bool␉␉isMouse();␊ |
155 | ␉␊ |
156 | ␉// Misc␊ |
157 | ␉virtual IOReturn␉setPowerState( unsigned long powerStateOrdinal, IOService* whatDevice );␊ |
158 | ␉virtual IOReturn␉createCommandGate( IOService* provider );␊ |
159 | ␉virtual IOReturn␉getDeviceProperties( IOService* provider );␊ |
160 | ␉virtual␉bool␉␉readDeviceName();␊ |
161 | ␉␊ |
162 | ␉// Command Gate Actions␊ |
163 | ␉static␉IOReturn␉staticCloseDownServicesAction( OSObject* owner, void* arg1, void* arg2, void* arg3, void* arg4 );␊ |
164 | ␉static␉IOReturn␉staticSendToAction( OSObject* owner, void* theChannel, void* theData, void *theSize, void* );␊ |
165 | ␉static␉IOReturn␉staticPrepControlChannelAction( OSObject* owner, void* arg1, void* arg2, void* arg3, void* arg4 );␊ |
166 | ␉static␉IOReturn␉staticPrepInterruptChannelAction( OSObject* owner, void* arg1, void* arg2, void* arg3, void* arg4 );␊ |
167 | ␉static␉IOReturn␉staticGetReportAction( OSObject* owner, void* arg1, void* arg2, void* arg3, void* arg4 );␊ |
168 | ␉static␉IOReturn␉staticSetReportAction( OSObject* owner, void* arg1, void* arg2, void* arg3, void* arg4 );␊ |
169 | ␉static␉IOReturn␉staticProcessCommandAction( OSObject* owner, void* arg1, void* arg2, void* arg3, void* arg4 );␊ |
170 | ␉static␉IOReturn␉staticGetDevicePropertiesAction( OSObject* owner, void* arg1, void* arg2, void* arg3, void* arg4 );␊ |
171 | ␉static␉IOReturn␉staticInterruptChannelOpeningAction( OSObject* owner, void* newService, void* arg2, void* arg3, void* arg4 );␊ |
172 | ␉static␉IOReturn␉staticWillTerminateAction( OSObject* owner, void* arg1, void* arg2, void* arg3, void* arg4 );␊ |
173 | ␉␊ |
174 | ␉// Work Loop Methods␊ |
175 | ␉virtual void␉␉closeDownServicesWL();␊ |
176 | ␉virtual IOReturn␉prepInterruptChannelWL();␊ |
177 | ␉virtual IOReturn␉getReportWL( IOMemoryDescriptor* report, IOHIDReportType reportType, IOOptionBits options );␊ |
178 | ␉virtual IOReturn␉setReportWL( IOMemoryDescriptor* report, IOHIDReportType reportType, IOOptionBits options );␊ |
179 | ␉virtual IOReturn␉processCommandWL( OSString* command, OSNumber* commandParameter );␊ |
180 | ␉virtual IOReturn␉getDevicePropertiesWL( IOService* provider );␊ |
181 | ␉virtual IOReturn␉interruptChannelOpeningWL( IOBluetoothL2CAPChannel* theChannel );␊ |
182 | ␊ |
183 | ␉// Timeout Handler␊ |
184 | ␉static␉void␉␉timerFired( OSObject* owner, IOTimerEventSource* sender );␊ |
185 | ␉virtual void␉␉handleTimeout();␊ |
186 | ␉␊ |
187 | ␉// IO Counting␊ |
188 | ␉virtual void␉␉incrementOutstandingIO();␊ |
189 | ␉virtual void␉␉decrementOutstandingIO();␊ |
190 | ␉␊ |
191 | private:␊ |
192 | ␉// Lazy Interrupt Channel Methods␊ |
193 | ␉static␉bool␉␉interruptChannelOpeningCallback(␉void* me, void* ignoreMe, IOService* newService, IONotifier *notifier );␊ |
194 | static␉IOReturn ␉powerStateHandler( void *target, void *refCon, UInt32 messageType, IOService *service, void *messageArgument, vm_size_t argSize );␊ |
195 | ␊ |
196 | public:␊ |
197 | OSMetaClassDeclareReservedUsed( IOBluetoothHIDDriver, 0 );␊ |
198 | virtual void ␉sendDeviceDisconnectNotifications( void );␊ |
199 | ␊ |
200 | ␉OSMetaClassDeclareReservedUsed( IOBluetoothHIDDriver, 1 );␊ |
201 | ␉virtual IOReturn␉␉setPowerStateWL( unsigned long powerStateOrdinal, IOService* whatDevice ); ␊ |
202 | ␊ |
203 | ␉OSMetaClassDeclareReservedUsed( IOBluetoothHIDDriver, 2 );␊ |
204 | virtual void ␉sendDeviceConnectNotifications( void );␊ |
205 | ␊ |
206 | ␉OSMetaClassDeclareReservedUsed( IOBluetoothHIDDriver, 3 );␊ |
207 | virtual void ␉decrementOutstandingMemoryBlockCount( void );␊ |
208 | ␊ |
209 | ␉OSMetaClassDeclareReservedUsed( IOBluetoothHIDDriver, 4 );␊ |
210 | virtual IOReturn ␉willTerminateWL( void );␊ |
211 | ␊ |
212 | public: ␊ |
213 | OSMetaClassDeclareReservedUnused( IOBluetoothHIDDriver, 5 );␊ |
214 | OSMetaClassDeclareReservedUnused( IOBluetoothHIDDriver, 6 );␊ |
215 | OSMetaClassDeclareReservedUnused( IOBluetoothHIDDriver, 7 );␊ |
216 | OSMetaClassDeclareReservedUnused( IOBluetoothHIDDriver, 8 );␊ |
217 | OSMetaClassDeclareReservedUnused( IOBluetoothHIDDriver, 9 );␊ |
218 | OSMetaClassDeclareReservedUnused( IOBluetoothHIDDriver, 10 );␊ |
219 | OSMetaClassDeclareReservedUnused( IOBluetoothHIDDriver, 11 );␊ |
220 | OSMetaClassDeclareReservedUnused( IOBluetoothHIDDriver, 12 );␊ |
221 | OSMetaClassDeclareReservedUnused( IOBluetoothHIDDriver, 13 );␊ |
222 | OSMetaClassDeclareReservedUnused( IOBluetoothHIDDriver, 14 );␊ |
223 | OSMetaClassDeclareReservedUnused( IOBluetoothHIDDriver, 15 );␊ |
224 | OSMetaClassDeclareReservedUnused( IOBluetoothHIDDriver, 16 );␊ |
225 | OSMetaClassDeclareReservedUnused( IOBluetoothHIDDriver, 17 );␊ |
226 | OSMetaClassDeclareReservedUnused( IOBluetoothHIDDriver, 18 );␊ |
227 | OSMetaClassDeclareReservedUnused( IOBluetoothHIDDriver, 19 );␊ |
228 | };␊ |
229 | ␊ |
230 | #endif␉// IOBLUETOOTHHIDDRIVER_H␊ |
231 |