문제

All, Thanks in advance for this. I am currently writing a mini-application for OSX in Objective C which reads from a Card Reader and runs against an API.

The Card Reader acts as a HID Device (i.e. Keyboard) and just types. I have setup Register HotKeys in Objective C to listen to keystrokes (i.e. % symbol to start, and ; to end, plus 0-9 numbers). However this listens on all keyboards, meaning the %, ; and 0-9 Keys are useless.

Is there a way in Objective C that you can determine the keyboard used when registering HotKeys, or some way to make this work?

Cheers, Matt

도움이 되었습니까?

해결책

Your best bet is to use the IOHIDManager APIs [1] and subscribe for events for that device. You can set it up to look for the VendorID or for the ProductID of the device, and then have separate responses for each individual device.

[1] http://developer.apple.com/library/mac/#technotes/tn2187/_index.html

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top