]> git.proxmox.com Git - mirror_ubuntu-bionic-kernel.git/commitdiff
UBUNTU: SAUCE: (no-up) Input: Cypress PS/2 Trackpad simulated multitouch
authorKamal Mostafa <kamal@canonical.com>
Wed, 5 Dec 2012 21:30:48 +0000 (13:30 -0800)
committerSeth Forshee <seth.forshee@canonical.com>
Mon, 29 Jan 2018 13:44:49 +0000 (07:44 -0600)
Upstream doesn't like this patch.

Instead of SEMI_MT, present a full mt interface with simulated contact
positions for >=3 fingers.  Enables e.g. multi-finger tap and drag for
old userspace applications which only count the contact positions.

Signed-off-by: Kamal Mostafa <kamal@canonical.com>
Signed-off-by: Tim Gardner <tim.gardner@canonical.com>
drivers/input/mouse/cypress_ps2.c
drivers/input/mouse/cypress_ps2.h

index 21bad3e75feed25e3d4de34b6f2ae94697ceb894..125f72cf9814a957cd12fb4b093bf584a0ac60f3 100644 (file)
@@ -390,7 +390,9 @@ static int cypress_set_input_params(struct input_dev *input,
        if (ret < 0)
                return ret;
 
+#if ( CYPRESS_SIMULATED_MT != 1 )
        __set_bit(INPUT_PROP_SEMI_MT, input->propbit);
+#endif
 
        input_abs_set_res(input, ABS_X, cytp->tp_res_x);
        input_abs_set_res(input, ABS_Y, cytp->tp_res_y);
@@ -476,6 +478,22 @@ static int cypress_parse_packet(struct psmouse *psmouse,
                        ((packet[5] & 0x0f) << 8) | packet[7];
                if (cytp->mode & CYTP_BIT_ABS_PRESSURE)
                        report_data->contacts[1].z = report_data->contacts[0].z;
+#if ( CYPRESS_SIMULATED_MT == 1 )
+               /* simulate contact positions for >2 fingers */
+               if ( report_data->contact_cnt >= 3 ) {
+                       int i;
+                       for ( i=1; i<report_data->contact_cnt; i++ ) {
+                           report_data->contacts[i].x =
+                                           report_data->contacts[0].x
+                                           + 100*(i)*((i%2)?-1:1);
+                           report_data->contacts[i].y =
+                                           report_data->contacts[0].y;
+                           if (cytp->mode & CYTP_BIT_ABS_PRESSURE)
+                                   report_data->contacts[i].z =
+                                           report_data->contacts[0].z;
+                       }
+               }
+#endif
        }
 
        report_data->left = (header_byte & BTN_LEFT_BIT) ? 1 : 0;
index 1eaddd81800460be0157cbcc71545dc0f6f31e7d..8456830fb0b86e38ae04a82a0bebfc54e16e499f 100644 (file)
 #define RESP_REMOTE_BIT     0x40
 #define RESP_SMBUS_BIT      0x80
 
-#define CYTP_MAX_MT_SLOTS 2
+/*
+ * CYPRESS_SIMULATED_MT
+ *   set to 1 for simulated multitouch (up to 5 contact points)
+ *   set to 0 for SEMI_MT (only 2 corner points, and count of fingers)
+ */
+#define CYPRESS_SIMULATED_MT 1
+
+#if ( CYPRESS_SIMULATED_MT == 1 )
+# define CYTP_MAX_MT_SLOTS 5
+#else
+# define CYTP_MAX_MT_SLOTS 2
+#endif
 
 struct cytp_contact {
        int x;