summaryrefslogtreecommitdiff
path: root/ps2comm.h
diff options
context:
space:
mode:
authorPeter Osterlund <petero2@telia.com>2004-04-04 22:23:08 +0200
committerPeter Osterlund <petero2@telia.com>2006-04-09 04:01:56 +0200
commitf56d238d28567c0c23270a72ff656255f4fd8e0d (patch)
tree256b70f6722da7dbed174a0fecd2d0476b9d4b94 /ps2comm.h
parent30a409af6f888e47108bb8f1a57118217b8dd799 (diff)
Some changes to make supporting FreeBSD easier. From Arne
Schwabe <arne@rfc2549.org>, with some editing by me.
Diffstat (limited to 'ps2comm.h')
-rw-r--r--ps2comm.h61
1 files changed, 31 insertions, 30 deletions
diff --git a/ps2comm.h b/ps2comm.h
index 8450151..326e4b1 100644
--- a/ps2comm.h
+++ b/ps2comm.h
@@ -9,40 +9,40 @@
#define SYN_BIT_W_MODE (1 << 0)
/* synaptics model ID bits */
-#define SYN_MODEL_ROT180(m) ((m) & (1 << 23))
-#define SYN_MODEL_PORTRAIT(m) ((m) & (1 << 22))
-#define SYN_MODEL_SENSOR(m) (((m) >> 16) & 0x3f)
-#define SYN_MODEL_HARDWARE(m) (((m) >> 9) & 0x7f)
-#define SYN_MODEL_NEWABS(m) ((m) & (1 << 7))
-#define SYN_MODEL_PEN(m) ((m) & (1 << 6))
-#define SYN_MODEL_SIMPLIC(m) ((m) & (1 << 5))
-#define SYN_MODEL_GEOMETRY(m) ((m) & 0x0f)
+#define SYN_MODEL_ROT180(synhw) ((synhw).model_id & (1 << 23))
+#define SYN_MODEL_PORTRAIT(synhw) ((synhw).model_id & (1 << 22))
+#define SYN_MODEL_SENSOR(synhw) (((synhw).model_id >> 16) & 0x3f)
+#define SYN_MODEL_HARDWARE(synhw) (((synhw).model_id >> 9) & 0x7f)
+#define SYN_MODEL_NEWABS(synhw) ((synhw).model_id & (1 << 7))
+#define SYN_MODEL_PEN(synhw) ((synhw).model_id & (1 << 6))
+#define SYN_MODEL_SIMPLIC(synhw) ((synhw).model_id & (1 << 5))
+#define SYN_MODEL_GEOMETRY(synhw) ((synhw).model_id & 0x0f)
/* synaptics capability bits */
-#define SYN_CAP_EXTENDED(c) ((c) & (1 << 23))
-#define SYN_CAP_PASSTHROUGH(c) ((c) & (1 << 7))
-#define SYN_CAP_SLEEP(c) ((c) & (1 << 4))
-#define SYN_CAP_FOUR_BUTTON(c) ((c) & (1 << 3))
-#define SYN_CAP_MULTIFINGER(c) ((c) & (1 << 1))
-#define SYN_CAP_PALMDETECT(c) ((c) & (1 << 0))
-#define SYN_CAP_VALID(c) ((((c) & 0x00ff00) >> 8) == 0x47)
-#define SYN_EXT_CAP_REQUESTS(c) (((c) & 0x700000) == 0x100000)
-#define SYN_CAP_MULTI_BUTTON_NO(ec) (((ec) & 0x00f000) >> 12)
+#define SYN_CAP_EXTENDED(synhw) ((synhw).capabilities & (1 << 23))
+#define SYN_CAP_PASSTHROUGH(synhw) ((synhw).capabilities & (1 << 7))
+#define SYN_CAP_SLEEP(synhw) ((synhw).capabilities & (1 << 4))
+#define SYN_CAP_FOUR_BUTTON(synhw) ((synhw).capabilities & (1 << 3))
+#define SYN_CAP_MULTIFINGER(synhw) ((synhw).capabilities & (1 << 1))
+#define SYN_CAP_PALMDETECT(synhw) ((synhw).capabilities & (1 << 0))
+#define SYN_CAP_VALID(synhw) ((((synhw).capabilities & 0x00ff00) >> 8) == 0x47)
+#define SYN_EXT_CAP_REQUESTS(synhw) (((synhw).capabilities & 0x700000) == 0x100000)
+#define SYN_CAP_MULTI_BUTTON_NO(synhw) (((synhw).ext_cap & 0x00f000) >> 12)
/* synaptics modes query bits */
-#define SYN_MODE_ABSOLUTE(m) ((m) & (1 << 7))
-#define SYN_MODE_RATE(m) ((m) & (1 << 6))
-#define SYN_MODE_BAUD_SLEEP(m) ((m) & (1 << 3))
-#define SYN_MODE_DISABLE_GESTURE(m) ((m) & (1 << 2))
-#define SYN_MODE_PACKSIZE(m) ((m) & (1 << 1))
-#define SYN_MODE_WMODE(m) ((m) & (1 << 0))
-#define SYN_MODE_VALID(m) (((m) & 0xffff00) == 0x3B47)
+#define SYN_MODE_ABSOLUTE(synhw) ((synhw).model_id & (1 << 7))
+#define SYN_MODE_RATE(synhw) ((synhw).model_id & (1 << 6))
+#define SYN_MODE_BAUD_SLEEP(synhw) ((synhw).model_id & (1 << 3))
+#define SYN_MODE_DISABLE_GESTURE(synhw) ((synhw).model_id & (1 << 2))
+#define SYN_MODE_PACKSIZE(synhw) ((synhw).model_id & (1 << 1))
+#define SYN_MODE_WMODE(synhw) ((synhw).model_id & (1 << 0))
+#define SYN_MODE_VALID(synhw) (((synhw).model_id & 0xffff00) == 0x3B47)
/* synaptics identify query bits */
-#define SYN_ID_MODEL(i) (((i) >> 4) & 0x0f)
-#define SYN_ID_MAJOR(i) ((i) & 0x0f)
-#define SYN_ID_MINOR(i) (((i) >> 16) & 0xff)
-#define SYN_ID_IS_SYNAPTICS(i) ((((i) >> 8) & 0xff) == 0x47)
+#define SYN_ID_MODEL(synhw) (((synhw).identity >> 4) & 0x0f)
+#define SYN_ID_MAJOR(synhw) ((synhw).identity & 0x0f)
+#define SYN_ID_MINOR(synhw) (((synhw).identity >> 16) & 0xff)
+#define SYN_ID_IS_SYNAPTICS(synhw) ((((synhw).identity >> 8) & 0xff) == 0x47)
typedef unsigned char byte;
@@ -52,11 +52,12 @@ synaptics_reset(int fd);
Bool
synaptics_model_id(int fd, unsigned long int *model_id);
+struct synapticshw;
Bool
-synaptics_capability(int fd, unsigned long int *capability, unsigned long int *ext_capab);
+synaptics_capability(int fd, struct synapticshw *synhw);
Bool
-synaptics_identify(int fd, unsigned long int *ident);
+synaptics_identify(int fd, struct synapticshw *synhw);
Bool
synaptics_set_mode(int fd, byte cmd);