NetBSD/sys/dev/pckbport/synapticsvar.h

85 lines
3.0 KiB
C
Raw Normal View History

2005-12-11 15:16:03 +03:00
/* $NetBSD: synapticsvar.h,v 1.4 2005/12/11 12:23:22 christos Exp $ */
/*
Major re-write of the recently-committed Synaptics Touchpad driver, prompted by jittery and/or random movement during tap gestures, lack of edge motion, and a general desire to make use of the extra features available with the native protocol. - Ditch the kernel thread; it was overkill for the small amount of processing required to deal with touchpad events. - If we fail to probe a Synaptics touchpad, issue a RESET command to ensure that whatever device is out there is left in a sane state (thanks to Reinoud Zandijk for the hint). - Completely re-write gesture support. - Put the touchpad in 80 packets per second mode and count them so they can be used to time gesture durations (instead of using mono_time). - Enhance up/down button support with options to use them to emulate the middle button or Z-axis events (like a traditional wheel mouse). - Add 'edge motion'. If a drag gesture is in progress, and the reported finger position moves to the touchpad's border region, continue to report movement events at a fixed rate as if the finger carried on moving in the same direction. This restores some functionality usually provided by the touchpad's firmware in PS/2 mode. - Filter successive movement events to reduce jitter. When scaling movement events, fold the remainder into the next event to prevent loss of information during slow/small finger movements. Pointer movement is now much more refined. - Add support for touchpads which can report more than one finger on the pad simultaneously. Optionally use this feature for middle/right button emulation (i.e. tap two fingers to emulate middle button). This feature is disabled by default (for now) to avoid surprise pasting of clipboard text. ;-)
2005-01-03 01:37:12 +03:00
* Copyright (c) 2005, Steve C. Woodford
* Copyright (c) 2004, Ales Krenek
* Copyright (c) 2004, Kentaro A. Kurahone
* All rights reserved.
2005-02-27 03:26:58 +03:00
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above
* copyright notice, this list of conditions and the following
* disclaimer in the documentation and/or other materials provided
* with the distribution.
* * Neither the name of the Kentaro A. Kurahone nor the names of its
* contributors may be used to endorse or promote products derived
* from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
* COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
* CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
* ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*
*/
#ifndef _DEV_PCKBCPORT_SYNAPTICSVAR_H_
#define _DEV_PCKBCPORT_SYNAPTICSVAR_H_
struct synaptics_softc {
struct proc *syn_thread;
int caps;
Major re-write of the recently-committed Synaptics Touchpad driver, prompted by jittery and/or random movement during tap gestures, lack of edge motion, and a general desire to make use of the extra features available with the native protocol. - Ditch the kernel thread; it was overkill for the small amount of processing required to deal with touchpad events. - If we fail to probe a Synaptics touchpad, issue a RESET command to ensure that whatever device is out there is left in a sane state (thanks to Reinoud Zandijk for the hint). - Completely re-write gesture support. - Put the touchpad in 80 packets per second mode and count them so they can be used to time gesture durations (instead of using mono_time). - Enhance up/down button support with options to use them to emulate the middle button or Z-axis events (like a traditional wheel mouse). - Add 'edge motion'. If a drag gesture is in progress, and the reported finger position moves to the touchpad's border region, continue to report movement events at a fixed rate as if the finger carried on moving in the same direction. This restores some functionality usually provided by the touchpad's firmware in PS/2 mode. - Filter successive movement events to reduce jitter. When scaling movement events, fold the remainder into the next event to prevent loss of information during slow/small finger movements. Pointer movement is now much more refined. - Add support for touchpads which can report more than one finger on the pad simultaneously. Optionally use this feature for middle/right button emulation (i.e. tap two fingers to emulate middle button). This feature is disabled by default (for now) to avoid surprise pasting of clipboard text. ;-)
2005-01-03 01:37:12 +03:00
int flags;
#define SYN_FLAG_HAS_MIDDLE_BUTTON (1 << 0)
#define SYN_FLAG_HAS_BUTTONS_4_5 (1 << 1)
#define SYN_FLAG_HAS_UP_DOWN_BUTTONS (1 << 2)
#define SYN_FLAG_HAS_PASSTHROUGH (1 << 3) /* Not yet supported */
#define SYN_FLAG_HAS_PALM_DETECT (1 << 4)
#define SYN_FLAG_HAS_MULTI_FINGER (1 << 5)
u_int total_packets; /* Total number of packets received */
#define SYN_TIME(sc,c) (((sc)->total_packets >= (c)) ? \
((sc)->total_packets - (c)) : \
((c) - (sc)->total_packets))
int up_down;
int prev_fingers;
int gesture_start_x, gesture_start_y;
u_int gesture_start_packet;
u_int gesture_tap_packet;
int gesture_buttons;
int gesture_type;
#define SYN_GESTURE_SINGLE 0x01
#define SYN_GESTURE_DOUBLE 0x02
#define SYN_GESTURE_DRAG 0x04
#define SYN_IS_SINGLE_TAP(t) ((t) & SYN_GESTURE_SINGLE)
#define SYN_IS_DOUBLE_TAP(t) ((t) & SYN_GESTURE_DOUBLE)
#define SYN_IS_DRAG(t) ((t) & SYN_GESTURE_DRAG)
#define SYN_HIST_SIZE 4
int rem_x, rem_y;
u_int movement_history;
int history_x[SYN_HIST_SIZE], history_y[SYN_HIST_SIZE];
};
int pms_synaptics_probe_init(void *vsc);
void pms_synaptics_enable(void *vsc);
void pms_synaptics_resume(void *vsc);
#endif