Lines Matching full:input
661 normalized_pressure(struct wsmouseinput *input, int pressure)
663 int limit = imax(input->touch.min_pressure, 1);
674 struct wsmouseinput *input = &((struct wsmouse_softc *) sc)->sc_input;
675 struct touch_state *touch = &input->touch;
677 pressure = normalized_pressure(input, pressure);
697 struct wsmouseinput *input = &((struct wsmouse_softc *) sc)->sc_input;
698 struct mt_state *mt = &input->mt;
717 pressure = normalized_pressure(input, pressure);
743 struct wsmouseinput *input = &((struct wsmouse_softc *) sc)->sc_input;
747 if (aux < 0 || aux >= input->mt.num_slots)
749 mts = &input->mt.slots[aux];
754 value += input->motion.pos.x; /* fall through */
756 wsmouse_position(sc, value, input->motion.pos.y);
759 value += input->motion.pos.y; /* fall through */
761 wsmouse_position(sc, input->motion.pos.x, value);
764 wsmouse_touch(sc, value, input->touch.contacts);
768 if (value != input->touch.contacts) {
769 input->touch.contacts = value;
770 input->touch.sync |= SYNC_CONTACTS;
774 if (value != input->touch.width) {
775 input->touch.width = value;
776 input->touch.sync |= SYNC_TOUCH_WIDTH;
797 wsmouse_touch_update(struct wsmouseinput *input)
799 struct motion_state *motion = &input->motion;
800 struct touch_state *touch = &input->touch;
824 if (touch->pressure >= input->filter.pressure_hi)
825 touch->min_pressure = input->filter.pressure_lo;
826 else if (touch->pressure < input->filter.pressure_lo)
827 touch->min_pressure = input->filter.pressure_hi;
833 wsmouse_mt_update(struct wsmouseinput *input)
842 if (input->mt.frame & ~input->mt.touches) {
844 input->mt.sync[i] &= input->mt.touches;
850 wsmouse_hysteresis(struct wsmouseinput *input, struct position *pos)
852 return (abs(pos->acc_dx) < input->filter.h.hysteresis
853 && abs(pos->acc_dy) < input->filter.v.hysteresis);
862 * partial, unordered, and "delta-filtered" input.
870 wsmouse_ptr_ctrl(struct wsmouseinput *input)
872 struct mt_state *mt = &input->mt;
891 if (wsmouse_hysteresis(input, &mt->slots[slot].pos))
925 struct wsmouseinput *input = &((struct wsmouse_softc *) sc)->sc_input;
926 struct mt_state *mt = &input->mt;
930 wsmouse_ptr_ctrl(input);
935 if (mts->pos.x != input->motion.pos.x)
936 input->motion.sync |= SYNC_X;
937 if (mts->pos.y != input->motion.pos.y)
938 input->motion.sync |= SYNC_Y;
942 memcpy(&input->motion.pos, &mts->pos, sizeof(struct position));
1003 wsmouse_motion_sync(struct wsmouseinput *input, struct evq_access *evq)
1005 struct motion_state *motion = &input->motion;
1006 struct axis_filter *h = &input->filter.h;
1007 struct axis_filter *v = &input->filter.v;
1018 wsmouse_evq_put(evq, DELTA_X_EV(input), dx);
1020 wsmouse_evq_put(evq, DELTA_Y_EV(input), dy);
1022 dz = (input->flags & REVERSE_SCROLLING)
1024 if (IS_TOUCHPAD(input))
1030 dw = (input->flags & REVERSE_SCROLLING)
1032 if (IS_TOUCHPAD(input))
1041 wsmouse_evq_put(evq, ABS_X_EV(input), x);
1045 wsmouse_evq_put(evq, ABS_Y_EV(input), y);
1048 && (input->flags & TPAD_NATIVE_MODE ))
1055 wsmouse_touch_sync(struct wsmouseinput *input, struct evq_access *evq)
1057 struct touch_state *touch = &input->touch;
1064 && (input->flags & TPAD_NATIVE_MODE))
1069 wsmouse_log_input(struct wsmouseinput *input, struct timespec *ts)
1071 struct motion_state *motion = &input->motion;
1074 t_sync = (input->touch.sync & SYNC_CONTACTS);
1075 mt_sync = (input->mt.frame && (input->mt.sync[MTS_TOUCH]
1076 || input->mt.ptr != input->mt.prev_ptr));
1078 if (motion->sync || mt_sync || t_sync || input->btn.sync)
1079 printf("[%s-in][%04d]", DEVNAME(input), LOGTIME(ts));
1089 printf(" mt:0x%02x:%d", input->mt.touches,
1090 ffs(input->mt.ptr) - 1);
1092 printf(" t:%d", input->touch.contacts);
1093 if (input->btn.sync)
1094 printf(" btn:0x%02x", input->btn.buttons);
1099 wsmouse_log_events(struct wsmouseinput *input, struct evq_access *evq)
1105 printf("[%s-ev][%04d]", DEVNAME(input), LOGTIME(&evq->ts));
1116 clear_sync_flags(struct wsmouseinput *input)
1120 input->btn.sync = 0;
1121 input->sbtn.sync = 0;
1122 input->motion.sync = 0;
1123 input->touch.sync = 0;
1124 input->touch.prev_contacts = input->touch.contacts;
1125 if (input->mt.frame) {
1126 input->mt.frame = 0;
1128 input->mt.sync[i] = 0;
1135 struct wsmouseinput *input = &((struct wsmouse_softc *) sc)->sc_input;
1138 evq.evar = *input->evar;
1145 enqueue_randomness(input->btn.buttons
1146 ^ input->motion.dx ^ input->motion.dy
1147 ^ input->motion.pos.x ^ input->motion.pos.y
1148 ^ input->motion.dz ^ input->motion.dw);
1150 if (input->mt.frame) {
1151 wsmouse_mt_update(input);
1154 if (input->touch.sync)
1155 wsmouse_touch_update(input);
1157 if (input->flags & LOG_INPUT)
1158 wsmouse_log_input(input, &evq.ts);
1160 if (input->flags & TPAD_COMPAT_MODE)
1161 wstpad_compat_convert(input, &evq);
1163 if (input->flags & RESYNC) {
1164 input->flags &= ~RESYNC;
1165 input->motion.sync &= SYNC_POSITION;
1168 if (input->btn.sync)
1169 wsmouse_btn_sync(&input->btn, &evq);
1170 if (input->sbtn.sync)
1171 wsmouse_btn_sync(&input->sbtn, &evq);
1172 if (input->motion.sync)
1173 wsmouse_motion_sync(input, &evq);
1174 if (input->touch.sync)
1175 wsmouse_touch_sync(input, &evq);
1181 if (input->flags & LOG_EVENTS) {
1182 wsmouse_log_events(input, &evq);
1190 clear_sync_flags(input);
1192 input->flags |= RESYNC;
1198 struct wsmouseinput *input = &((struct wsmouse_softc *) sc)->sc_input;
1199 struct mt_state *mt = &input->mt;
1229 * Wrong results because of overflows will not occur with input values
1315 struct wsmouseinput *input = &((struct wsmouse_softc *) sc)->sc_input;
1316 struct mt_state *mt = &input->mt;
1350 maxdist = input->filter.tracking_maxdist;
1383 free_mt_slots(struct wsmouseinput *input)
1387 if ((n = input->mt.num_slots)) {
1389 if (input->flags & MT_TRACKING)
1391 input->mt.num_slots = 0;
1392 free(input->mt.slots, M_DEVBUF, size);
1393 input->mt.slots = NULL;
1394 input->mt.matrix = NULL;
1402 struct wsmouseinput *input = &((struct wsmouse_softc *) sc)->sc_input;
1405 if (num_slots == input->mt.num_slots
1406 && (!tracking == ((input->flags & MT_TRACKING) == 0)))
1409 free_mt_slots(input);
1412 input->flags |= MT_TRACKING;
1414 input->flags &= ~MT_TRACKING;
1418 if (input->flags & MT_TRACKING)
1420 input->mt.slots = malloc(size, M_DEVBUF, M_WAITOK | M_ZERO);
1421 if (input->mt.slots != NULL) {
1422 if (input->flags & MT_TRACKING)
1423 input->mt.matrix = (int *)
1424 (input->mt.slots + n);
1425 input->mt.num_slots = n;
1436 struct wsmouseinput *input = &((struct wsmouse_softc *) sc)->sc_input;
1443 params[i].value = input->filter.h.scale;
1446 params[i].value = input->filter.v.scale;
1449 params[i].value = input->filter.pressure_lo;
1452 params[i].value = input->filter.pressure_hi;
1455 params[i].value = input->filter.tracking_maxdist;
1458 params[i].value = input->filter.swapxy;
1461 params[i].value = input->filter.h.inv;
1464 params[i].value = input->filter.v.inv;
1467 params[i].value = !!(input->flags & REVERSE_SCROLLING);
1470 params[i].value = input->filter.h.dmax;
1473 params[i].value = input->filter.v.dmax;
1476 params[i].value = input->filter.h.hysteresis;
1479 params[i].value = input->filter.v.hysteresis;
1482 params[i].value = input->filter.dclr;
1489 input->filter.mode & SMOOTHING_MASK;
1492 params[i].value = !!(input->flags & LOG_INPUT);
1495 params[i].value = !!(input->flags & LOG_EVENTS);
1498 error = wstpad_get_param(input, key, ¶ms[i].value);
1512 struct wsmouseinput *input = &((struct wsmouse_softc *) sc)->sc_input;
1520 input->filter.pressure_lo = val;
1521 if (val > input->filter.pressure_hi)
1522 input->filter.pressure_hi = val;
1523 input->touch.min_pressure = input->filter.pressure_hi;
1526 input->filter.pressure_hi = val;
1527 if (val < input->filter.pressure_lo)
1528 input->filter.pressure_lo = val;
1529 input->touch.min_pressure = val;
1532 input->filter.h.hysteresis = val;
1535 input->filter.v.hysteresis = val;
1538 input->filter.dclr = val;
1539 wstpad_init_deceleration(input);
1542 input->filter.h.scale = val;
1545 input->filter.v.scale = val;
1548 input->filter.tracking_maxdist = val;
1551 input->filter.swapxy = val;
1554 input->filter.h.inv = val;
1557 input->filter.v.inv = val;
1561 input->flags |= REVERSE_SCROLLING;
1563 input->flags &= ~REVERSE_SCROLLING;
1566 input->filter.h.dmax = val;
1569 input->filter.v.dmax = val;
1572 input->filter.mode &= ~SMOOTHING_MASK;
1573 input->filter.mode |= (val & SMOOTHING_MASK);
1577 input->flags |= LOG_INPUT;
1579 input->flags &= ~LOG_INPUT;
1583 input->flags |= LOG_EVENTS;
1585 input->flags &= ~LOG_EVENTS;
1589 error = wstpad_set_param(input, key, val);
1598 wstpad_reset(input);
1599 return (wstpad_configure(input));
1608 struct wsmouseinput *input = &((struct wsmouse_softc *) sc)->sc_input;
1611 input->flags &= ~TPAD_NATIVE_MODE;
1612 input->flags |= TPAD_COMPAT_MODE;
1615 input->flags &= ~TPAD_COMPAT_MODE;
1616 input->flags |= TPAD_NATIVE_MODE;
1638 struct wsmouseinput *input = &((struct wsmouse_softc *) sc)->sc_input;
1641 if (!(input->flags & CONFIGURED)) {
1642 if (input->hw.x_max && input->hw.y_max) {
1643 if (input->hw.flags & WSMOUSEHW_LR_DOWN) {
1644 input->filter.v.inv =
1645 input->hw.y_max + input->hw.y_min;
1648 input->filter.ratio = 1 << 12;
1649 if (input->hw.h_res > 0 && input->hw.v_res > 0) {
1650 input->filter.ratio *= input->hw.h_res;
1651 input->filter.ratio /= input->hw.v_res;
1653 if (wsmouse_mt_init(sc, input->hw.mt_slots,
1654 (input->hw.flags & WSMOUSEHW_MT_TRACKING))) {
1659 if (IS_TOUCHPAD(input) && wstpad_configure(input)) {
1664 input->flags |= CONFIGURED;
1670 if (IS_TOUCHPAD(input))
1678 wsmouse_input_reset(struct wsmouseinput *input)
1683 memset(&input->btn, 0, sizeof(struct btn_state));
1684 memset(&input->motion, 0, sizeof(struct motion_state));
1685 memset(&input->touch, 0, sizeof(struct touch_state));
1686 input->touch.min_pressure = input->filter.pressure_hi;
1687 if ((num_slots = input->mt.num_slots)) {
1688 slots = input->mt.slots;
1689 matrix = input->mt.matrix;
1690 memset(&input->mt, 0, sizeof(struct mt_state));
1692 input->mt.num_slots = num_slots;
1693 input->mt.slots = slots;
1694 input->mt.matrix = matrix;
1696 if (input->tp != NULL)
1697 wstpad_reset(input);
1701 wsmouse_input_cleanup(struct wsmouseinput *input)
1703 if (input->tp != NULL)
1704 wstpad_cleanup(input);
1706 free_mt_slots(input);