应用非标准电源断言和创建虚拟 HID
Applying Non-Standard Power Assertions & Creating Virtual HIDs
我在这里有一个很大的问题,但我希望有人能帮助我。如果您认为应该在其他网站上发布此内容,请告诉我。
我是免费应用 Amphetamine for macOS and I'm hoping to add a new feature to the app - keeping a Mac awake while in closed-display (clamshell) mode 的开发者,但没有 keyboard/mouse/power adapter/display 连接到 Mac。我几乎每天都会收到添加此功能的请求。
我一直在研究一个解决方案(并且它基本上已经准备就绪),它使用必须单独下载和安装的非 App Store 帮助应用程序。我仍然可以使用该解决方案,但我想在将单独的应用程序解决方案推向世界之前探索另一种选择。
一位 Amphetamine 用户告诉我另一个应用 AntiSleep can keep a Mac awake while in closed-display mode, while not meeting Apple's requirements。我已经测试了这个说法,这是真的。在深入研究了 AntiSleep 如何实现这一点之后,到目前为止,我已经提出了 2 种可能的理论(尽管可能还有更多):
除了standard power assertion types, it looks like AntiSleep is using (a) private framework(s) to apply non-standard power assertions. The following non-standard power assertion types are active when AntiSleep is keeping a Mac awake: DenySystemSleep, UserIsActive, RequiresDisplayAudio, & InternalPreventDisplaySleep. I haven't been able to find much information on these power assertion types beyond what appears in IOPMLibPrivate.h。我完全不熟悉使用私有框架,但我假设理论上我可以将 IOPMLibPrivate 头文件添加到项目中,然后创建这些电源断言类型。我知道这可能会导致 App Store 对苯丙胺的审核被拒绝,当然。非 App Store 应用程序呢? Apple 会使用这个公证应用程序吗?除此之外,有人可以帮我确认应用这些非标准功率断言的唯一方法是使用私有框架吗?
我怀疑 AntiSleep 也可能正在创建虚拟键盘和鼠标。当然,创建虚拟键盘和鼠标以绕过 Apple 在使用关闭显示模式时将键盘和鼠标连接到 Mac 的要求的想法是一个有趣的想法。经过一番搜索后,我找到了 foohid. However, I ran into all kinds of errors trying to add and use the foohid files in a test project. Would someone be willing to take a look at the foohid 项目并帮助我了解理论上是否可以将此功能包含在与 App Store 兼容的应用程序中? 我不是在寻求代码帮助(还).我只是需要一些帮助来确定是否可以这样做。
提前感谢您的关注。
Would Apple notarize an app using this?
我没有发现使用私有 API 的公证代码有任何问题。目前,Apple 似乎只使用公证来扫描是否包含已知恶意软件。
Would someone be willing to take a look at the foohid project and help me understand whether it is theoretically possible to include this functionality in an App Store compatible app?
快速浏览一下该项目的代码,很明显它实现了内核扩展 (kext)。 App Store 不允许这些。
但是,从 macOS 10.15 Catalina 开始,有一种使用 DriverKit 编写 HID 驱动程序的新方法。这个想法是 API 与内核 API 非常相似,尽管我怀疑它将 kext 重写为 DriverKit 驱动程序,而不是简单的端口。
- DriverKit 驱动程序 允许包含在 App Store 应用程序中。
- 我不知道基于 DriverKit 的 HID 驱动程序是否能解决您的特定电源管理问题。
- 如果您使用 DriverKit 解决方案,这将仅适用于 10.15+。
I suspect that AntiSleep may also be creating a virtual keyboard and mouse.
我没看过 AntiSleep,但我知道除了编写完全的 HID 驱动程序之外,还可以使用用户 space API(例如 IOHIDPostEvent()
)生成 HID 事件。我不知道 App Store 是否允许这些,但据我所知,IOKitLib 通常没问题。
您可能能够使用这些来实现您的虚拟输入设备。
我在这里有一个很大的问题,但我希望有人能帮助我。如果您认为应该在其他网站上发布此内容,请告诉我。
我是免费应用 Amphetamine for macOS and I'm hoping to add a new feature to the app - keeping a Mac awake while in closed-display (clamshell) mode 的开发者,但没有 keyboard/mouse/power adapter/display 连接到 Mac。我几乎每天都会收到添加此功能的请求。
我一直在研究一个解决方案(并且它基本上已经准备就绪),它使用必须单独下载和安装的非 App Store 帮助应用程序。我仍然可以使用该解决方案,但我想在将单独的应用程序解决方案推向世界之前探索另一种选择。
一位 Amphetamine 用户告诉我另一个应用 AntiSleep can keep a Mac awake while in closed-display mode, while not meeting Apple's requirements。我已经测试了这个说法,这是真的。在深入研究了 AntiSleep 如何实现这一点之后,到目前为止,我已经提出了 2 种可能的理论(尽管可能还有更多):
除了standard power assertion types, it looks like AntiSleep is using (a) private framework(s) to apply non-standard power assertions. The following non-standard power assertion types are active when AntiSleep is keeping a Mac awake: DenySystemSleep, UserIsActive, RequiresDisplayAudio, & InternalPreventDisplaySleep. I haven't been able to find much information on these power assertion types beyond what appears in IOPMLibPrivate.h。我完全不熟悉使用私有框架,但我假设理论上我可以将 IOPMLibPrivate 头文件添加到项目中,然后创建这些电源断言类型。我知道这可能会导致 App Store 对苯丙胺的审核被拒绝,当然。非 App Store 应用程序呢? Apple 会使用这个公证应用程序吗?除此之外,有人可以帮我确认应用这些非标准功率断言的唯一方法是使用私有框架吗?
我怀疑 AntiSleep 也可能正在创建虚拟键盘和鼠标。当然,创建虚拟键盘和鼠标以绕过 Apple 在使用关闭显示模式时将键盘和鼠标连接到 Mac 的要求的想法是一个有趣的想法。经过一番搜索后,我找到了 foohid. However, I ran into all kinds of errors trying to add and use the foohid files in a test project. Would someone be willing to take a look at the foohid 项目并帮助我了解理论上是否可以将此功能包含在与 App Store 兼容的应用程序中? 我不是在寻求代码帮助(还).我只是需要一些帮助来确定是否可以这样做。
提前感谢您的关注。
Would Apple notarize an app using this?
我没有发现使用私有 API 的公证代码有任何问题。目前,Apple 似乎只使用公证来扫描是否包含已知恶意软件。
Would someone be willing to take a look at the foohid project and help me understand whether it is theoretically possible to include this functionality in an App Store compatible app?
快速浏览一下该项目的代码,很明显它实现了内核扩展 (kext)。 App Store 不允许这些。
但是,从 macOS 10.15 Catalina 开始,有一种使用 DriverKit 编写 HID 驱动程序的新方法。这个想法是 API 与内核 API 非常相似,尽管我怀疑它将 kext 重写为 DriverKit 驱动程序,而不是简单的端口。
- DriverKit 驱动程序 允许包含在 App Store 应用程序中。
- 我不知道基于 DriverKit 的 HID 驱动程序是否能解决您的特定电源管理问题。
- 如果您使用 DriverKit 解决方案,这将仅适用于 10.15+。
I suspect that AntiSleep may also be creating a virtual keyboard and mouse.
我没看过 AntiSleep,但我知道除了编写完全的 HID 驱动程序之外,还可以使用用户 space API(例如 IOHIDPostEvent()
)生成 HID 事件。我不知道 App Store 是否允许这些,但据我所知,IOKitLib 通常没问题。
您可能能够使用这些来实现您的虚拟输入设备。