如何在OS X 10.9中编写USB触摸屏驱动程序Kext? [英] How to write usb touchscreen driver kext in os x 10.9?

查看:140
本文介绍了如何在OS X 10.9中编写USB触摸屏驱动程序Kext?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想为USB触摸屏编写一个USB触摸屏小工具。
我已经阅读了内核扩展编程主题和I / O Kit基础知识等,
我的问题是,
1。如何从触摸屏获取输入的报告消息?
2。如何将坐标信息发布到系统?

I want to write a usb touchscreen kext for usb touch screen . I have read the Kernel Extension Programming Topics and the I/O Kit Fundamentals etc, My question is, 1 . how to get the input report messages from touch screen ? 2 . how to post the coordinate info to system ?

我不知道,有人帮助吗?

I have no idea, anybody help?

推荐答案

这取决于硬件;此外,这个问题涉及面很广-您需要在问题中更加具体才能获得更具体的答案。我将尝试提供一个广泛的概述:

It depends on the hardware; moreover, this question is quite broad - you'll need to be more specific in your question to get more specific answers. I'll try to provide a broad overview:

触摸屏有两个部分:


  1. 输出:在显示屏上显示来自计算机的图像

  2. 输入:触摸事件将反馈到计算机中

正如您根本没有问过(1),我假设您的设备只是插入Mac上的显示端口,并且已经正确显示。如果没有,您将要研究 IOFramebuffer API。

As you haven't asked about (1) at all, I assume your device just plugs into a display port on the Mac and is already displaying correctly. If not, you'll want to look into the IOFramebuffer API.

对于(2)-几乎全部USB输入设备是某种形式的 HID 设备。如果您一般不熟悉HID,则可能需要阅读和理解 USB HID规范和相关文档,因为您将在整个过程中使用这些信息。

For (2) - Pretty much all USB input devices are HID devices of some form. If you're new to HID in general, you'll probably want to read and understand the USB HID specification and related documentation as you'll be using that information throughout.

OSX已经提供了对标准HID设备类(如键盘,鼠标,触摸板)的全面支持。 ,图形输入板等。如果您的设备声称是任何一种HID设备,则OSX应该已经在检测该设备并将其通用HID驱动程序附加到该设备上。您应该在I / O注册表中看到 IOUSBHIDDriver 实例(例如,使用Apple的IORegistryExplorer工具,或者在 ioreg 上)。

OSX already comes with comprehensive support for the standard HID device classes such as keyboards, mice, touchpads, graphics tablets, etc. If your device claims to be any kind of HID device, OSX should already be detecting it and attaching its generic HID driver to it. You should see a IOUSBHIDDriver instance in the I/O Registry (eg. using Apple's IORegistryExplorer tool, or ioreg on the command line).

我也希望您的设备符合HID的绝对指针设备配置文件,因此至少一次触摸应该已经可以正常工作。如果它是多点触摸设备,或者您需要其他附加功能,则可能需要实现 IOUSBHIDDriver 子类,该子类生成或转换必要的多点触摸事件。

I'd also expect your device to conform to HID's absolute pointing device profile, so at least single touches should already be working properly. If it's a multitouch device, or you need other extra features, you'll probably want to implement a IOUSBHIDDriver subclass that generates or converts the necessary multitouch events.

如果由于某种原因您的设备还不是HID USB设备,则需要为其编写一个自定义USB驱动程序,并将来自该设备的事件转换为HID事件,例如HID事件直接传递到用户空间并在那里进行处理。实际上,您可以编写USB驱动程序并从用户空间生成HID事件,因此,您可以完全避免编写任何内核代码。

If your device for some reason isn't already a HID USB device, you'll need to write a custom USB driver for it, and convert the events coming from it into HID events, as the HID events are passed directly into userspace and processed there. You can actually write USB drivers and generate HID events from userspace, so you might be able to avoid writing any kernel code at all if you prefer.

Apple提供了一些有关隐藏ID:

Apple provides some documentation on HID:

  • The HID Class Device Interface Guide covers some general concepts and the userspace interfaces.
  • The Kernel Framework Reference has API documentation for the various IOHID* classes in the kernel.

如果要编写自己的内核HID设备驱动程序,则您的内核最好的选择可能是 IOHIDFamily源代码。您可能还可以在网上找到一些开源示例。

If you're going to be writing your own kernel HID device driver, your best bet is probably the IOHIDFamily source code. You can probably also find some open source examples around the web.

Apple的 USB邮件列表可能也值得检查,无论是存档还是有疑问。 darwin内核和darwin驱动程序列表也相关。

Apple's USB mailing lists is probably also worth checking, both for the archives and if you have questions. The darwin-kernel and darwin-drivers lists are also relevant.

这篇关于如何在OS X 10.9中编写USB触摸屏驱动程序Kext?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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