IOHIDLibUserClient.h [plain text]
#ifndef _IOKIT_IOHIDLibUserClient_H_
#define _IOKIT_IOHIDLibUserClient_H_
#include "IOHIDKeys.h"
enum IOHIDLibUserClientMemoryTypes {
IOHIDLibUserClientElementValuesType = 0
};
enum IOHIDLibUserClientAsyncCommandCodes {
kIOHIDLibUserClientSetAsyncPort, kIOHIDLibUserClientSetQueueAsyncPort, kIOHIDLibUserClientAsyncGetReport, kIOHIDLibUserClientAsyncSetReport,
kIOHIDLibUserClientNumAsyncCommands
};
enum IOHIDLibUserClientCommandCodes {
kIOHIDLibUserClientOpen, kIOHIDLibUserClientClose, kIOHIDLibUserClientCreateQueue, kIOHIDLibUserClientDisposeQueue, kIOHIDLibUserClientAddElementToQueue, kIOHIDLibUserClientRemoveElementFromQueue, kIOHIDLibUserClientQueueHasElement, kIOHIDLibUserClientStartQueue, kIOHIDLibUserClientStopQueue, kIOHIDLibUserClientUpdateElementValue, kIOHIDLibUserClientPostElementValue, kIOHIDLibUserClientGetReport, kIOHIDLibUserClientGetReportOOL, kIOHIDLibUserClientSetReport, kIOHIDLibUserClientSetReportOOL,
kIOHIDLibUserClientNumCommands
};
#if 0
struct IOHIDCommandExecuteData {
HIDInfo HIDInfo;
HIDResults *HIDResults;
int kernelHandle;
int sgEntries;
UInt32 timeoutMS;
IOVirtualRange sgList[0];
};
#define kIOHIDCommandExecuteDataMaxSize 1024
#endif
struct IOHIDElementValue
{
IOHIDElementCookie cookie;
UInt32 totalSize;
AbsoluteTime timestamp;
UInt32 generation;
UInt32 value[1];
};
struct IOHIDReportReq
{
IOHIDReportType reportType;
UInt32 reportID;
void *reportBuffer;
UInt32 reportBufferSize;
};
#if KERNEL
#include <mach/mach_types.h>
#include <IOKit/IOUserClient.h>
class IOHIDDevice;
class IOSyncer;
#if 0
class IOCommandGate;
struct HIDResults;
#endif
class IOHIDLibUserClient : public IOUserClient
{
OSDeclareDefaultStructors(IOHIDLibUserClient)
protected:
static const IOExternalMethod
sMethods[kIOHIDLibUserClientNumCommands];
static const IOExternalAsyncMethod
sAsyncMethods[kIOHIDLibUserClientNumAsyncCommands];
IOHIDDevice *fNub;
IOCommandGate *fGate;
task_t fClient;
mach_port_t fWakePort;
mach_port_t fQueuePort;
bool fNubIsTerminated;
IOOptionBits fCachedOptionBits;
virtual bool
initWithTask(task_t owningTask, void *security_id, UInt32 type);
virtual IOReturn clientClose(void);
virtual bool start(IOService *provider);
virtual IOExternalMethod *
getTargetAndMethodForIndex(IOService **target, UInt32 index);
virtual IOExternalAsyncMethod *
getAsyncTargetAndMethodForIndex(IOService **target, UInt32 index);
virtual IOReturn setAsyncPort(OSAsyncReference asyncRef,
void *, void *, void *,
void *, void *, void *);
virtual IOReturn setQueueAsyncPort(OSAsyncReference asyncRef,
void *vInQueue, void *, void *,
void *, void *, void *);
virtual IOReturn open(void * flags, void *, void *,
void *, void *, void *);
virtual IOReturn close(void * = 0, void * = 0, void * = 0,
void * = 0, void * = 0, void *gated = 0);
virtual bool didTerminate(IOService *provider, IOOptionBits options, bool *defer);
virtual bool requestTerminate( IOService * provider, IOOptionBits options );
virtual void free();
virtual IOReturn clientMemoryForType(
UInt32 type,
IOOptionBits * options,
IOMemoryDescriptor ** memory );
virtual IOReturn createQueue(void * vInFlags, void * vInDepth, void * vOutQueue,
void *, void *, void * gated);
virtual IOReturn disposeQueue(void * vInQueue, void *, void *,
void *, void *, void * gated);
virtual IOReturn addElementToQueue(void * vInQueue, void * vInElementCookie,
void * vInFlags, void *, void *, void * gated);
virtual IOReturn removeElementFromQueue (void * vInQueue, void * vInElementCookie,
void *, void *, void *, void * gated);
virtual IOReturn queueHasElement (void * vInQueue, void * vInElementCookie,
void * vOutHasElement, void *, void *, void * gated);
virtual IOReturn startQueue (void * vInQueue, void *, void *,
void *, void *, void * gated);
virtual IOReturn stopQueue (void * vInQueue, void *, void *,
void *, void *, void * gated);
virtual IOReturn updateElementValue (void *cookie, void *, void *,
void *, void *, void *);
virtual IOReturn postElementValue (void *cookie, void *, void *,
void *, void *, void *);
virtual IOReturn getReport (IOHIDReportType reportType,
UInt32 reportID,
void *reportBuffer,
UInt32 *reportBufferSize);
virtual IOReturn getReportOOL( IOHIDReportReq *reqIn,
UInt32 *sizeOut,
IOByteCount inCount,
IOByteCount *outCount);
virtual IOReturn setReport (IOHIDReportType reportType,
UInt32 reportID,
void *reportBuffer,
UInt32 reportBufferSize);
virtual IOReturn setReportOOL (IOHIDReportReq *req, IOByteCount inCount);
virtual IOReturn asyncGetReport (OSAsyncReference asyncRef,
IOHIDReportType reportType,
UInt32 reportID,
void *reportBuffer,
UInt32 reportBufferSize,
UInt32 completionTimeOutMS);
virtual IOReturn asyncSetReport (OSAsyncReference asyncRef,
IOHIDReportType reportType,
UInt32 reportID,
void *reportBuffer,
UInt32 reportBufferSize,
UInt32 completionTimeOutMS);
protected:
static IOReturn closeAction
(OSObject *self, void *, void *, void *, void *);
static void ReqComplete(void *obj, void *param, IOReturn status, UInt32 remaining);
};
#endif
#endif