Re: Cocoa multithreading in C (terrible idea, isn't it?)
Re: Cocoa multithreading in C (terrible idea, isn't it?)
- Subject: Re: Cocoa multithreading in C (terrible idea, isn't it?)
- From: Steve Checkoway <email@hidden>
- Date: Mon, 26 Dec 2005 12:33:39 -0800
On Dec 21, 2005, at 4:20 AM, Christos Papachristou wrote:
How did you manage to capture the HID events in your app?
This isn't terribly hard to do but the documentation could use a lot
of work. You use the IOKit.
IOServiceMatching(kIOHIDDeviceKey);
CFDictionarySetValue( dict, CFSTR(kIOHIDPrimaryUsagePageKey),
usagePageRef );
CFDictionarySetValue( dict, CFSTR(kIOHIDPrimaryUsageKey), usageRef );
IOServiceGetMatchingServices(...);
Iterate over the devices, check out the elements of the HID device
then create some interfaces and queues:
IOCreatePlugInInterfaceForService(..., &plugInInterface, ...);
(*plugInInterface)->QueryInterface(plugInInterface, ..., &interface);
(*interface)->open(interface);
queue = (*interface)->allocQueue(interface);
(*queue)->create(queue);
Then, for the elements you want, you add them to the queue:
(*queue)->addElement(...);
Lastly, you start the queue on a particular run loop:
(*queue)->createAsyncEventSource(queue, &runLoopSource);
CFRunLoopAddSource(runLoop, runLoopSource, mode);
(*queue)->setEventCallout(queue, callback, target, refCon);
(*queue)->start(queue);
- Steve
Attachment:
smime.p7s
Description: S/MIME cryptographic signature
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden