Chameleon

Chameleon Svn Source Tree

Root/branches/rewrite/i386/include/IOKit/bluetooth/IOBluetoothHIDDriver.h

Source at commit 1129 created 12 years 11 months ago.
By meklort, Change options.o so that it reloads the system config as well. Also change it so that it uses that config for variables (NOTE: if the calue exists in chameleonConfig, it's used instead.
1/*
2File:IOBluetoothHIDDriver.h
3Contains:Driver for generic Bluetooth HID devices.
4Copyright:(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
17class IOTimerEventSource;
18class IOWorkLoop;
19
20class IOBluetoothL2CAPChannel;
21class IOBluetoothDevice;
22class IOWorkQueue;
23
24//===========================================================================================================================
25// IOBluetoothHIDDriver
26//===========================================================================================================================
27
28class IOBluetoothHIDDriver : public IOHIDDevice
29{
30OSDeclareDefaultStructors( IOBluetoothHIDDriver )
31
32 IOWorkLoop*_workLoop;
33IOCommandGate*_commandGate;
34
35IOWorkQueue*_desyncWorkQueue;
36
37IOBluetoothL2CAPChannel*_controlChannel;
38 IOBluetoothL2CAPChannel*_interruptChannel;
39
40 IOBluetoothDevice*_device;
41
42IOMemoryDescriptor*_memDescriptor;
43IOMemoryDescriptor*_getReportDescriptor;
44IONotifier*_interruptOpenNotification;
45IOTimerEventSource*_timer;
46 IONotifier*_sleepWakeNotifier;
47
48bool_deviceReady;
49
50UInt8_expectedReportID;
51UInt8_expectedReportType;
52UInt8_handshake;
53
54OSDictionary*_deviceProperties;
55
56UInt16_vendorIDSource;
57UInt16_vendorID;
58UInt16_productID;
59UInt16_deviceVersion;
60uint32_t_classOfDevice;
61 UInt16 _countryCode;
62
63BluetoothDeviceAddress_deviceAddress;
64char_deviceAddressString[20];
65
66uint32_t_outstandingIO;
67bool_sendOutstanding;
68
69// Debug / Behavior Modifiers
70UInt8_verboseLevel;
71bool_logPackets;
72bool_decodePackets;
73bool_logOutstandingIO;
74bool_suppressDisconnectNotifications;
75bool_suppressSetProtocol;
76bool_driverIsAwake;
77bool_reservedFlag4;
78UInt8_reservedByte;
79
80 struct ExpansionData
81 {
82 OSArray* _sendQueue;
83
84uint8_t*interruptBuffer;
85uint32_tinterruptBufferUsed;
86
87uint8_t*controlBuffer;
88uint32_tcontrolBufferUsed;
89
90uint8_tdeviceSupportsSuspend;
91
92uint32_tgetReportTimeoutMS;
93uint32_tsetReportTimeoutMS;
94
95uint32_toutstandingMemoryBlockCount;
96boolwaitingForMemoryBlockCount;
97 };
98 ExpansionData*_expansionData;
99
100public:
101// Standard IOService Methods
102 virtual IOService* probe( IOService * provider, SInt32 * score );
103virtual boolinit( OSDictionary *properties );
104virtual voidfree();
105virtual bool willTerminate( IOService * provider, IOOptionBits options );
106
107// Starting & Stopping
108 virtual boolhandleStart( IOService * provider );
109 virtual voidhandleStop( IOService * provider );
110virtual voiddeviceReady();
111virtual voidcloseDownServices();
112
113// Power Management
114 virtual voidhandleSleep();
115 virtual voidhandleWake();
116 virtual voidhandleShutdown();// Does nothing
117 virtual voidhandleRestart();// Does nothing
118
119// HID Properties
120virtual OSString*newTransportString() const;
121virtual OSString*newManufacturerString() const;
122virtual OSString*newProductString() const;
123virtual OSNumber*newVendorIDSourceNumber() const;
124virtual OSNumber*newVendorIDNumber() const;
125virtual OSNumber*newProductIDNumber() const;
126virtual OSNumber*newVersionNumber() const;
127 virtual IOReturnnewReportDescriptor( IOMemoryDescriptor ** descriptor ) const;
128virtual OSString*newSerialNumberString() const;
129virtual OSNumber*newLocationIDNumber() const;
130 virtual OSNumber*newCountryCodeNumber() const;
131virtual OSNumber*newReportIntervalNumber() const;
132
133// Main UserLand Entry Points
134 virtual IOReturngetReport( IOMemoryDescriptor* report, IOHIDReportType reportType, IOOptionBits options = 0 );
135 virtual IOReturn setReport( IOMemoryDescriptor* report, IOHIDReportType reportType, IOOptionBits options = 0 );
136 virtual IOReturnsetProperties( OSObject* properties );
137
138// General IO
139virtual IOReturnsendData( IOBluetoothL2CAPChannel* theChannel, void* theData, IOByteCount theSize );
140 virtual voidprocessControlData( UInt8 *buffer, UInt16 length );
141 virtual voidprocessInterruptData( UInt8 *buffer, UInt16 length );
142virtual IOReturnwaitForData( IOMemoryDescriptor* report, UInt8 btReportType, UInt8 reportID );
143virtual IOReturnwaitForHandshake();
144
145// HID Transaction Methods
146virtual IOReturnhidControl( UInt8 controlOperation );
147virtual intgetProtocol();
148virtual IOReturnsetProtocol( UInt8 protocol );
149virtual intgetIdle();
150virtual IOReturnsetIdle( UInt8 idleRate );
151
152// Device Introspection
153virtual boolisKeyboard();
154virtual boolisMouse();
155
156// Misc
157virtual IOReturnsetPowerState( unsigned long powerStateOrdinal, IOService* whatDevice );
158virtual IOReturncreateCommandGate( IOService* provider );
159virtual IOReturngetDeviceProperties( IOService* provider );
160virtualboolreadDeviceName();
161
162// Command Gate Actions
163staticIOReturnstaticCloseDownServicesAction( OSObject* owner, void* arg1, void* arg2, void* arg3, void* arg4 );
164staticIOReturnstaticSendToAction( OSObject* owner, void* theChannel, void* theData, void *theSize, void* );
165staticIOReturnstaticPrepControlChannelAction( OSObject* owner, void* arg1, void* arg2, void* arg3, void* arg4 );
166staticIOReturnstaticPrepInterruptChannelAction( OSObject* owner, void* arg1, void* arg2, void* arg3, void* arg4 );
167staticIOReturnstaticGetReportAction( OSObject* owner, void* arg1, void* arg2, void* arg3, void* arg4 );
168staticIOReturnstaticSetReportAction( OSObject* owner, void* arg1, void* arg2, void* arg3, void* arg4 );
169staticIOReturnstaticProcessCommandAction( OSObject* owner, void* arg1, void* arg2, void* arg3, void* arg4 );
170staticIOReturnstaticGetDevicePropertiesAction( OSObject* owner, void* arg1, void* arg2, void* arg3, void* arg4 );
171staticIOReturnstaticInterruptChannelOpeningAction( OSObject* owner, void* newService, void* arg2, void* arg3, void* arg4 );
172staticIOReturnstaticWillTerminateAction( OSObject* owner, void* arg1, void* arg2, void* arg3, void* arg4 );
173
174// Work Loop Methods
175virtual voidcloseDownServicesWL();
176virtual IOReturnprepInterruptChannelWL();
177virtual IOReturngetReportWL( IOMemoryDescriptor* report, IOHIDReportType reportType, IOOptionBits options );
178virtual IOReturnsetReportWL( IOMemoryDescriptor* report, IOHIDReportType reportType, IOOptionBits options );
179virtual IOReturnprocessCommandWL( OSString* command, OSNumber* commandParameter );
180virtual IOReturngetDevicePropertiesWL( IOService* provider );
181virtual IOReturninterruptChannelOpeningWL( IOBluetoothL2CAPChannel* theChannel );
182
183// Timeout Handler
184staticvoidtimerFired( OSObject* owner, IOTimerEventSource* sender );
185virtual voidhandleTimeout();
186
187// IO Counting
188virtual voidincrementOutstandingIO();
189virtual voiddecrementOutstandingIO();
190
191private:
192// Lazy Interrupt Channel Methods
193staticboolinterruptChannelOpeningCallback(void* me, void* ignoreMe, IOService* newService, IONotifier *notifier );
194 staticIOReturn powerStateHandler( void *target, void *refCon, UInt32 messageType, IOService *service, void *messageArgument, vm_size_t argSize );
195
196public:
197 OSMetaClassDeclareReservedUsed( IOBluetoothHIDDriver, 0 );
198 virtual void sendDeviceDisconnectNotifications( void );
199
200OSMetaClassDeclareReservedUsed( IOBluetoothHIDDriver, 1 );
201virtual IOReturnsetPowerStateWL( unsigned long powerStateOrdinal, IOService* whatDevice );
202
203OSMetaClassDeclareReservedUsed( IOBluetoothHIDDriver, 2 );
204 virtual void sendDeviceConnectNotifications( void );
205
206OSMetaClassDeclareReservedUsed( IOBluetoothHIDDriver, 3 );
207 virtual void decrementOutstandingMemoryBlockCount( void );
208
209OSMetaClassDeclareReservedUsed( IOBluetoothHIDDriver, 4 );
210 virtual IOReturn willTerminateWL( void );
211
212public:
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

Archive Download this file

Revision: 1129