summaryrefslogtreecommitdiff
path: root/ps2comm.c
diff options
context:
space:
mode:
authorPeter Osterlund <petero2@telia.com>2003-07-16 22:56:01 +0200
committerPeter Osterlund <petero2@telia.com>2006-04-09 04:01:03 +0200
commitd453ae378bd17fe65478bfe0d032167f48191e42 (patch)
tree605e65e00591addc261dbbc4a5c44d3e495f6458 /ps2comm.c
parentd37453a3368e051580bb73ecccdbe4fc5f6cf6c0 (diff)
Added proper support for "multi buttons". The old code
referred to this as six_button mode, but this mode was activated based on firmware version, which was not correct. From Hartwig Felger.
Diffstat (limited to 'ps2comm.c')
-rw-r--r--ps2comm.c17
1 files changed, 16 insertions, 1 deletions
diff --git a/ps2comm.c b/ps2comm.c
index 1199280..11b1f32 100644
--- a/ps2comm.c
+++ b/ps2comm.c
@@ -54,6 +54,7 @@
#define SYN_QUE_SERIAL_NUMBER_PREFIX 0x06
#define SYN_QUE_SERIAL_NUMBER_SUFFIX 0x07
#define SYN_QUE_RESOLUTION 0x08
+#define SYN_QUE_EXT_CAPAB 0x09
/* status request response bits (PS2_CMD_STATUS_REQUEST) */
#define PS2_RES_REMOTE(r) (r&(1<<22))
@@ -257,7 +258,7 @@ synaptics_model_id(int fd, unsigned long int *model_id)
* see also the SYN_CAP_* macros
*/
Bool
-synaptics_capability(int fd, unsigned long int *capability)
+synaptics_capability(int fd, unsigned long int *capability, unsigned long int *ext_capab)
{
byte cap[3];
@@ -265,6 +266,7 @@ synaptics_capability(int fd, unsigned long int *capability)
ErrorF("Read capabilites...\n");
#endif
+ *ext_capab = 0;
if((ps2_send_cmd(fd, SYN_QUE_CAPABILITIES) == Success) &&
(ps2_getbyte(fd, &cap[0]) == Success) &&
(ps2_getbyte(fd, &cap[1]) == Success) &&
@@ -274,6 +276,19 @@ synaptics_capability(int fd, unsigned long int *capability)
ErrorF("capability %06X\n", *capability);
#endif
if(SYN_CAP_VALID(*capability)) {
+ if(SYN_EXT_CAP_REQUESTS(*capability)) {
+ if((ps2_send_cmd(fd, SYN_QUE_EXT_CAPAB) == Success) &&
+ (ps2_getbyte(fd, &cap[0]) == Success) &&
+ (ps2_getbyte(fd, &cap[1]) == Success) &&
+ (ps2_getbyte(fd, &cap[2]) == Success)) {
+ *ext_capab = (cap[0]<<16) | (cap[1]<<8) | cap[2];
+#ifdef DEBUG
+ ErrorF("ext-capability %06X\n", *ext_capab);
+#endif
+ } else {
+ ErrorF("synaptics says, that it has extended-capabilities, but I cannot read them.");
+ }
+ }
#ifdef DEBUG
ErrorF("...done.\n");
#endif