1 /* $NetBSD: synapticsvar.h,v 1.14 2022/04/01 06:31:29 blymn Exp $ */ 2 3 /* 4 * Copyright (c) 2005, Steve C. Woodford 5 * Copyright (c) 2004, Ales Krenek 6 * Copyright (c) 2004, Kentaro A. Kurahone 7 * All rights reserved. 8 * 9 * Redistribution and use in source and binary forms, with or without 10 * modification, are permitted provided that the following conditions 11 * are met: 12 * 13 * * Redistributions of source code must retain the above copyright 14 * notice, this list of conditions and the following disclaimer. 15 * * Redistributions in binary form must reproduce the above 16 * copyright notice, this list of conditions and the following 17 * disclaimer in the documentation and/or other materials provided 18 * with the distribution. 19 * * Neither the name of the Kentaro A. Kurahone nor the names of its 20 * contributors may be used to endorse or promote products derived 21 * from this software without specific prior written permission. 22 * 23 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 24 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 25 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS 26 * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE 27 * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, 28 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, 29 * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 30 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER 31 * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 32 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN 33 * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 34 * POSSIBILITY OF SUCH DAMAGE. 35 * 36 */ 37 38 #ifndef _DEV_PCKBCPORT_SYNAPTICSVAR_H_ 39 #define _DEV_PCKBCPORT_SYNAPTICSVAR_H_ 40 41 #define SYN_MAX_FINGERS 2 42 #define SYN_PRIMARY_FINGER 0 43 #define SYN_SECONDARY_FINGER 1 44 45 struct synaptics_softc { 46 int caps; 47 48 int flags; 49 #define SYN_FLAG_HAS_MIDDLE_BUTTON (1 << 0) 50 #define SYN_FLAG_HAS_BUTTONS_4_5 (1 << 1) 51 #define SYN_FLAG_HAS_UP_DOWN_BUTTONS (1 << 2) 52 #define SYN_FLAG_HAS_PASSTHROUGH (1 << 3) 53 #define SYN_FLAG_HAS_PALM_DETECT (1 << 4) 54 #define SYN_FLAG_HAS_MULTI_FINGER (1 << 5) 55 #define SYN_FLAG_HAS_MULTI_FINGER_REPORT (1 << 6) 56 #define SYN_FLAG_HAS_VERTICAL_SCROLL (1 << 7) 57 #define SYN_FLAG_HAS_HORIZONTAL_SCROLL (1 << 8) 58 #define SYN_FLAG_HAS_ONE_BUTTON_CLICKPAD (1 << 9) 59 #define SYN_FLAG_HAS_TWO_BUTTON_CLICKPAD (1 << 10) 60 #define SYN_FLAG_HAS_EXTENDED_WMODE (1 << 11) 61 #define SYN_FLAG_HAS_ADV_GESTURE_MODE (1 << 12) 62 #define SYN_FLAG_HAS_MAX_REPORT (1 << 13) 63 #define SYN_FLAG_HAS_MIN_REPORT (1 << 14) 64 65 /* Total number of packets received */ 66 u_int total_packets; 67 68 /* Keep a per finger count for ballistics */ 69 u_int packet_count[SYN_MAX_FINGERS]; 70 71 #define SYN_TIME(sc,c) (((sc)->total_packets >= (c)) ? \ 72 ((sc)->total_packets - (c)) : \ 73 ((c) - (sc)->total_packets)) 74 75 int num_buttons; /* number of external buttons */ 76 uint8_t button_mask; 77 int up_down; 78 int prev_fingers; 79 80 int gesture_start_x, gesture_start_y; 81 int gesture_move_x, gesture_move_y; 82 u_int gesture_start_packet; 83 u_int gesture_tap_packet; 84 85 int gesture_buttons; 86 int gesture_type; 87 #define SYN_GESTURE_SINGLE 0x01 88 #define SYN_GESTURE_DOUBLE 0x02 89 #define SYN_GESTURE_DRAG 0x04 90 #define SYN_IS_SINGLE_TAP(t) ((t) & SYN_GESTURE_SINGLE) 91 #define SYN_IS_DOUBLE_TAP(t) ((t) & SYN_GESTURE_DOUBLE) 92 #define SYN_IS_DRAG(t) ((t) & SYN_GESTURE_DRAG) 93 94 #define SYN_HIST_SIZE 4 95 char button_history; 96 int dz_hold; 97 int rem_x[SYN_MAX_FINGERS]; 98 int rem_y[SYN_MAX_FINGERS]; 99 int rem_z[SYN_MAX_FINGERS]; 100 int history_x[SYN_MAX_FINGERS][SYN_HIST_SIZE]; 101 int history_y[SYN_MAX_FINGERS][SYN_HIST_SIZE]; 102 int history_z[SYN_MAX_FINGERS][SYN_HIST_SIZE]; 103 104 char ext_left; 105 char ext_right; 106 char ext_middle; 107 char ext_up; 108 char ext_down; 109 }; 110 111 int pms_synaptics_probe_init(void *vsc); 112 void pms_synaptics_enable(void *vsc); 113 void pms_synaptics_resume(void *vsc); 114 115 #endif 116