1 /*        $NetBSD: pmsvar.h,v 1.12 2017/08/13 08:49:27 christos Exp $ */
2 
3 /*-
4  * Copyright (c) 2004 Kentaro Kurahone.
5  * Copyright (c) 2004 Ales Krenek.
6  * Copyright (c) 1994 Charles M. Hannum.
7  * Copyright (c) 1992, 1993 Erik Forsberg.
8  * All rights reserved.
9  *
10  * Redistribution and use in source and binary forms, with or without
11  * modification, are permitted provided that the following conditions
12  * are met:
13  * 1. Redistributions of source code must retain the above copyright
14  *    notice, this list of conditions and the following disclaimer.
15  *
16  * THIS SOFTWARE IS PROVIDED BY ``AS IS'' AND ANY EXPRESS OR IMPLIED
17  * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
18  * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.  IN
19  * NO EVENT SHALL I BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
20  * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
21  * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
22  * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
23  * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
24  * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
25  * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26  */
27 
28 #ifndef _DEV_PCKBCPORT_PMSVAR_H_
29 #define _DEV_PCKBCPORT_PMSVAR_H_
30 
31 #include <dev/pckbport/synapticsvar.h>
32 #include <dev/pckbport/elantechvar.h>
33 #include <dev/pckbport/alpsvar.h>
34 
35 enum pms_type {
36           PMS_UNKNOWN,
37           PMS_STANDARD,
38           PMS_SCROLL3,
39           PMS_SCROLL5,
40           PMS_SYNAPTICS,
41           PMS_ELANTECH,
42           PMS_ALPS
43 };
44 
45 struct pms_protocol {
46           int rates[3];
47           int response;
48           const char *name;
49 };
50 
51 struct pms_softc {            /* driver status information */
52           device_t sc_dev;
53 
54           pckbport_tag_t sc_kbctag;
55           pckbport_slot_t sc_kbcslot;
56 
57           int sc_enabled;               /* input enabled? */
58           int inputstate;               /* number of bytes received for this packet */
59           u_int buttons;                /* mouse button status */
60           enum pms_type protocol;
61           unsigned char packet[6];
62           struct timeval last, current;
63 
64           device_t sc_wsmousedev;
65           struct lwp *sc_event_thread;
66 
67 #if defined(PMS_SYNAPTICS_TOUCHPAD) || defined(PMS_ELANTECH_TOUCHPAD) \
68            || defined(PMS_ALPS_TOUCHPAD)
69           union {
70 #ifdef PMS_SYNAPTICS_TOUCHPAD
71                     struct synaptics_softc synaptics;
72 #endif
73 #ifdef PMS_ELANTECH_TOUCHPAD
74                     struct elantech_softc elantech;
75 #endif
76 #ifdef PMS_ALPS_TOUCHPAD
77                     struct alps_softc alps;
78 #endif
79           } u;
80 #endif
81 };
82 
83 int pms_sliced_command(pckbport_tag_t, pckbport_slot_t, u_char);
84 
85 #endif /* _DEV_PCKBCPORT_PMSVAR_H_ */
86