#ifndef _IOKIT_APPLEUSBMOUSE_H
#define _IOKIT_APPLEUSBMOUSE_H
#include <IOKit/IOLib.h>
#include <IOKit/IOService.h>
#include <IOKit/hidsystem/IOHIPointing.h>
#include <IOKit/hidsystem/IOHIDDescriptorParser.h>
#include <IOKit/IOBufferMemoryDescriptor.h>
#include <IOKit/usb/IOUSBBus.h>
#include <IOKit/usb/IOUSBDevice.h>
#include <IOKit/usb/USB.h>
#define kMouseRetryCount 3
class AppleUSBMouse : public IOHIPointing
{
OSDeclareDefaultStructors(AppleUSBMouse)
private:
IOUSBInterface * _interface;
IOUSBDevice * _device;
IOUSBPipe * _interruptPipe;
IOBufferMemoryDescriptor * _buffer;
IOCommandGate * _gate;
IOUSBCompletion _completion;
HIDPreparsedDataRef _preparsedReportDescriptorData;
Bounds _bounds;
IOItemCount _numButtons;
IOFixed _resolution;
thread_call_t _deviceDeadCheckThread;
thread_call_t _clearFeatureEndpointHaltThread;
SInt32 _buttonCollection;
SInt32 _xCollection;
SInt32 _yCollection;
SInt32 _tipPressureCollection;
SInt32 _digitizerButtonCollection;
SInt32 _scrollWheelCollection;
SInt32 _tipPressureMin;
UInt32 _retryCount;
UInt32 _outstandingIO;
SInt16 _tipPressureMax;
UInt16 _maxPacketSize;
bool _absoluteCoordinates;
bool _hasInRangeReport;
bool _deviceDeadThreadActive;
bool _deviceIsDead;
bool _deviceHasBeenDisconnected;
bool _needToClose;
IONotifier * _notifier;
virtual bool init(OSDictionary *properties);
virtual bool start(IOService * provider);
virtual void stop(IOService * provider);
virtual IOReturn message(UInt32 type, IOService * provider, void * argument = 0);
virtual bool finalize(IOOptionBits options);
virtual bool willTerminate( IOService * provider, IOOptionBits options );
virtual bool didTerminate( IOService * provider, IOOptionBits options, bool * defer );
#if 0
virtual bool requestTerminate( IOService * provider, IOOptionBits options );
virtual bool terminate( IOOptionBits options = 0 );
virtual void free( void );
virtual bool terminateClient( IOService * client, IOOptionBits options );
#endif
virtual UInt32 interfaceID(void);
virtual UInt32 deviceType(void);
IOFixed resolution();
IOItemCount buttonCount();
void MoveMouse(UInt8 *mouseData, UInt32 ret_bufsize);
virtual bool parseHIDDescriptor();
void InterruptReadHandler(IOReturn status, UInt32 bufferSizeRemaining);
void CheckForDeadDevice();
void ClearFeatureEndpointHalt(void);
void DecrementOutstandingIO(void);
void IncrementOutstandingIO(void);
static void InterruptReadHandlerEntry(OSObject *target, void *param, IOReturn status, UInt32 bufferSizeRemaining);
static void CheckForDeadDeviceEntry(OSObject *target);
static void ClearFeatureEndpointHaltEntry(OSObject *target);
static IOReturn ChangeOutstandingIO(OSObject *target, void *arg0, void *arg1, void *arg2, void *arg3);
static IOReturn PowerDownHandler(void *target, void *refCon, UInt32 messageType, IOService *service,
void *messageArgument, vm_size_t argSize);
};
#endif _IOKIT_APPLEUSBMOUSE_H