MT(Multi-Touch) Protocol (1)

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的合適的屬性。

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章