• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Cocoa multithreading in C (terrible idea, isn't it?)
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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
References: 
 >Cocoa multithreading in C (terrible idea, isn't it?) (From: Christos Papachristou <email@hidden>)
 >Re: Cocoa multithreading in C (terrible idea, isn't it?) (From: John Stiles <email@hidden>)
 >Re: Cocoa multithreading in C (terrible idea, isn't it?) (From: Shaun Wexler <email@hidden>)
 >Re: Cocoa multithreading in C (terrible idea, isn't it?) (From: Christos Papachristou <email@hidden>)

  • Prev by Date: Re: NSTitlebar?
  • Next by Date: Re: customizing save behavior in doc based apps
  • Previous by thread: Re: Cocoa multithreading in C (terrible idea, isn't it?)
  • Next by thread: Add a close button in NSTabViewItem
  • Index(es):
    • Date
    • Thread