···162162minimum set consists of ABS_MT_POSITION_X and ABS_MT_POSITION_Y, which163163allows for multiple contacts to be tracked. If the device supports it, the164164ABS_MT_TOUCH_MAJOR and ABS_MT_WIDTH_MAJOR may be used to provide the size165165-of the contact area and approaching contact, respectively.165165+of the contact area and approaching tool, respectively.166166167167The TOUCH and WIDTH parameters have a geometrical interpretation; imagine168168looking through a window at someone gently holding a finger against the169169glass. You will see two regions, one inner region consisting of the part170170of the finger actually touching the glass, and one outer region formed by171171-the perimeter of the finger. The diameter of the inner region is the172172-ABS_MT_TOUCH_MAJOR, the diameter of the outer region is173173-ABS_MT_WIDTH_MAJOR. Now imagine the person pressing the finger harder174174-against the glass. The inner region will increase, and in general, the175175-ratio ABS_MT_TOUCH_MAJOR / ABS_MT_WIDTH_MAJOR, which is always smaller than176176-unity, is related to the contact pressure. For pressure-based devices,171171+the perimeter of the finger. The center of the touching region (a) is172172+ABS_MT_POSITION_X/Y and the center of the approaching finger (b) is173173+ABS_MT_TOOL_X/Y. The touch diameter is ABS_MT_TOUCH_MAJOR and the finger174174+diameter is ABS_MT_WIDTH_MAJOR. Now imagine the person pressing the finger175175+harder against the glass. The touch region will increase, and in general,176176+the ratio ABS_MT_TOUCH_MAJOR / ABS_MT_WIDTH_MAJOR, which is always smaller177177+than unity, is related to the contact pressure. For pressure-based devices,177178ABS_MT_PRESSURE may be used to provide the pressure on the contact area178179instead. Devices capable of contact hovering can use ABS_MT_DISTANCE to179180indicate the distance between the contact and the surface.180181181181-In addition to the MAJOR parameters, the oval shape of the contact can be182182-described by adding the MINOR parameters, such that MAJOR and MINOR are the183183-major and minor axis of an ellipse. Finally, the orientation of the oval184184-shape can be describe with the ORIENTATION parameter.182182+183183+ Linux MT Win8184184+ __________ _______________________185185+ / \ | |186186+ / \ | |187187+ / ____ \ | |188188+ / / \ \ | |189189+ \ \ a \ \ | a |190190+ \ \____/ \ | |191191+ \ \ | |192192+ \ b \ | b |193193+ \ \ | |194194+ \ \ | |195195+ \ \ | |196196+ \ / | |197197+ \ / | |198198+ \ / | |199199+ \__________/ |_______________________|200200+201201+202202+In addition to the MAJOR parameters, the oval shape of the touch and finger203203+regions can be described by adding the MINOR parameters, such that MAJOR204204+and MINOR are the major and minor axis of an ellipse. The orientation of205205+the touch ellipse can be described with the ORIENTATION parameter, and the206206+direction of the finger ellipse is given by the vector (a - b).185207186208For type A devices, further specification of the touch shape is possible187209via ABS_MT_BLOB_ID.···246224The above four values can be used to derive additional information about247225the contact. The ratio ABS_MT_TOUCH_MAJOR / ABS_MT_WIDTH_MAJOR approximates248226the notion of pressure. The fingers of the hand and the palm all have249249-different characteristic widths [1].227227+different characteristic widths.250228251229ABS_MT_PRESSURE252230···262240263241ABS_MT_ORIENTATION264242265265-The orientation of the ellipse. The value should describe a signed quarter266266-of a revolution clockwise around the touch center. The signed value range267267-is arbitrary, but zero should be returned for a finger aligned along the Y268268-axis of the surface, a negative value when finger is turned to the left, and269269-a positive value when finger turned to the right. When completely aligned with270270-the X axis, the range max should be returned. Orientation can be omitted271271-if the touching object is circular, or if the information is not available272272-in the kernel driver. Partial orientation support is possible if the device273273-can distinguish between the two axis, but not (uniquely) any values in274274-between. In such cases, the range of ABS_MT_ORIENTATION should be [0, 1]275275-[4].243243+The orientation of the touching ellipse. The value should describe a signed244244+quarter of a revolution clockwise around the touch center. The signed value245245+range is arbitrary, but zero should be returned for an ellipse aligned with246246+the Y axis of the surface, a negative value when the ellipse is turned to247247+the left, and a positive value when the ellipse is turned to the248248+right. When completely aligned with the X axis, the range max should be249249+returned.250250+251251+Touch ellipsis are symmetrical by default. For devices capable of true 360252252+degree orientation, the reported orientation must exceed the range max to253253+indicate more than a quarter of a revolution. For an upside-down finger,254254+range max * 2 should be returned.255255+256256+Orientation can be omitted if the touch area is circular, or if the257257+information is not available in the kernel driver. Partial orientation258258+support is possible if the device can distinguish between the two axis, but259259+not (uniquely) any values in between. In such cases, the range of260260+ABS_MT_ORIENTATION should be [0, 1] [4].276261277262ABS_MT_POSITION_X278263···288259ABS_MT_POSITION_Y289260290261The surface Y coordinate of the center of the touching ellipse.262262+263263+ABS_MT_TOOL_X264264+265265+The surface X coordinate of the center of the approaching tool. Omit if266266+the device cannot distinguish between the intended touch point and the267267+tool itself.268268+269269+ABS_MT_TOOL_Y270270+271271+The surface Y coordinate of the center of the approaching tool. Omit if the272272+device cannot distinguish between the intended touch point and the tool273273+itself.274274+275275+The four position values can be used to separate the position of the touch276276+from the position of the tool. If both positions are present, the major277277+tool axis points towards the touch point [1]. Otherwise, the tool axes are278278+aligned with the touch axes.291279292280ABS_MT_TOOL_TYPE293281···351305the device can distinguish between a finger along the Y axis (0) and a352306finger along the X axis (1).353307308308+For win8 devices with both T and C coordinates, the position mapping is309309+310310+ ABS_MT_POSITION_X := T_X311311+ ABS_MT_POSITION_Y := T_Y312312+ ABS_MT_TOOL_X := C_X313313+ ABS_MT_TOOL_X := C_Y314314+315315+Unfortunately, there is not enough information to specify both the touching316316+ellipse and the tool ellipse, so one has to resort to approximations. One317317+simple scheme, which is compatible with earlier usage, is:318318+319319+ ABS_MT_TOUCH_MAJOR := min(X, Y)320320+ ABS_MT_TOUCH_MINOR := <not used>321321+ ABS_MT_ORIENTATION := <not used>322322+ ABS_MT_WIDTH_MAJOR := min(X, Y) + distance(T, C)323323+ ABS_MT_WIDTH_MINOR := min(X, Y)324324+325325+Rationale: We have no information about the orientation of the touching326326+ellipse, so approximate it with an inscribed circle instead. The tool327327+ellipse should align with the the vector (T - C), so the diameter must328328+increase with distance(T, C). Finally, assume that the touch diameter is329329+equal to the tool thickness, and we arrive at the formulas above.354330355331Finger Tracking356332---------------···406338For example usage of the type A protocol, see the bcm5974 driver. For407339example usage of the type B protocol, see the hid-egalax driver.408340409409-[1] With the extension ABS_MT_APPROACH_X and ABS_MT_APPROACH_Y, the410410-difference between the contact position and the approaching tool position411411-could be used to derive tilt.341341+[1] Also, the difference (TOOL_X - POSITION_X) can be used to model tilt.412342[2] The list can of course be extended.413343[3] The mtdev project: http://bitmath.org/code/mtdev/.414344[4] See the section on event computation.
+1-1
drivers/input/input-mt.c
···135135 */136136void input_mt_report_pointer_emulation(struct input_dev *dev, bool use_count)137137{138138- struct input_mt_slot *oldest = 0;138138+ struct input_mt_slot *oldest = NULL;139139 int oldid = dev->trkid;140140 int count = 0;141141 int i;
···807807#define ABS_MT_WIDTH_MAJOR 0x32 /* Major axis of approaching ellipse */808808#define ABS_MT_WIDTH_MINOR 0x33 /* Minor axis (omit if circular) */809809#define ABS_MT_ORIENTATION 0x34 /* Ellipse orientation */810810-#define ABS_MT_POSITION_X 0x35 /* Center X ellipse position */811811-#define ABS_MT_POSITION_Y 0x36 /* Center Y ellipse position */810810+#define ABS_MT_POSITION_X 0x35 /* Center X touch position */811811+#define ABS_MT_POSITION_Y 0x36 /* Center Y touch position */812812#define ABS_MT_TOOL_TYPE 0x37 /* Type of touching device */813813#define ABS_MT_BLOB_ID 0x38 /* Group a set of packets as a blob */814814#define ABS_MT_TRACKING_ID 0x39 /* Unique ID of initiated contact */815815#define ABS_MT_PRESSURE 0x3a /* Pressure on contact area */816816#define ABS_MT_DISTANCE 0x3b /* Contact hover distance */817817+#define ABS_MT_TOOL_X 0x3c /* Center X tool position */818818+#define ABS_MT_TOOL_Y 0x3d /* Center Y tool position */817819818820#ifdef __KERNEL__819821/* Implementation details, userspace should not care about these */820822#define ABS_MT_FIRST ABS_MT_TOUCH_MAJOR821821-#define ABS_MT_LAST ABS_MT_DISTANCE823823+#define ABS_MT_LAST ABS_MT_TOOL_Y822824#endif823825824826#define ABS_MAX 0x3f