~ubuntu-branches/ubuntu/karmic/xserver-xorg-input-synaptics/karmic

« back to all changes in this revision

Viewing changes to src/ps2comm.h

  • Committer: Bazaar Package Importer
  • Author(s): Julien Cristau
  • Date: 2009-01-26 09:08:10 UTC
  • Revision ID: james.westby@ubuntu.com-20090126090810-w8o8kcse5zqwwzae
Tags: upstream-0.99.3
ImportĀ upstreamĀ versionĀ 0.99.3

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/*
 
2
 * Permission to use, copy, modify, distribute, and sell this software
 
3
 * and its documentation for any purpose is hereby granted without
 
4
 * fee, provided that the above copyright notice appear in all copies
 
5
 * and that both that copyright notice and this permission notice
 
6
 * appear in supporting documentation, and that the name of Red Hat
 
7
 * not be used in advertising or publicity pertaining to distribution
 
8
 * of the software without specific, written prior permission.  Red
 
9
 * Hat makes no representations about the suitability of this software
 
10
 * for any purpose.  It is provided "as is" without express or implied
 
11
 * warranty.
 
12
 *
 
13
 * THE AUTHORS DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
 
14
 * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN
 
15
 * NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY SPECIAL, INDIRECT OR
 
16
 * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS
 
17
 * OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT,
 
18
 * NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN
 
19
 * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
 
20
 */
 
21
 
 
22
#ifndef _PS2COMM_H_
 
23
#define _PS2COMM_H_
 
24
 
 
25
#include <unistd.h>
 
26
#include <sys/ioctl.h>
 
27
#include "xf86_OSproc.h"
 
28
 
 
29
/* acknowledge for commands and parameter */
 
30
#define PS2_ACK                         0xFA
 
31
#define PS2_ERROR                       0xFC
 
32
 
 
33
/* standard PS/2 commands */
 
34
#define PS2_CMD_RESET                   0xFF
 
35
#define PS2_CMD_RESEND                  0xFE
 
36
#define PS2_CMD_SET_DEFAULT             0xF6
 
37
#define PS2_CMD_DISABLE                 0xF5
 
38
#define PS2_CMD_ENABLE                  0xF4
 
39
#define PS2_CMD_SET_SAMPLE_RATE         0xF3
 
40
#define PS2_CMD_READ_DEVICE_TYPE        0xF2
 
41
#define PS2_CMD_SET_REMOTE_MODE         0xF0
 
42
#define PS2_CMD_SET_WRAP_MODE           0xEE
 
43
#define PS2_CMD_RESET_WRAP_MODE         0xEC
 
44
#define PS2_CMD_READ_DATA               0xEB
 
45
#define PS2_CMD_SET_STREAM_MODE         0xEA
 
46
#define PS2_CMD_STATUS_REQUEST          0xE9
 
47
#define PS2_CMD_SET_RESOLUTION          0xE8
 
48
#define PS2_CMD_SET_SCALING_2_1         0xE7
 
49
#define PS2_CMD_SET_SCALING_1_1         0xE6
 
50
 
 
51
/* synaptics modes */
 
52
#define SYN_BIT_ABSOLUTE_MODE           (1 << 7)
 
53
#define SYN_BIT_HIGH_RATE               (1 << 6)
 
54
#define SYN_BIT_SLEEP_MODE              (1 << 3)
 
55
#define SYN_BIT_DISABLE_GESTURE         (1 << 2)
 
56
#define SYN_BIT_W_MODE                  (1 << 0)
 
57
 
 
58
/* synaptics model ID bits */
 
59
#define SYN_MODEL_ROT180(synhw)         ((synhw).model_id & (1 << 23))
 
60
#define SYN_MODEL_PORTRAIT(synhw)       ((synhw).model_id & (1 << 22))
 
61
#define SYN_MODEL_SENSOR(synhw)         (((synhw).model_id >> 16) & 0x3f)
 
62
#define SYN_MODEL_HARDWARE(synhw)       (((synhw).model_id >> 9) & 0x7f)
 
63
#define SYN_MODEL_NEWABS(synhw)         ((synhw).model_id & (1 << 7))
 
64
#define SYN_MODEL_PEN(synhw)            ((synhw).model_id & (1 << 6))
 
65
#define SYN_MODEL_SIMPLIC(synhw)        ((synhw).model_id & (1 << 5))
 
66
#define SYN_MODEL_GEOMETRY(synhw)       ((synhw).model_id & 0x0f)
 
67
 
 
68
/* synaptics capability bits */
 
69
#define SYN_CAP_EXTENDED(synhw)         ((synhw).capabilities & (1 << 23))
 
70
#define SYN_CAP_MIDDLE_BUTTON(synhw)    ((synhw).capabilities & (1 << 18))
 
71
#define SYN_CAP_PASSTHROUGH(synhw)      ((synhw).capabilities & (1 << 7))
 
72
#define SYN_CAP_SLEEP(synhw)            ((synhw).capabilities & (1 << 4))
 
73
#define SYN_CAP_FOUR_BUTTON(synhw)      ((synhw).capabilities & (1 << 3))
 
74
#define SYN_CAP_MULTIFINGER(synhw)      ((synhw).capabilities & (1 << 1))
 
75
#define SYN_CAP_PALMDETECT(synhw)       ((synhw).capabilities & (1 << 0))
 
76
#define SYN_CAP_VALID(synhw)            ((((synhw).capabilities & 0x00ff00) >> 8) == 0x47)
 
77
#define SYN_EXT_CAP_REQUESTS(synhw)     (((synhw).capabilities & 0x700000) == 0x100000)
 
78
#define SYN_CAP_MULTI_BUTTON_NO(synhw)  (((synhw).ext_cap & 0x00f000) >> 12)
 
79
 
 
80
/* synaptics modes query bits */
 
81
#define SYN_MODE_ABSOLUTE(m)            ((m) & (1 << 7))
 
82
#define SYN_MODE_RATE(m)                ((m) & (1 << 6))
 
83
#define SYN_MODE_BAUD_SLEEP(m)          ((m) & (1 << 3))
 
84
#define SYN_MODE_DISABLE_GESTURE(m)     ((m) & (1 << 2))
 
85
#define SYN_MODE_PACKSIZE(m)            ((m) & (1 << 1))
 
86
#define SYN_MODE_WMODE(m)               ((m) & (1 << 0))
 
87
#define SYN_MODE_VALID(m)               (((m) & 0xffff00) == 0x3B47)
 
88
 
 
89
/* synaptics identify query bits */
 
90
#define SYN_ID_MODEL(synhw)             (((synhw).identity >> 4) & 0x0f)
 
91
#define SYN_ID_MAJOR(synhw)             ((synhw).identity & 0x0f)
 
92
#define SYN_ID_MINOR(synhw)             (((synhw).identity >> 16) & 0xff)
 
93
#define SYN_ID_IS_SYNAPTICS(synhw)      ((((synhw).identity >> 8) & 0xff) == 0x47)
 
94
 
 
95
typedef unsigned char byte;
 
96
 
 
97
 
 
98
Bool ps2_putbyte(int fd, byte b);
 
99
 
 
100
struct SynapticsHwInfo;
 
101
void ps2_print_ident(const struct SynapticsHwInfo *synhw);
 
102
 
 
103
#endif /* _PS2COMM_H_ */