xref: /netbsd-src/sys/dev/pckbport/synapticsvar.h (revision ca453df649ce9db45b64d73678ba06cbccf9aa11)
1 /*	$NetBSD: synapticsvar.h,v 1.4 2005/12/11 12:23:22 christos 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 struct synaptics_softc {
42 	struct proc *syn_thread;
43 	int	caps;
44 
45 	int	flags;
46 #define	SYN_FLAG_HAS_MIDDLE_BUTTON	(1 << 0)
47 #define	SYN_FLAG_HAS_BUTTONS_4_5	(1 << 1)
48 #define	SYN_FLAG_HAS_UP_DOWN_BUTTONS	(1 << 2)
49 #define	SYN_FLAG_HAS_PASSTHROUGH	(1 << 3)	/* Not yet supported */
50 #define	SYN_FLAG_HAS_PALM_DETECT	(1 << 4)
51 #define	SYN_FLAG_HAS_MULTI_FINGER	(1 << 5)
52 
53 	u_int	total_packets;		/* Total number of packets received */
54 #define	SYN_TIME(sc,c)	(((sc)->total_packets >= (c)) ?		\
55 			    ((sc)->total_packets - (c)) :	\
56 			    ((c) - (sc)->total_packets))
57 
58 	int	up_down;
59 	int	prev_fingers;
60 
61 	int	gesture_start_x, gesture_start_y;
62 	u_int	gesture_start_packet;
63 	u_int	gesture_tap_packet;
64 
65 	int	gesture_buttons;
66 	int	gesture_type;
67 #define	SYN_GESTURE_SINGLE	0x01
68 #define	SYN_GESTURE_DOUBLE	0x02
69 #define	SYN_GESTURE_DRAG	0x04
70 #define	SYN_IS_SINGLE_TAP(t)	((t) & SYN_GESTURE_SINGLE)
71 #define	SYN_IS_DOUBLE_TAP(t)	((t) & SYN_GESTURE_DOUBLE)
72 #define	SYN_IS_DRAG(t)		((t) & SYN_GESTURE_DRAG)
73 
74 #define	SYN_HIST_SIZE	4
75 	int	rem_x, rem_y;
76 	u_int	movement_history;
77 	int	history_x[SYN_HIST_SIZE], history_y[SYN_HIST_SIZE];
78 };
79 
80 int pms_synaptics_probe_init(void *vsc);
81 void pms_synaptics_enable(void *vsc);
82 void pms_synaptics_resume(void *vsc);
83 
84 #endif
85