来自NSEvent / CGEvent的设备信息 [英] Device Information from NSEvent/CGEvent

查看:252
本文介绍了来自NSEvent / CGEvent的设备信息的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的应用程式使用事件分接器来撷取键盘事件,而且我想知道每个活动来自哪个装置(即哪个键盘)。是否有一种设备识别信息以及水龙头获得的CGEvent?我看过NSEvent的方法和各种CGEventField键,但是它们都不是设备唯一的。任何帮助?

My application uses an event tap to capture keyboard events, and I'd like to know which device (i.e. which keyboard) each event comes from. Is there an sort of device-identifying information along with the CGEvent that a tap gets? I've looked at NSEvent's methods, and the various CGEventField keys, but none of them seem to be device-unique. Any help?

推荐答案

您可能需要看看DDHidLib,Dave Dribin的独特的USB HID设备的优秀框架。

You might want to take a look at DDHidLib, Dave Dribin's excellent framework to work with USB HID devices independently.

http://www.dribin.org/dave/blog/archives/2007/03/19/ddhidlib_10

(不只是关于操纵杆,因此阅读超过该博客文章的第一段)

(not just about joysticks, so read more than the first paragraph of that blog post)

DDHidLib的一些功能在Leopard下不再有效,因为Apple在捕获HID时存在一些安全问题设备,但如果你很幸运,它可能会为你提供你所需要的。

Some of the functionality of DDHidLib no longer works under Leopard, due to some security concerns at Apple regarding capturing an HID device, but if you're lucky it might provide you with what you need.

这篇关于来自NSEvent / CGEvent的设备信息的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆