續:
http://r40eubuntu.blogspot.tw/2010/12/input-inputevent-inputreportxx.html
touch driver 對於touch 座標的回報,是用:
static inline void input_report_abs(struct input_dev *dev, unsigned int code, int value)
{
input_event(dev, EV_ABS, code, value);
}
就是固定 type 是 EV_ABS:
#define EV_ABS 0x03
其中的 code:
/*
* Absolute axes
*/
#define ABS_X 0x00
#define ABS_Y 0x01
#define ABS_Z 0x02
#define ABS_RX 0x03
#define ABS_RY 0x04
#define ABS_RZ 0x05
#define ABS_THROTTLE 0x06
#define ABS_RUDDER 0x07
#define ABS_WHEEL 0x08
#define ABS_GAS 0x09
#define ABS_BRAKE 0x0a
#define ABS_HAT0X 0x10
#define ABS_HAT0Y 0x11
#define ABS_HAT1X 0x12
#define ABS_HAT1Y 0x13
#define ABS_HAT2X 0x14
#define ABS_HAT2Y 0x15
#define ABS_HAT3X 0x16
#define ABS_HAT3Y 0x17
#define ABS_PRESSURE 0x18
#define ABS_DISTANCE 0x19
#define ABS_TILT_X 0x1a
#define ABS_TILT_Y 0x1b
#define ABS_TOOL_WIDTH 0x1c
#define ABS_VOLUME 0x20
#define ABS_MISC 0x28
#define ABS_MT_SLOT 0x2f /* MT slot being modified */
#define ABS_MT_TOUCH_MAJOR 0x30 /* Major axis of touching ellipse */
#define ABS_MT_TOUCH_MINOR 0x31 /* Minor axis (omit if circular) */
#define ABS_MT_WIDTH_MAJOR 0x32 /* Major axis of approaching ellipse */
#define ABS_MT_WIDTH_MINOR 0x33 /* Minor axis (omit if circular) */
#define ABS_MT_ORIENTATION 0x34 /* Ellipse orientation */
#define ABS_MT_POSITION_X 0x35 /* Center X ellipse position */
#define ABS_MT_POSITION_Y 0x36 /* Center Y ellipse position */
#define ABS_MT_TOOL_TYPE 0x37 /* Type of touching device */
#define ABS_MT_BLOB_ID 0x38 /* Group a set of packets as a blob */
#define ABS_MT_TRACKING_ID 0x39 /* Unique ID of initiated contact */
#define ABS_MT_PRESSURE 0x3a /* Pressure on contact area */
#define ABS_MT_DISTANCE 0x3b /* Contact hover distance */
#define ABS_MAX 0x3f
#define ABS_CNT (ABS_MAX+1)
一個 touch driver report 的 code:
input_report_abs(data->input_dev, ABS_MT_POSITION_X, readx[i]);
input_report_abs(data->input_dev, ABS_MT_POSITION_Y, ready[i]);
input_report_abs(data->input_dev, ABS_MT_WIDTH_MAJOR, 1);
input_report_abs(data->input_dev, ABS_MT_TRACKING_ID, finger_id[i]);
input_report_abs(data->input_dev, ABS_MT_TOUCH_MAJOR, 0);
input_mt_sync(data->input_dev);
其中的 ABS_MT_TRACKING_ID 就是 touch point 的 id.
有兩點的話,第一點就是 0, 第二點就是 1
touch Release 時的 code:
input_report_abs(data->input_dev, ABS_MT_TOUCH_MAJOR, 0);
input_sync(data->input_dev);