Lines Matching defs:coord
107 static void parse_pen_data(u8 *data, struct w8001_coord *coord)
109 memset(coord, 0, sizeof(*coord));
111 coord->rdy = data[0] & 0x20;
112 coord->tsw = data[0] & 0x01;
113 coord->f1 = data[0] & 0x02;
114 coord->f2 = data[0] & 0x04;
116 coord->x = (data[1] & 0x7F) << 9;
117 coord->x |= (data[2] & 0x7F) << 2;
118 coord->x |= (data[6] & 0x60) >> 5;
120 coord->y = (data[3] & 0x7F) << 9;
121 coord->y |= (data[4] & 0x7F) << 2;
122 coord->y |= (data[6] & 0x18) >> 3;
124 coord->pen_pressure = data[5] & 0x7F;
125 coord->pen_pressure |= (data[6] & 0x07) << 7 ;
127 coord->tilt_x = data[7] & 0x7F;
128 coord->tilt_y = data[8] & 0x7F;
131 static void parse_single_touch(u8 *data, struct w8001_coord *coord)
133 coord->x = (data[1] << 7) | data[2];
134 coord->y = (data[3] << 7) | data[4];
135 coord->tsw = data[0] & 0x01;
214 static void report_pen_events(struct w8001 *w8001, struct w8001_coord *coord)
230 if (!coord->f2) {
243 w8001->type = coord->f2 ? BTN_TOOL_RUBBER : BTN_TOOL_PEN;
247 input_report_key(dev, BTN_STYLUS2, coord->f2);
251 input_report_abs(dev, ABS_X, coord->x);
252 input_report_abs(dev, ABS_Y, coord->y);
253 input_report_abs(dev, ABS_PRESSURE, coord->pen_pressure);
254 input_report_key(dev, BTN_TOUCH, coord->tsw);
255 input_report_key(dev, BTN_STYLUS, coord->f1);
256 input_report_key(dev, w8001->type, coord->rdy);
259 if (!coord->rdy)
263 static void report_single_touch(struct w8001 *w8001, struct w8001_coord *coord)
266 unsigned int x = coord->x;
267 unsigned int y = coord->y;
274 input_report_key(dev, BTN_TOUCH, coord->tsw);
278 w8001->type = coord->tsw ? BTN_TOOL_FINGER : KEY_RESERVED;
285 struct w8001_coord coord;
307 parse_single_touch(w8001->data, &coord);
308 report_single_touch(w8001, &coord);
324 parse_pen_data(w8001->data, &coord);
325 report_pen_events(w8001, &coord);
426 struct w8001_coord coord;
443 parse_pen_data(w8001->response, &coord);
444 w8001->max_pen_x = coord.x;
445 w8001->max_pen_y = coord.y;
447 input_set_abs_params(dev, ABS_X, 0, coord.x, 0, 0);
448 input_set_abs_params(dev, ABS_Y, 0, coord.y, 0, 0);
451 input_set_abs_params(dev, ABS_PRESSURE, 0, coord.pen_pressure, 0, 0);
452 if (coord.tilt_x && coord.tilt_y) {
453 input_set_abs_params(dev, ABS_TILT_X, 0, coord.tilt_x, 0, 0);
454 input_set_abs_params(dev, ABS_TILT_Y, 0, coord.tilt_y, 0, 0);