MacOS虚拟输入设备 [英] MacOS Virtual Input Devices

查看:106
本文介绍了MacOS虚拟输入设备的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何用代码创建虚拟HID设备?我试图避免编写内核扩展来完成此操作,但这似乎是唯一的方法.我需要能够创建所有类型的虚拟HID设备,并有一个在后台运行的应用程序为它们提供事件.有没有办法在用户空间中做到这一点,还是我必须冒险进入内核领域?

How can I create a virtual HID device in code? I'm trying to avoid writing a kernel extension to accomplish this, but it seems to be the only way. I need to be able to create virtual HID devices of all types, and have an app running in the background feed them events. Is there a way to do this in user-space, or must I venture into kernel land?

推荐答案

创建HID设备的典型方法是在IOKit中使用IOHID *类.您可以编写一个userclient来传入和传出事件.

The typical way of creating HID devices is to use the IOHID* classes in IOKit. You can write a userclient that passes events in and out.

我不确定是什么虚拟" HID设备.如果要在屏幕上创建键盘,则可以在用户空间中完成此类操作.

I'm not sure what a "virtual" HID device is, however, I guess. If you want to create a keyboard on the screen, that sort of thing can probably be done in userspace.

这篇关于MacOS虚拟输入设备的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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