diff options
author | Alexandr Shadchin <shadchin@cvs.openbsd.org> | 2010-12-27 12:22:21 +0000 |
---|---|---|
committer | Alexandr Shadchin <shadchin@cvs.openbsd.org> | 2010-12-27 12:22:21 +0000 |
commit | d90fbd5c9043e4b34d32cb213fec7a7d948ea7aa (patch) | |
tree | f6c5e2307981a2090da741c6de556578b1ae7c11 /sys/dev | |
parent | 258e524908a2d1e8c26c47723cad189b90393565 (diff) |
cleanup pms_enable_intelli: magic numbers -> defines
ok krw, miod
Diffstat (limited to 'sys/dev')
-rw-r--r-- | sys/dev/pckbc/pms.c | 19 |
1 files changed, 12 insertions, 7 deletions
diff --git a/sys/dev/pckbc/pms.c b/sys/dev/pckbc/pms.c index ab6cf566130..acfd87c184d 100644 --- a/sys/dev/pckbc/pms.c +++ b/sys/dev/pckbc/pms.c @@ -1,4 +1,4 @@ -/* $OpenBSD: pms.c,v 1.16 2010/12/24 18:22:20 shadchin Exp $ */ +/* $OpenBSD: pms.c,v 1.17 2010/12/27 12:22:20 shadchin Exp $ */ /* $NetBSD: psm.c,v 1.11 2000/06/05 22:20:57 sommerfeld Exp $ */ /*- @@ -98,6 +98,11 @@ static const u_int butmap[8] = { #define PMS_PS2_XNEG 0x10 #define PMS_PS2_YNEG 0x20 +#define PMS_INTELLI_MAGIC1 200 +#define PMS_INTELLI_MAGIC2 100 +#define PMS_INTELLI_MAGIC3 80 +#define PMS_INTELLI_ID 0x03 + int pmsprobe(struct device *, void *, void *); void pmsattach(struct device *, struct device *, void *); int pmsactivate(struct device *, int); @@ -273,14 +278,14 @@ pms_dev_disable(struct pms_softc *sc) int pms_enable_intelli(struct pms_softc *sc) { - static const int rates[] = {200, 100, 80}; u_char resp; - if (pms_set_rate(sc, rates[0]) || - pms_set_rate(sc, rates[1]) || - pms_set_rate(sc, rates[2]) || + /* the special sequence to enable the third button and the roller */ + if (pms_set_rate(sc, PMS_INTELLI_MAGIC1) || + pms_set_rate(sc, PMS_INTELLI_MAGIC2) || + pms_set_rate(sc, PMS_INTELLI_MAGIC3) || pms_get_devid(sc, &resp) || - resp != 0x03) + resp != PMS_INTELLI_ID) return (0); return (1); @@ -505,7 +510,7 @@ pms_ioctl(void *v, u_long cmd, caddr_t data, int flag, struct proc *p) struct pms_softc *sc = v; if (sc->protocol && sc->protocol->ioctl) - return(sc->protocol->ioctl(sc, cmd, data, flag, p)); + return (sc->protocol->ioctl(sc, cmd, data, flag, p)); else return (-1); } |