适用于 OS X 的虚拟 HID 键盘
我正在尝试为 Mac OS 创建一个虚拟蓝牙键盘客户端。这意味着我的 Mac 将充当 BT KB。我读到了 OS X 中的蓝牙 API(在 ObjC 中),并且我还找到了适用于 Mac 的 HID API(在 C 中)
为了使这项工作正常进行,我知道我需要声明一个应该在 SDP 查询上广播的 hid-keyboard-service 。
- 如果我使用 HID API 声明 HID 服务,我的服务是否也在蓝牙上可见/广播? (这些文档似乎仅针对 USB 提及 HID)。 - HID 服务在蓝牙和 USB 接口上都可见,并且底层连接对我来说是透明的吗?
- 您知道有什么代码可以帮助我解决这个问题吗?我更喜欢 ObjC,但似乎 HID API 仅限于 C...:(
谢谢...!
I'm trying to create a virtual bluetooth keyboard client for Mac OS. that means my Mac will serve as a BT KB. I read about the bluetooth API in OS X (in ObjC), and I also found an HID API for Mac (in C)
To make this work I understand I need to declare an hid-keyboard-service that should be broadcasted on SDP queries.
- if I declare an HID service using the HID API, is my service visible/broadcasted on Bluetooth too? (the documents seems to refer to HID with regards to USB only). - are HID services visible on both bluetooth and USB interfaces, and the underlaying connection is transparent to me?
- is there any code that will help me with this you know about? I prefer ObjC, but it seems HID API is C only... :(
Thanks...!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
据我了解,HID 设备驱动程序代表操作系统本地的设备,也代表操作系统本地的各种其他组件的设备。它不用于在 USB 或蓝牙上“广播”。据我所知,OS X 不包含蓝牙 HID 服务,OS X 和 Mac 中的 USB 芯片组都不支持 USB 设备模式——或者至少不公开它。
您将需要编写一个蓝牙服务。我还没有这样做,但是文档< /a> 似乎很广泛。据我了解,您必须以某种方式基于底层蓝牙 L2CAP 传输协议来实现 HID 服务。
由于我既没有研究过蓝牙,也没有研究过Mac下的蓝牙支持,所以我无法提供更多帮助。我确实查看了 HID 协议规范,甚至还使用了它们。 HID 的实现相对简单,但首先要实现蓝牙服务需要做大量工作。
As far as I understand it, a HID device driver represents a device locally to the OS, and by the OS, to various other components. It is not used to "broadcast" on USB nor on Bluetooth. As far as I know, OS X does not include a Bluetooth HID service, and neither does OS X nor the USB chipsets in Macs support USB device mode -- or at least they do not expose it.
You will want to write a Bluetooth service. I have not done that, but the documentation seems extensive. From what I understand, you would somehow have to implement your HID service based on the underlying Bluetooth L2CAP transmission protocol.
Since I have studied neither Bluetooth, nor Bluetooth support under Mac, I am unable to provide any more help. I did take a look at HID protocol specs, and even played with them. HID is relatively trivial to implement, but there will be quite a bit of work on implementing the Bluetooth service first.
Linux 上似乎也有类似的工具,并且可能有可用的源代码。请参阅此帖子获取链接。
It seems similar tools exist for linux and may have usable source code. See this thread for links.