MT(Multi-Touch) Protocol (1)

来源:互联网 发布:网络机柜理线 编辑:程序博客网 时间:2024/06/05 05:17

Introduction
------------
介绍

 

In order to utilize the full power of the new multi-touch and multi-user
devices, a way to report detailed data from multiple contacts, i.e.,
objects in direct contact with the device surface, is needed.  This
document describes the multi-touch (MT) protocol which allows kernel
drivers to report details for an arbitrary number of contacts.
为了利用新的多点触摸和多用户设备的全部功能,报告多个接触的详细数据是必要的
,这里接触是指与设备表面直接接触的目标。这个文档描述了多点触摸协议。该协议
允许内核里驱动报告任意数量的接触的详细数据。

 

The protocol is divided into two types, depending on the capabilities of the
hardware. For devices handling anonymous contacts (type A), the protocol
describes how to send the raw data for all contacts to the receiver. For
devices capable of tracking identifiable contacts (type B), the protocol
describes how to send updates for individual contacts via event slots.
依据硬件不同的能力,协议分为两种。对于处理匿名接触(A类型),协议描述如何将所有
接触的原始数据发送给接收器。对于能够跟踪拥有不同识别号的接触的设备(B类),协议
描述如何通过slot事件发送一个特定的接触的更新数据。

 

 

Protocol Usage
--------------
协议用法

Contact details are sent sequentially as separate packets of ABS_MT
events. Only the ABS_MT events are recognized as part of a contact
packet. Since these events are ignored by current single-touch (ST)
applications, the MT protocol can be implemented on top of the ST protocol
in an existing driver.
接触详细数据是以ABS_MT事件的独立数据包形式按照顺序发送的。只有ABS_MT事件被认为是一个接触数据包的一部分。由于这些(ABS_MT)事件被当前单点触摸应用所忽视,所以多点触摸协议可以在已有驱动中的单点触摸协议的顶部实现。

 

Drivers for type A devices separate contact packets by calling
input_mt_sync() at the end of each packet. This generates a SYN_MT_REPORT
event, which instructs the receiver to accept the data for the current
contact and prepare to receive another.
对于A类型协议的设备驱动程序通过在每一个数据包的结尾调用input_mt_sync()来区分
(分离)多种的接触数据包。input_mt_sync()将产生一个SYN_MT_REPORT事件,用来通知接收器接受当前接触数据和准备接受下一个接触数据。

 

Drivers for type B devices separate contact packets by calling
input_mt_slot(), with a slot as argument, at the beginning of each packet.
This generates an ABS_MT_SLOT event, which instructs the receiver to
prepare for updates of the given slot.
对于B类型协议设备的驱动程序通过在每一个数据包的开始调用input_mt_slot()来区分
(分离)多种接触的数据包,并将slot作为input_mt_slot()的一个参数。input_mt_slot()
生成一个ABS_MT_SLOT事件,该事件通知接收器准备为给定的slot更新数据。

 

All drivers mark the end of a multi-touch transfer by calling the usual
input_sync() function. This instructs the receiver to act upon events
accumulated since last EV_SYN/SYN_REPORT and prepare to receive a new set
of events/packets.
所有的驱动程序都通过调用input_sync()函数标记一次多点触摸传输的结束。input_sync()通知接受器按照积累的事件,从上一个EV_SYN/SYN_REPORT之后开始执行以及准备接受新的一轮事件或数据包。

 

The main difference between the stateless type A protocol and the stateful
type B slot protocol lies in the usage of identifiable contacts to reduce
the amount of data sent to userspace. The slot protocol requires the use of
the ABS_MT_TRACKING_ID, either provided by the hardware or computed from
the raw data [5].
无状态的A类协议和有状态的B类协议的主要区别存在于:可识别的接触的使用可以减少
发送到用户空间的数据量。slot协议需要ABS_MT_TRACKING_ID标志的使用,该标志由硬件提供或者从原始数据[5]计算得来。

 

For type A devices, the kernel driver should generate an arbitrary
enumeration of the full set of anonymous contacts currently on the
surface. The order in which the packets appear in the event stream is not
important.  Event filtering and finger tracking is left to user space [3].
对于A类协议的设备,内核驱动程序应该在当前表面生成全套的匿名接触的任意枚举。
包出现在事件流中的顺序并不重要。事件的过滤和手指的跟踪被留给用户空间处理。

 

For type B devices, the kernel driver should associate a slot with each
identified contact, and use that slot to propagate changes for the contact.
Creation, replacement and destruction of contacts is achieved by modifying
the ABS_MT_TRACKING_ID of the associated slot.  A non-negative tracking id
is interpreted as a contact, and the value -1 denotes an unused slot.  A
tracking id not previously present is considered new, and a tracking id no
longer present is considered removed.  Since only changes are propagated,
the full state of each initiated contact has to reside in the receiving
end.  Upon receiving an MT event, one simply updates the appropriate
attribute of the current slot.
对于B类协议的设备,内核驱动程序应该用一个可识别的接触关联一个slot和使用该slot
为对应的接触传送改变(的数据)。接触的创建、更替和销毁是通过修改关联slot的
ABS_MT_TRACKING_ID来实现的。一个非负的跟踪ID被解释为一个接触,而-1表示这是一个未使用的slot。以前没有出现过的跟踪ID被认为是新的,不再出现的跟踪ID被认为是被删除了。由于只有数据的更改才会被传送,因此每一个初始化接触的所有状态必须驻留在接受的末端。一旦接受到一个MT事件,就简单地更新当前slot的合适的属性。

原创粉丝点击