Lines Matching refs:mt
110 hidmt_setup(struct device *self, struct hidmt *mt, void *desc, int dlen) in hidmt_setup() argument
120 mt->sc_device = self; in hidmt_setup()
121 mt->sc_rep_input_size = hid_report_size(desc, dlen, hid_input, in hidmt_setup()
122 mt->sc_rep_input); in hidmt_setup()
124 mt->sc_minx = mt->sc_miny = mt->sc_maxx = mt->sc_maxy = 0; in hidmt_setup()
126 capsize = hid_report_size(desc, dlen, hid_feature, mt->sc_rep_cap); in hidmt_setup()
129 if (mt->hidev_report_type_conv == NULL) in hidmt_setup()
132 if (mt->hidev_get_report(mt->sc_device, in hidmt_setup()
133 mt->hidev_report_type_conv(hid_feature), mt->sc_rep_cap, in hidmt_setup()
141 mt->sc_num_contacts = HIDMT_MAX_CONTACTS; in hidmt_setup()
143 mt->sc_rep_cap, hid_feature, &cap, NULL)) { in hidmt_setup()
149 mt->sc_num_contacts = d; in hidmt_setup()
154 mt->sc_rep_cap, hid_feature, &cap, NULL)) { in hidmt_setup()
156 mt->sc_clickpad = (d == 0); in hidmt_setup()
158 mt->sc_rep_input, hid_input, &cap, NULL) || in hidmt_setup()
160 mt->sc_rep_input, hid_input, &cap, NULL) || in hidmt_setup()
162 mt->sc_rep_input, hid_input, &cap, NULL)) { in hidmt_setup()
163 mt->sc_clickpad = 1; in hidmt_setup()
170 SIMPLEQ_INIT(&mt->sc_inputs); in hidmt_setup()
176 if (h.report_ID != mt->sc_rep_input) in hidmt_setup()
185 mt->sc_minx = h.logical_minimum; in hidmt_setup()
186 mt->sc_maxx = h.logical_maximum; in hidmt_setup()
187 mt->sc_resx = hidmt_get_resolution(&h); in hidmt_setup()
192 mt->sc_miny = h.logical_minimum; in hidmt_setup()
193 mt->sc_maxy = h.logical_maximum; in hidmt_setup()
194 mt->sc_resy = hidmt_get_resolution(&h); in hidmt_setup()
217 SIMPLEQ_INSERT_TAIL(&mt->sc_inputs, input, entry); in hidmt_setup()
221 if (mt->sc_maxx <= 0 || mt->sc_maxy <= 0) { in hidmt_setup()
223 mt->sc_maxx, mt->sc_maxy); in hidmt_setup()
227 if (hidmt_set_input_mode(mt, HIDMT_INPUT_MODE_MT_TOUCHPAD)) { in hidmt_setup()
237 hidmt_configure(struct hidmt *mt) in hidmt_configure() argument
241 if (mt->sc_wsmousedev == NULL) in hidmt_configure()
244 hw = wsmouse_get_hw(mt->sc_wsmousedev); in hidmt_configure()
246 hw->hw_type = (mt->sc_clickpad in hidmt_configure()
248 hw->x_min = mt->sc_minx; in hidmt_configure()
249 hw->x_max = mt->sc_maxx; in hidmt_configure()
250 hw->y_min = mt->sc_miny; in hidmt_configure()
251 hw->y_max = mt->sc_maxy; in hidmt_configure()
252 hw->h_res = mt->sc_resx; in hidmt_configure()
253 hw->v_res = mt->sc_resy; in hidmt_configure()
256 wsmouse_configure(mt->sc_wsmousedev, NULL, 0); in hidmt_configure()
260 hidmt_attach(struct hidmt *mt, const struct wsmouse_accessops *ops) in hidmt_attach() argument
265 (mt->sc_clickpad ? "click" : "touch"), mt->sc_num_contacts, in hidmt_attach()
266 (mt->sc_num_contacts == 1 ? "" : "s")); in hidmt_attach()
269 a.accesscookie = mt->sc_device; in hidmt_attach()
270 mt->sc_wsmousedev = config_found(mt->sc_device, &a, wsmousedevprint); in hidmt_attach()
271 hidmt_configure(mt); in hidmt_attach()
275 hidmt_detach(struct hidmt *mt, int flags) in hidmt_detach() argument
279 if (mt->sc_wsmousedev != NULL) in hidmt_detach()
280 rv = config_detach(mt->sc_wsmousedev, flags); in hidmt_detach()
286 hidmt_set_input_mode(struct hidmt *mt, uint16_t mode) in hidmt_set_input_mode() argument
288 if (mt->hidev_report_type_conv == NULL) in hidmt_set_input_mode()
291 return mt->hidev_set_report(mt->sc_device, in hidmt_set_input_mode()
292 mt->hidev_report_type_conv(hid_feature), in hidmt_set_input_mode()
293 mt->sc_rep_config, &mode, sizeof(mode)); in hidmt_set_input_mode()
297 hidmt_input(struct hidmt *mt, uint8_t *data, u_int len) in hidmt_input() argument
304 if (len != mt->sc_rep_input_size) { in hidmt_input()
306 mt->sc_device->dv_xname, __func__, len, in hidmt_input()
307 mt->sc_rep_input_size)); in hidmt_input()
320 SIMPLEQ_FOREACH(hi, &mt->sc_inputs, entry) { in hidmt_input()
326 mt->sc_cur_contactcount = contactcount; in hidmt_input()
344 contactcount = mt->sc_cur_contactcount; in hidmt_input()
349 mt->sc_device->dv_xname, __func__)); in hidmt_input()
360 SIMPLEQ_FOREACH(hi, &mt->sc_inputs, entry) { in hidmt_input()
367 mt->sc_wsmousedev, hc.contactid); in hidmt_input()
369 memcpy(&mt->sc_contacts[i], &hc, in hidmt_input()
384 if (mt->sc_flags & HIDMT_REVY) in hidmt_input()
385 hc.y = mt->sc_maxy - d; in hidmt_input()
425 i = wsmouse_id_to_slot(mt->sc_wsmousedev, hc.contactid); in hidmt_input()
427 memcpy(&mt->sc_contacts[i], &hc, in hidmt_input()
433 if (mt->sc_buttons != buttons) { in hidmt_input()
434 wsmouse_buttons(mt->sc_wsmousedev, buttons); in hidmt_input()
435 mt->sc_buttons = buttons; in hidmt_input()
438 if (!mt->sc_contacts[i].seen) in hidmt_input()
441 mt->sc_contacts[i].seen = 0; in hidmt_input()
446 mt->sc_device->dv_xname, __func__, in hidmt_input()
448 mt->sc_contacts[i].contactid, in hidmt_input()
449 mt->sc_contacts[i].x, in hidmt_input()
450 mt->sc_contacts[i].y, in hidmt_input()
451 mt->sc_contacts[i].tip, in hidmt_input()
452 mt->sc_contacts[i].confidence, in hidmt_input()
453 mt->sc_contacts[i].width, in hidmt_input()
454 mt->sc_contacts[i].height, in hidmt_input()
455 mt->sc_buttons)); in hidmt_input()
457 if (mt->sc_contacts[i].tip && !mt->sc_contacts[i].confidence) in hidmt_input()
461 z = (mt->sc_contacts[i].tip in hidmt_input()
462 ? imax(mt->sc_contacts[i].width, 50) : 0); in hidmt_input()
464 wsmouse_mtstate(mt->sc_wsmousedev, in hidmt_input()
465 i, mt->sc_contacts[i].x, mt->sc_contacts[i].y, z); in hidmt_input()
467 wsmouse_input_sync(mt->sc_wsmousedev); in hidmt_input()
473 hidmt_enable(struct hidmt *mt) in hidmt_enable() argument
475 if (mt->sc_enabled) in hidmt_enable()
478 mt->sc_enabled = 1; in hidmt_enable()
484 hidmt_ioctl(struct hidmt *mt, u_long cmd, caddr_t data, int flag, in hidmt_ioctl() argument
492 struct wsmousehw *hw = wsmouse_get_hw(mt->sc_wsmousedev); in hidmt_ioctl()
498 wsmc->minx = mt->sc_minx; in hidmt_ioctl()
499 wsmc->maxx = mt->sc_maxx; in hidmt_ioctl()
500 wsmc->miny = mt->sc_miny; in hidmt_ioctl()
501 wsmc->maxy = mt->sc_maxy; in hidmt_ioctl()
503 wsmc->resx = mt->sc_resx; in hidmt_ioctl()
504 wsmc->resy = mt->sc_resy; in hidmt_ioctl()
511 mt->sc_device->dv_xname, wsmode); in hidmt_ioctl()
515 DPRINTF(("%s: changing mode to %s\n", mt->sc_device->dv_xname, in hidmt_ioctl()
518 wsmouse_set_mode(mt->sc_wsmousedev, wsmode); in hidmt_ioctl()
530 hidmt_disable(struct hidmt *mt) in hidmt_disable() argument
532 mt->sc_enabled = 0; in hidmt_disable()