On Tue, Sep 06, 2011 at 02:25:47PM +0200, Martin Pieuchot wrote:
On 04/09/11(Sun) 21:36, Martin Pieuchot wrote:
The diff below adds support for ALPS touchpads to the pms(4) driver.
I'm looking for testers with or without ALPS hardware, especially if you
have a touchpad, to be sure it doesn't break anything.
Currently, ALPS DualPoint are untested and support for special buttons
(back, forward, etc) is missing because I don't have such hardware.
I use the following synaptics(4) configuration for edge scrolling and
simple left tapping:
xinput set-prop /dev/wsmouse0 Synaptics Finger 25 30 60
xinput set-int-prop /dev/wsmouse0 Synaptics Tap Action 8 0 0 2 3 1 0 0
xinput set-int-prop /dev/wsmouse0 Synaptics Click Action 8 1 0 0
xinput set-int-prop /dev/wsmouse0 Synaptics Edge Scrolling 8 1 0 0
Compared to the previous version, I left the Y-axis translation because
it's also needed for the COMPAT mode.
New version of the diff. Recent ALPS touchpads use a totally different
protocol and are not supported.
Martin
Index: pms.c
===
RCS file: /cvs/src/sys/dev/pckbc/pms.c,v
retrieving revision 1.21
diff -u -p -r1.21 pms.c
--- pms.c 24 Aug 2011 15:34:25 - 1.21
+++ pms.c 6 Sep 2011 09:19:24 -
@@ -39,6 +39,14 @@
#include dev/wscons/wsconsio.h
#include dev/wscons/wsmousevar.h
+#define DEBUG
+
+#ifdef DEBUG
+#define DPRINTF(x...)do { printf(x); } while (0);
+#else
+#define DPRINTF(x...)
+#endif
+
#define DEVNAME(sc) ((sc)-sc_dev.dv_xname)
#define WSMOUSE_BUTTON(x)(1 ((x) - 1))
@@ -50,6 +58,7 @@ struct pms_protocol {
#define PMS_STANDARD 0
#define PMS_INTELLI 1
#define PMS_SYNAPTICS2
+#define PMS_ALPS 3
u_int packetsize;
int (*enable)(struct pms_softc *);
int (*ioctl)(struct pms_softc *, u_long, caddr_t, int, struct proc *);
@@ -78,6 +87,22 @@ struct synaptics_softc {
#define SYNAPTICS_PRESSURE 30
};
+struct alps_softc {
+ int model;
+#define ALPS_UNSUPPORTED (1 1)
+#define ALPS_PASSTHROUGH (1 2)
+
+ int min_x, min_y;
+ int max_x, max_y;
+ int old_fin;
+
+ /* Compat mode */
+ int wsmode;
+ int old_x, old_y;
+ u_int old_buttons;
+#define ALPS_PRESSURE40
+};
+
struct pms_softc { /* driver status information */
struct device sc_dev;
@@ -98,6 +123,7 @@ struct pms_softc { /* driver status inf
const struct pms_protocol *protocol;
struct synaptics_softc *synaptics;
+ struct alps_softc *alps;
u_char packet[8];
@@ -116,6 +142,20 @@ static const u_int butmap[8] = {
WSMOUSE_BUTTON(1) | WSMOUSE_BUTTON(2) | WSMOUSE_BUTTON(3)
};
+static const struct alps_quirk {
+ int version;
+ int model;
+} alps_quirks[] = {
+ { 0x2021, ALPS_PASSTHROUGH },
+ { 0x2221, ALPS_PASSTHROUGH },
+ { 0x, ALPS_PASSTHROUGH },
+ { 0x3222, ALPS_PASSTHROUGH },
+ { 0x5212, ALPS_PASSTHROUGH },
+ { 0x6222, ALPS_PASSTHROUGH },
+ { 0x633b, ALPS_PASSTHROUGH },
+ { 0x7326, ALPS_UNSUPPORTED }, /* XXX Uses unknown v3 protocol */
+};
Using { 0x7326, ALPS_UNSUPPORTED } is not best idea.
Instead
if (alps-model ALPS_UNSUPPORTED)
use
if (alps-model == 0)
or even better
#define ALPS_UNSUPPORTED 0
...
if (alps-model == ALPS_UNSUPPORTED)
If the device is not in alps_quirks, then it will automatically be
ALPS_UNSUPPORTED. No need to register each device is not supported.
+
int pmsprobe(struct device *, void *, void *);
void pmsattach(struct device *, struct device *, void *);
int pmsactivate(struct device *, int);
@@ -150,6 +190,11 @@ int pms_sync_synaptics(struct pms_softc
void pms_proc_synaptics(struct pms_softc *);
void pms_disable_synaptics(struct pms_softc *);
+int pms_enable_alps(struct pms_softc *);
+int pms_ioctl_alps(struct pms_softc *, u_long, caddr_t, int, struct proc *);
+int pms_sync_alps(struct pms_softc *, int);
+void pms_proc_alps(struct pms_softc *);
+
int synaptics_set_mode(struct pms_softc *, int);
int synaptics_query(struct pms_softc *, int, int *);
int synaptics_get_hwinfo(struct pms_softc *);
@@ -160,6 +205,8 @@ int synaptics_pt_ioctl(void *, u_long, c
int synaptics_pt_enable(void *);
void synaptics_pt_disable(void *);
+int alps_get_hwinfo(struct pms_softc *);
+
struct cfattach pms_ca = {
sizeof(struct pms_softc), pmsprobe, pmsattach, NULL,
pmsactivate
@@ -208,7 +255,16 @@ const struct pms_protocol pms_protocols[
pms_sync_synaptics,
pms_proc_synaptics,
pms_disable_synaptics
- }
+ },
+ /* ALPS touchpad */
+ {
+ PMS_ALPS, 6,
+ pms_enable_alps,
+ pms_ioctl_alps,
+ pms_sync_alps,
+