Lines Matching +full:noise +full:- +full:sensitive
1 /*-
2 * SPDX-License-Identifier: BSD-2-Clause
101 * Copyright (C) 2001-2004 Greg Kroah-Hartman (greg@kroah.com)
104 * Copyright (C) 2005 Frank Arnold (frank@scirocco-5v-turbo.de)
106 * Copyright (C) 2005 Michael Hanselmann (linux-kernel@hansmi.ch)
162 /* trackpad finger structure - compact version for external "Magic" devices */
174 /* trackpad finger structure - little endian */
221 /* device-specific parameters */
223 int snratio; /* signal-to-noise ratio */
229 /* device-specific configuration */
240 #define SN_PRESSURE 45 /* pressure signal-to-noise ratio */
241 #define SN_WIDTH 25 /* width signal-to-noise ratio */
242 #define SN_COORD 250 /* coordinate signal-to-noise ratio */
243 #define SN_ORIENT 10 /* orientation signal-to-noise ratio */
250 .x = { SN_COORD, -4824, 5342, 105 },
251 .y = { SN_COORD, -172, 5820, 75 },
253 -MAX_FINGER_ORIENTATION, MAX_FINGER_ORIENTATION, 0 },
259 .x = { SN_COORD, -4824, 4824, 105 },
260 .y = { SN_COORD, -172, 4290, 75 },
262 -MAX_FINGER_ORIENTATION, MAX_FINGER_ORIENTATION, 0 },
268 .x = { SN_COORD, -4460, 5166, 105 },
269 .y = { SN_COORD, -75, 6700, 75 },
271 -MAX_FINGER_ORIENTATION, MAX_FINGER_ORIENTATION, 0 },
277 .x = { SN_COORD, -4620, 5140, 105 },
278 .y = { SN_COORD, -150, 6600, 75 },
280 -MAX_FINGER_ORIENTATION, MAX_FINGER_ORIENTATION, 0 },
286 .x = { SN_COORD, -4616, 5112, 105 },
287 .y = { SN_COORD, -142, 5234, 75 },
289 -MAX_FINGER_ORIENTATION, MAX_FINGER_ORIENTATION, 0 },
295 .x = { SN_COORD, -4415, 5050, 105 },
296 .y = { SN_COORD, -55, 6680, 75 },
298 -MAX_FINGER_ORIENTATION, MAX_FINGER_ORIENTATION, 0 },
304 .x = { SN_COORD, -4620, 5140, 105 },
305 .y = { SN_COORD, -150, 6600, 75 },
307 -MAX_FINGER_ORIENTATION, MAX_FINGER_ORIENTATION, 0 },
313 .x = { SN_COORD, -4750, 5280, 105 },
314 .y = { SN_COORD, -150, 6730, 75 },
316 -MAX_FINGER_ORIENTATION, MAX_FINGER_ORIENTATION, 0 },
322 .x = { SN_COORD, -4620, 5140, 105 },
323 .y = { SN_COORD, -150, 6600, 75 },
325 -MAX_FINGER_ORIENTATION, MAX_FINGER_ORIENTATION, 0 },
331 .x = { SN_COORD, -4750, 5280, 105 },
332 .y = { SN_COORD, -150, 6730, 75 },
334 -MAX_FINGER_ORIENTATION, MAX_FINGER_ORIENTATION, 0 },
340 .x = { SN_COORD, -4750, 5280, 105 },
341 .y = { SN_COORD, -150, 6730, 75 },
343 -MAX_FINGER_ORIENTATION, MAX_FINGER_ORIENTATION, 0 },
349 .x = { SN_COORD, -4620, 5140, 105 },
350 .y = { SN_COORD, -150, 6600, 75 },
352 -MAX_FINGER_ORIENTATION, MAX_FINGER_ORIENTATION, 0 },
355 * NOTE: Actually force-sensitive. Pressure has a "size" equal to the max
364 .x = { SN_COORD, -4828, 5345, 105 },
365 .y = { SN_COORD, -203, 6803, 75 },
367 -MAX_FINGER_ORIENTATION, MAX_FINGER_ORIENTATION, 0 },
373 .x = { SN_COORD, -5087, 5579, 105 },
374 .y = { SN_COORD, -182, 6089, 75 },
376 -MAX_FINGER_ORIENTATION, MAX_FINGER_ORIENTATION, 0 },
382 .x = { SN_COORD, -6243, 6749, 105 },
383 .y = { SN_COORD, -170, 7685, 75 },
385 -MAX_FINGER_ORIENTATION, MAX_FINGER_ORIENTATION, 0 },
391 .x = { SN_COORD, -7456, 7976, 105 },
392 .y = { SN_COORD, -163, 9283, 75 },
394 -MAX_FINGER_ORIENTATION, MAX_FINGER_ORIENTATION, 0 },
400 .x = { SN_COORD, -3678, 3934, 157 },
401 .y = { SN_COORD, -2478, 2587, 107 },
402 .o = { SN_ORIENT, -3, 4, 0 },
464 /* MacbookPro11,1-3 (unibody, June 2013) */
558 err = hid_ioctl(sc->sc_dev, USB_REQUEST, (uintptr_t)&ucr);
576 err = hid_ioctl(sc->sc_dev, USB_REQUEST, (uintptr_t)&ucr);
595 err = hid_get_report(sc->sc_dev, mode_bytes, BCM5974_HID_REPORT_LEN,
610 return (hid_set_report(sc->sc_dev, mode_bytes, BCM5974_HID_REPORT_LEN,
619 switch (sc->sc_params->tp - tp) {
635 sc->sc_saved_mode = on;
649 if (hw->rdescsize == sizeof(rdesc) &&
672 "%u, not extracting model\n", hw->rdescsize, model_byte);
721 sc->sc_dev = dev;
727 sc->sc_params = bcm5974_dev_params + drv_info;
729 sc->sc_evdev = evdev_alloc();
730 evdev_set_name(sc->sc_evdev, device_get_desc(dev));
731 evdev_set_phys(sc->sc_evdev, device_get_nameunit(dev));
732 evdev_set_id(sc->sc_evdev, hw->idBus, hw->idVendor, hw->idProduct,
733 hw->idVersion);
734 evdev_set_serial(sc->sc_evdev, hw->serial);
735 evdev_set_methods(sc->sc_evdev, sc, &bcm5974_evdev_methods);
736 evdev_support_prop(sc->sc_evdev, INPUT_PROP_POINTER);
737 evdev_support_event(sc->sc_evdev, EV_SYN);
738 evdev_support_event(sc->sc_evdev, EV_ABS);
739 evdev_support_event(sc->sc_evdev, EV_KEY);
740 evdev_set_flag(sc->sc_evdev, EVDEV_FLAG_EXT_EPOCH); /* hidbus child */
744 ((param).max - (param).min) / (param).snratio, 0, \
745 (param).size != 0 ? ((param).max - (param).min) / (param).size : 0);
748 BCM5974_ABS(sc->sc_evdev, ABS_MT_POSITION_X, sc->sc_params->x);
749 BCM5974_ABS(sc->sc_evdev, ABS_MT_POSITION_Y, sc->sc_params->y);
751 BCM5974_ABS(sc->sc_evdev, ABS_MT_PRESSURE, sc->sc_params->p);
753 BCM5974_ABS(sc->sc_evdev, ABS_MT_TOUCH_MAJOR, sc->sc_params->w);
754 BCM5974_ABS(sc->sc_evdev, ABS_MT_TOUCH_MINOR, sc->sc_params->w);
756 if ((sc->sc_params->tp->caps & USES_COMPACT_REPORT) == 0) {
757 BCM5974_ABS(sc->sc_evdev, ABS_MT_WIDTH_MAJOR, sc->sc_params->w);
758 BCM5974_ABS(sc->sc_evdev, ABS_MT_WIDTH_MINOR, sc->sc_params->w);
761 BCM5974_ABS(sc->sc_evdev, ABS_MT_ORIENTATION, sc->sc_params->o);
763 evdev_support_key(sc->sc_evdev, BTN_LEFT);
764 if ((sc->sc_params->tp->caps & HAS_INTEGRATED_BUTTON) != 0)
765 evdev_support_prop(sc->sc_evdev, INPUT_PROP_BUTTONPAD);
767 evdev_support_abs(sc->sc_evdev, ABS_MT_SLOT,
768 0, MAX_FINGERS - 1, 0, 0, 0);
769 evdev_support_abs(sc->sc_evdev, ABS_MT_TRACKING_ID,
770 -1, MAX_FINGERS - 1, 0, 0, 0);
771 if ((sc->sc_params->tp->caps & USES_COMPACT_REPORT) == 0)
772 evdev_set_flag(sc->sc_evdev, EVDEV_FLAG_MT_TRACK);
773 evdev_set_flag(sc->sc_evdev, EVDEV_FLAG_MT_AUTOREL);
775 evdev_set_flag(sc->sc_evdev, EVDEV_FLAG_MT_STCOMPAT);
777 err = evdev_register(sc->sc_evdev);
795 evdev_free(sc->sc_evdev);
805 bcm5974_set_device_mode(sc, sc->sc_saved_mode);
814 const struct bcm5974_dev_params *params = sc->sc_params;
824 uint8_t fsize = sizeof(struct tp_finger) + params->tp->delta;
826 if ((params->tp->caps & USES_COMPACT_REPORT) != 0)
827 fsize = sizeof(struct tp_finger_compact) + params->tp->delta;
829 if ((len < params->tp->offset + fsize) ||
830 ((len - params->tp->offset) % fsize) != 0) {
832 len, params->tp->offset, fsize);
836 ibt = ((uint8_t *)data)[params->tp->button];
837 ntouch = (len - params->tp->offset) / fsize;
840 if ((params->tp->caps & USES_COMPACT_REPORT) != 0) {
842 params->tp->offset + params->tp->delta + i * fsize);
843 coords = (int)le32toh(fc->coords);
844 id = fc->id_ori & 0x0f;
845 slot = evdev_mt_id_to_slot(sc->sc_evdev, id);
852 fc->touch_major, fc->touch_minor, fc->size,
853 fc->pressure, fc->id_ori >> 5, id, slot);
854 if (fc->touch_major == 0 || slot == -1)
859 .y = params->y.min + params->y.max -
861 .p = fc->pressure,
862 .maj = fc->touch_major << 2,
863 .min = fc->touch_minor << 2,
864 .ori = (int)(fc->id_ori >> 5) - 4,
866 evdev_mt_push_slot(sc->sc_evdev, slot, &slot_data);
870 params->tp->offset + params->tp->delta + i * fsize);
875 i, ibt, ntouch, BCM5974_LE2H(f->origin),
876 BCM5974_LE2H(f->abs_x), BCM5974_LE2H(f->abs_y),
877 BCM5974_LE2H(f->rel_x), BCM5974_LE2H(f->rel_y),
878 BCM5974_LE2H(f->tool_major), BCM5974_LE2H(f->tool_minor),
879 BCM5974_LE2H(f->orientation), BCM5974_LE2H(f->touch_major),
880 BCM5974_LE2H(f->touch_minor), BCM5974_LE2H(f->pressure),
881 BCM5974_LE2H(f->multi));
883 if (BCM5974_LE2H(f->touch_major) == 0)
887 .x = BCM5974_LE2H(f->abs_x),
888 .y = params->y.min + params->y.max -
889 BCM5974_LE2H(f->abs_y),
890 .p = BCM5974_LE2H(f->pressure),
891 .maj = BCM5974_LE2H(f->touch_major) << 1,
892 .min = BCM5974_LE2H(f->touch_minor) << 1,
893 .w_maj = BCM5974_LE2H(f->tool_major) << 1,
894 .w_min = BCM5974_LE2H(f->tool_minor) << 1,
895 .ori = params->o.max - BCM5974_LE2H(f->orientation),
897 evdev_mt_push_slot(sc->sc_evdev, slot, &slot_data);
901 evdev_push_key(sc->sc_evdev, BTN_LEFT, ibt);
902 evdev_sync(sc->sc_evdev);
917 * reports to raw sensor data using vendor-specific USB
926 return (hid_intr_start(sc->sc_dev));
935 err = hid_intr_stop(sc->sc_dev);
940 * During re-enumeration of the device we need to force the