AppleUSBProKbd.h   [plain text]


/*
	File:		AppleUSBProKbd.h
	Contains:	Driver for second Apple Pro USB Keyboard interface (multimedia keys)
	Version:	1.0
	Copyright:	 2000 by Apple, all rights reserved.

	File Ownership:

		DRI:				Jason Giles
		Other Contact:		Bob Bradley
		Technology:			Apple Pro Keyboard (USB)

	Writers:

		(JG)	Jason Giles

	Change History (most recent first):
		
		 <2>	 12/4/00	JG		Inherit from IOHIKeyboard. Remove unused member vars.
		 <1>	 7/25/00	JG		First checked in.
*/

// Misc IOKit action.

#include 
#include 
#include 

// HID system includes.

#include 
#include 
#include 

// usb includes.

#include 
#include 
#include 
#include 
#include 

// extra includes.

#include 

//====================================================================================================
//	AppleUSBProKbd
//	Driver for the Apple Pro USB Keyboard's second interface (#1).
//====================================================================================================

class AppleUSBProKbd : public IOHIKeyboard
{
    OSDeclareDefaultStructors(AppleUSBProKbd)

    IOUSBInterface *				mInterface;
    IOUSBPipe *					mInterruptPipe;
    IOBufferMemoryDescriptor *			mReadDataBuffer;
    IOCommandGate *				mGate;

    IOUSBCompletion				mCompletionRoutine;
    HIDPreparsedDataRef				mPreparsedReportDescriptorData;
    
    UInt32					mOutstandingIO;
    
    UInt16					mMaxPacketSize;
    
    Boolean					mSoundUpIsPressed;
    Boolean					mSoundDownIsPressed;
    
    unsigned					mEventFlags;
    bool					mCapsLockOn;
    bool					mNeedToClose;

    // IOService methods
    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 	willTerminate( IOService * provider, IOOptionBits options );
    virtual bool 	didTerminate( IOService * provider, IOOptionBits options, bool * defer );
   
    // IOHIKeyboard methods
    virtual const unsigned char*	defaultKeymapOfLength( UInt32 * length );
    virtual unsigned 			eventFlags();
    virtual bool 			alphaLock();
	
    // Our implementation specific stuff.
    bool	VerifyNewDevice( void );
    void	HandleSpecialButtons( UInt8 *inBufferData, UInt32 bufferSize);
    UInt32	FindKeyboardsAndGetModifiers();
    void	DecrementOutstandingIO(void);
    void	IncrementOutstandingIO(void);
    void 	InterruptReadHandler(IOReturn status, UInt32 bufferSizeRemaining);
    
    // static methods for callbacks and gated calls
    static void 	InterruptReadHandlerEntry(OSObject* inTarget, void *inParameter, IOReturn inStatus, UInt32 inBufferSizeRemaining );
    static IOReturn	ChangeOutstandingIO(OSObject *owner, void *arg0, void *arg1, void *arg2, void *arg3);

};