diff options
-rw-r--r-- | sys/dev/pckbc/pms.c | 37 | ||||
-rw-r--r-- | sys/dev/pckbc/pmsreg.h | 7 |
2 files changed, 42 insertions, 2 deletions
diff --git a/sys/dev/pckbc/pms.c b/sys/dev/pckbc/pms.c index 7206c529c95..3a3ef2ff48d 100644 --- a/sys/dev/pckbc/pms.c +++ b/sys/dev/pckbc/pms.c @@ -1,4 +1,4 @@ -/* $OpenBSD: pms.c,v 1.19 2011/08/17 16:10:27 shadchin Exp $ */ +/* $OpenBSD: pms.c,v 1.20 2011/08/22 16:26:42 shadchin Exp $ */ /* $NetBSD: psm.c,v 1.11 2000/06/05 22:20:57 sommerfeld Exp $ */ /*- @@ -50,6 +50,7 @@ struct pms_protocol { #define PMS_STANDARD 0 #define PMS_INTELLI 1 #define PMS_SYNAPTICS 2 +#define PMS_ALPS 3 u_int packetsize; int (*enable)(struct pms_softc *); int (*ioctl)(struct pms_softc *, u_long, caddr_t, int, struct proc *); @@ -150,6 +151,8 @@ int pms_sync_synaptics(struct pms_softc *, int); void pms_proc_synaptics(struct pms_softc *); void pms_disable_synaptics(struct pms_softc *); +int pms_enable_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 *); @@ -208,6 +211,15 @@ const struct pms_protocol pms_protocols[] = { pms_sync_synaptics, pms_proc_synaptics, pms_disable_synaptics + }, + /* ALPS touchpad - not supported yet */ + { + PMS_ALPS, 3, + pms_enable_alps, + pms_ioctl_mouse, + pms_sync_mouse, + pms_proc_mouse, + NULL } }; @@ -383,6 +395,7 @@ pms_sync_mouse(struct pms_softc *sc, int data) switch (sc->protocol->type) { case PMS_STANDARD: + case PMS_ALPS: /* XXX */ if ((data & 0xc0) != 0) return (-1); break; @@ -409,6 +422,7 @@ pms_proc_mouse(struct pms_softc *sc) switch (sc->protocol->type) { case PMS_STANDARD: + case PMS_ALPS: /* XXX */ dz = 0; break; case PMS_INTELLI: @@ -966,3 +980,24 @@ pms_disable_synaptics(struct pms_softc *sc) synaptics_set_mode(sc, SYNAPTICS_SLEEP_MODE | SYNAPTICS_DISABLE_GESTURE); } + +int +pms_enable_alps(struct pms_softc *sc) +{ + u_char resp[3]; + + if (pms_set_resolution(sc, 0) || + pms_set_scaling(sc, 1) || + pms_set_scaling(sc, 1) || + pms_set_scaling(sc, 1) || + pms_get_status(sc, resp) || + resp[0] != PMS_ALPS_MAGIC1 || + resp[1] != PMS_ALPS_MAGIC2 || + (resp[2] != PMS_ALPS_MAGIC3_1 && resp[2] != PMS_ALPS_MAGIC3_2)) + return (0); + + /* XXX reset, ALPS not supported yet */ + pms_reset(sc); + + return (1); +} diff --git a/sys/dev/pckbc/pmsreg.h b/sys/dev/pckbc/pmsreg.h index 35229debaf7..4df356f2149 100644 --- a/sys/dev/pckbc/pmsreg.h +++ b/sys/dev/pckbc/pmsreg.h @@ -1,4 +1,4 @@ -/* $OpenBSD: pmsreg.h,v 1.2 2011/08/17 16:10:27 shadchin Exp $ */ +/* $OpenBSD: pmsreg.h,v 1.3 2011/08/22 16:26:42 shadchin Exp $ */ /* $NetBSD: psmreg.h,v 1.1 1998/03/22 15:41:28 drochner Exp $ */ #ifndef SYS_DEV_PCKBC_PMSREG_H @@ -37,6 +37,11 @@ #define PMS_INTELLI_MAGIC3 80 #define PMS_INTELLI_ID 0x03 +#define PMS_ALPS_MAGIC1 0 +#define PMS_ALPS_MAGIC2 0 +#define PMS_ALPS_MAGIC3_1 10 +#define PMS_ALPS_MAGIC3_2 100 + /* Synaptics queries */ #define SYNAPTICS_QUE_IDENTIFY 0x00 #define SYNAPTICS_QUE_MODES 0x01 |