Deleted Added
full compact
psm.c (334763) psm.c (343158)
1/*-
2 * Copyright (c) 1992, 1993 Erik Forsberg.
3 * Copyright (c) 1996, 1997 Kazutaka YOKOTA.
4 * All rights reserved.
5 *
6 * Redistribution and use in source and binary forms, with or without
7 * modification, are permitted provided that the following conditions
8 * are met:

--- 45 unchanged lines hidden (view full) ---

54 * HiNote UltraII/Latitude/Armada laptops.
55 * - 30 July 1997. Added APM support.
56 * - 5 March 1997. Defined driver configuration flags (PSM_CONFIG_XXX).
57 * Improved sync check logic.
58 * Vendor specific support routines.
59 */
60
61#include <sys/cdefs.h>
1/*-
2 * Copyright (c) 1992, 1993 Erik Forsberg.
3 * Copyright (c) 1996, 1997 Kazutaka YOKOTA.
4 * All rights reserved.
5 *
6 * Redistribution and use in source and binary forms, with or without
7 * modification, are permitted provided that the following conditions
8 * are met:

--- 45 unchanged lines hidden (view full) ---

54 * HiNote UltraII/Latitude/Armada laptops.
55 * - 30 July 1997. Added APM support.
56 * - 5 March 1997. Defined driver configuration flags (PSM_CONFIG_XXX).
57 * Improved sync check logic.
58 * Vendor specific support routines.
59 */
60
61#include <sys/cdefs.h>
62__FBSDID("$FreeBSD: stable/11/sys/dev/atkbdc/psm.c 334763 2018-06-07 07:43:58Z hselasky $");
62__FBSDID("$FreeBSD: stable/11/sys/dev/atkbdc/psm.c 343158 2019-01-18 21:12:00Z wulf $");
63
64#include "opt_isa.h"
65#include "opt_psm.h"
66#include "opt_evdev.h"
67
68#include <sys/param.h>
69#include <sys/systm.h>
70#include <sys/kernel.h>

--- 60 unchanged lines hidden (view full) ---

131/* end of driver specific options */
132
133#define PSMCPNP_DRIVER_NAME "psmcpnp"
134
135struct psmcpnp_softc {
136 enum {
137 PSMCPNP_GENERIC,
138 PSMCPNP_FORCEPAD,
63
64#include "opt_isa.h"
65#include "opt_psm.h"
66#include "opt_evdev.h"
67
68#include <sys/param.h>
69#include <sys/systm.h>
70#include <sys/kernel.h>

--- 60 unchanged lines hidden (view full) ---

131/* end of driver specific options */
132
133#define PSMCPNP_DRIVER_NAME "psmcpnp"
134
135struct psmcpnp_softc {
136 enum {
137 PSMCPNP_GENERIC,
138 PSMCPNP_FORCEPAD,
139 PSMCPNP_HPSYN81,
140 } type; /* Based on PnP ID */
141};
142
143/* input queue */
144#define PSM_BUFSIZE 960
145#define PSM_SMALLBUFSIZE 240
146
147/* operation levels */
148#define PSM_LEVEL_BASE 0
149#define PSM_LEVEL_STANDARD 1
150#define PSM_LEVEL_NATIVE 2
151#define PSM_LEVEL_MIN PSM_LEVEL_BASE
152#define PSM_LEVEL_MAX PSM_LEVEL_NATIVE
153
139 } type; /* Based on PnP ID */
140};
141
142/* input queue */
143#define PSM_BUFSIZE 960
144#define PSM_SMALLBUFSIZE 240
145
146/* operation levels */
147#define PSM_LEVEL_BASE 0
148#define PSM_LEVEL_STANDARD 1
149#define PSM_LEVEL_NATIVE 2
150#define PSM_LEVEL_MIN PSM_LEVEL_BASE
151#define PSM_LEVEL_MAX PSM_LEVEL_NATIVE
152
153/* Active PS/2 multiplexing */
154#define PSM_NOMUX (-1)
155
154/* Logitech PS2++ protocol */
155#define MOUSE_PS2PLUS_CHECKBITS(b) \
156 ((((b[2] & 0x03) << 2) | 0x02) == (b[1] & 0x0f))
157#define MOUSE_PS2PLUS_PACKET_TYPE(b) \
158 (((b[0] & 0x30) >> 2) | ((b[1] & 0x30) >> 4))
159
160/* ring buffer */
161typedef struct ringbuf {

--- 8 unchanged lines hidden (view full) ---

170 u_char ipacket[16]; /* interim input buffer */
171 int inputbytes; /* # of bytes in the input buffer */
172} packetbuf_t;
173
174#ifndef PSM_PACKETQUEUE
175#define PSM_PACKETQUEUE 128
176#endif
177
156/* Logitech PS2++ protocol */
157#define MOUSE_PS2PLUS_CHECKBITS(b) \
158 ((((b[2] & 0x03) << 2) | 0x02) == (b[1] & 0x0f))
159#define MOUSE_PS2PLUS_PACKET_TYPE(b) \
160 (((b[0] & 0x30) >> 2) | ((b[1] & 0x30) >> 4))
161
162/* ring buffer */
163typedef struct ringbuf {

--- 8 unchanged lines hidden (view full) ---

172 u_char ipacket[16]; /* interim input buffer */
173 int inputbytes; /* # of bytes in the input buffer */
174} packetbuf_t;
175
176#ifndef PSM_PACKETQUEUE
177#define PSM_PACKETQUEUE 128
178#endif
179
178/*
179 * Typical bezel limits. Taken from 'Synaptics
180 * PS/2 TouchPad Interfacing Guide' p.3.2.3.
181 */
182#define SYNAPTICS_DEFAULT_MAX_X 5472
183#define SYNAPTICS_DEFAULT_MAX_Y 4448
184#define SYNAPTICS_DEFAULT_MIN_X 1472
185#define SYNAPTICS_DEFAULT_MIN_Y 1408
186
187typedef struct synapticsinfo {
188 struct sysctl_ctx_list sysctl_ctx;
189 struct sysctl_oid *sysctl_tree;
190 int directional_scrolls;
191 int two_finger_scroll;
192 int min_pressure;
193 int max_pressure;
194 int max_width;

--- 248 unchanged lines hidden (view full) ---

443 struct callout callout; /* watchdog timer call out */
444 struct callout softcallout; /* buffer timer call out */
445 struct cdev *dev;
446 struct cdev *bdev;
447 int lasterr;
448 int cmdcount;
449 struct sigio *async; /* Processes waiting for SIGIO */
450 int extended_buttons;
180typedef struct synapticsinfo {
181 struct sysctl_ctx_list sysctl_ctx;
182 struct sysctl_oid *sysctl_tree;
183 int directional_scrolls;
184 int two_finger_scroll;
185 int min_pressure;
186 int max_pressure;
187 int max_width;

--- 248 unchanged lines hidden (view full) ---

436 struct callout callout; /* watchdog timer call out */
437 struct callout softcallout; /* buffer timer call out */
438 struct cdev *dev;
439 struct cdev *bdev;
440 int lasterr;
441 int cmdcount;
442 struct sigio *async; /* Processes waiting for SIGIO */
443 int extended_buttons;
444 int muxport; /* MUX port with attached Synaptics */
445 u_char muxsave[3]; /* 3->6 byte proto conversion buffer */
446 int muxtpbuttons; /* Touchpad button state */
447 int muxmsbuttons; /* Mouse (trackpoint) button state */
448 struct timeval muxmidtimeout; /* middle button supression timeout */
451#ifdef EVDEV_SUPPORT
452 struct evdev_dev *evdev_a; /* Absolute reporting device */
453 struct evdev_dev *evdev_r; /* Relative reporting device */
454#endif
455};
456static devclass_t psm_devclass;
457
458/* driver state flags (state) */

--- 149 unchanged lines hidden (view full) ---

608static int timeelapsed(const struct timeval *, int, int,
609 const struct timeval *);
610static void dropqueue(struct psm_softc *);
611static void flushpackets(struct psm_softc *);
612static void proc_mmanplus(struct psm_softc *, packetbuf_t *,
613 mousestatus_t *, int *, int *, int *);
614static int proc_synaptics(struct psm_softc *, packetbuf_t *,
615 mousestatus_t *, int *, int *, int *);
449#ifdef EVDEV_SUPPORT
450 struct evdev_dev *evdev_a; /* Absolute reporting device */
451 struct evdev_dev *evdev_r; /* Relative reporting device */
452#endif
453};
454static devclass_t psm_devclass;
455
456/* driver state flags (state) */

--- 149 unchanged lines hidden (view full) ---

606static int timeelapsed(const struct timeval *, int, int,
607 const struct timeval *);
608static void dropqueue(struct psm_softc *);
609static void flushpackets(struct psm_softc *);
610static void proc_mmanplus(struct psm_softc *, packetbuf_t *,
611 mousestatus_t *, int *, int *, int *);
612static int proc_synaptics(struct psm_softc *, packetbuf_t *,
613 mousestatus_t *, int *, int *, int *);
614static int proc_synaptics_mux(struct psm_softc *, packetbuf_t *);
616static void proc_versapad(struct psm_softc *, packetbuf_t *,
617 mousestatus_t *, int *, int *, int *);
618static int proc_elantech(struct psm_softc *, packetbuf_t *,
619 mousestatus_t *, int *, int *, int *);
620static int psmpalmdetect(struct psm_softc *, finger_t *, int);
621static void psmgestures(struct psm_softc *, finger_t *, int,
622 mousestatus_t *);
623static void psmsmoother(struct psm_softc *, finger_t *, int,

--- 13 unchanged lines hidden (view full) ---

637static probefunc_t enable_aglide;
638static probefunc_t enable_kmouse;
639static probefunc_t enable_msexplorer;
640static probefunc_t enable_msintelli;
641static probefunc_t enable_4dmouse;
642static probefunc_t enable_4dplus;
643static probefunc_t enable_mmanplus;
644static probefunc_t enable_synaptics;
615static void proc_versapad(struct psm_softc *, packetbuf_t *,
616 mousestatus_t *, int *, int *, int *);
617static int proc_elantech(struct psm_softc *, packetbuf_t *,
618 mousestatus_t *, int *, int *, int *);
619static int psmpalmdetect(struct psm_softc *, finger_t *, int);
620static void psmgestures(struct psm_softc *, finger_t *, int,
621 mousestatus_t *);
622static void psmsmoother(struct psm_softc *, finger_t *, int,

--- 13 unchanged lines hidden (view full) ---

636static probefunc_t enable_aglide;
637static probefunc_t enable_kmouse;
638static probefunc_t enable_msexplorer;
639static probefunc_t enable_msintelli;
640static probefunc_t enable_4dmouse;
641static probefunc_t enable_4dplus;
642static probefunc_t enable_mmanplus;
643static probefunc_t enable_synaptics;
644static probefunc_t enable_synaptics_mux;
645static probefunc_t enable_trackpoint;
646static probefunc_t enable_versapad;
647static probefunc_t enable_elantech;
648
649static void set_trackpoint_parameters(struct psm_softc *sc);
650static void synaptics_passthrough_on(struct psm_softc *sc);
651static void synaptics_passthrough_off(struct psm_softc *sc);
652static int synaptics_preferred_mode(struct psm_softc *sc);

--- 4 unchanged lines hidden (view full) ---

657 u_char syncmask;
658 int packetsize;
659 probefunc_t *probefunc;
660} vendortype[] = {
661 /*
662 * WARNING: the order of probe is very important. Don't mess it
663 * unless you know what you are doing.
664 */
645static probefunc_t enable_trackpoint;
646static probefunc_t enable_versapad;
647static probefunc_t enable_elantech;
648
649static void set_trackpoint_parameters(struct psm_softc *sc);
650static void synaptics_passthrough_on(struct psm_softc *sc);
651static void synaptics_passthrough_off(struct psm_softc *sc);
652static int synaptics_preferred_mode(struct psm_softc *sc);

--- 4 unchanged lines hidden (view full) ---

657 u_char syncmask;
658 int packetsize;
659 probefunc_t *probefunc;
660} vendortype[] = {
661 /*
662 * WARNING: the order of probe is very important. Don't mess it
663 * unless you know what you are doing.
664 */
665 { MOUSE_MODEL_SYNAPTICS, /* Synaptics Touchpad on Active Mux */
666 0x00, MOUSE_PS2_PACKETSIZE, enable_synaptics_mux },
665 { MOUSE_MODEL_NET, /* Genius NetMouse */
666 0x08, MOUSE_PS2INTELLI_PACKETSIZE, enable_gmouse },
667 { MOUSE_MODEL_NETSCROLL, /* Genius NetScroll */
668 0xc8, 6, enable_groller },
669 { MOUSE_MODEL_MOUSEMANPLUS, /* Logitech MouseMan+ */
670 0x08, MOUSE_PS2_PACKETSIZE, enable_mmanplus },
671 { MOUSE_MODEL_EXPLORER, /* Microsoft IntelliMouse Explorer */
672 0x08, MOUSE_PS2INTELLI_PACKETSIZE, enable_msexplorer },

--- 411 unchanged lines hidden (view full) ---

1084
1085 return (TRUE);
1086}
1087
1088static int
1089doopen(struct psm_softc *sc, int command_byte)
1090{
1091 int stat[3];
667 { MOUSE_MODEL_NET, /* Genius NetMouse */
668 0x08, MOUSE_PS2INTELLI_PACKETSIZE, enable_gmouse },
669 { MOUSE_MODEL_NETSCROLL, /* Genius NetScroll */
670 0xc8, 6, enable_groller },
671 { MOUSE_MODEL_MOUSEMANPLUS, /* Logitech MouseMan+ */
672 0x08, MOUSE_PS2_PACKETSIZE, enable_mmanplus },
673 { MOUSE_MODEL_EXPLORER, /* Microsoft IntelliMouse Explorer */
674 0x08, MOUSE_PS2INTELLI_PACKETSIZE, enable_msexplorer },

--- 411 unchanged lines hidden (view full) ---

1086
1087 return (TRUE);
1088}
1089
1090static int
1091doopen(struct psm_softc *sc, int command_byte)
1092{
1093 int stat[3];
1094 int mux_enabled = FALSE;
1092
1093 /*
1094 * FIXME: Synaptics TouchPad seems to go back to Relative Mode with
1095 * no obvious reason. Thus we check the current mode and restore the
1096 * Absolute Mode if it was cleared.
1097 *
1098 * The previous hack at the end of psmprobe() wasn't efficient when
1099 * moused(8) was restarted.
1100 *
1101 * A Reset (FF) or Set Defaults (F6) command would clear the
1102 * Absolute Mode bit. But a verbose boot or debug.psm.loglevel=5
1103 * doesn't show any evidence of such a command.
1104 */
1105 if (sc->hw.model == MOUSE_MODEL_SYNAPTICS) {
1095
1096 /*
1097 * FIXME: Synaptics TouchPad seems to go back to Relative Mode with
1098 * no obvious reason. Thus we check the current mode and restore the
1099 * Absolute Mode if it was cleared.
1100 *
1101 * The previous hack at the end of psmprobe() wasn't efficient when
1102 * moused(8) was restarted.
1103 *
1104 * A Reset (FF) or Set Defaults (F6) command would clear the
1105 * Absolute Mode bit. But a verbose boot or debug.psm.loglevel=5
1106 * doesn't show any evidence of such a command.
1107 */
1108 if (sc->hw.model == MOUSE_MODEL_SYNAPTICS) {
1109 if (sc->muxport != PSM_NOMUX) {
1110 mux_enabled = enable_aux_mux(sc->kbdc) >= 0;
1111 if (mux_enabled)
1112 set_active_aux_mux_port(sc->kbdc, sc->muxport);
1113 else
1114 log(LOG_ERR, "psm%d: failed to enable "
1115 "active multiplexing mode.\n",
1116 sc->unit);
1117 }
1106 mouse_ext_command(sc->kbdc, 1);
1107 get_mouse_status(sc->kbdc, stat, 0, 3);
1108 if ((SYNAPTICS_VERSION_GE(sc->synhw, 7, 5) ||
1118 mouse_ext_command(sc->kbdc, 1);
1119 get_mouse_status(sc->kbdc, stat, 0, 3);
1120 if ((SYNAPTICS_VERSION_GE(sc->synhw, 7, 5) ||
1109 stat[1] == 0x46 || stat[1] == 0x47) &&
1121 stat[1] == 0x47) &&
1110 stat[2] == 0x40) {
1111 synaptics_set_mode(sc, synaptics_preferred_mode(sc));
1112 VLOG(5, (LOG_DEBUG, "psm%d: Synaptis Absolute Mode "
1113 "hopefully restored\n",
1114 sc->unit));
1115 }
1122 stat[2] == 0x40) {
1123 synaptics_set_mode(sc, synaptics_preferred_mode(sc));
1124 VLOG(5, (LOG_DEBUG, "psm%d: Synaptis Absolute Mode "
1125 "hopefully restored\n",
1126 sc->unit));
1127 }
1128 if (mux_enabled)
1129 disable_aux_mux(sc->kbdc);
1116 }
1117
1118 /*
1119 * A user may want to disable tap and drag gestures on a Synaptics
1120 * TouchPad when it operates in Relative Mode.
1121 */
1122 if (sc->hw.model == MOUSE_MODEL_GENERIC) {
1123 if (tap_enabled > 0) {

--- 232 unchanged lines hidden (view full) ---

1356 sc->config |=
1357#ifdef PSM_RESETAFTERSUSPEND
1358 PSM_CONFIG_INITAFTERSUSPEND;
1359#else
1360 PSM_CONFIG_HOOKRESUME;
1361#endif
1362#endif /* PSM_HOOKRESUME | PSM_HOOKAPM */
1363 sc->flags = 0;
1130 }
1131
1132 /*
1133 * A user may want to disable tap and drag gestures on a Synaptics
1134 * TouchPad when it operates in Relative Mode.
1135 */
1136 if (sc->hw.model == MOUSE_MODEL_GENERIC) {
1137 if (tap_enabled > 0) {

--- 232 unchanged lines hidden (view full) ---

1370 sc->config |=
1371#ifdef PSM_RESETAFTERSUSPEND
1372 PSM_CONFIG_INITAFTERSUSPEND;
1373#else
1374 PSM_CONFIG_HOOKRESUME;
1375#endif
1376#endif /* PSM_HOOKRESUME | PSM_HOOKAPM */
1377 sc->flags = 0;
1378 sc->muxport = PSM_NOMUX;
1364 if (bootverbose)
1365 ++verbose;
1366
1367 device_set_desc(dev, "PS/2 Mouse");
1368
1369 if (!kbdc_lock(sc->kbdc, TRUE)) {
1370 printf("psm%d: unable to lock the controller.\n", unit);
1371 if (bootverbose)

--- 453 unchanged lines hidden (view full) ---

1825 evdev_support_key(evdev_a, BTN_BACK);
1826 evdev_support_key(evdev_a, BTN_FORWARD);
1827 }
1828 if (sc->synhw.capExtended && (sc->synhw.nExtendedButtons > 0))
1829 for (i = 0; i < sc->synhw.nExtendedButtons; i++)
1830 evdev_support_key(evdev_a, BTN_0 + i);
1831
1832 error = evdev_register_mtx(evdev_a, &Giant);
1379 if (bootverbose)
1380 ++verbose;
1381
1382 device_set_desc(dev, "PS/2 Mouse");
1383
1384 if (!kbdc_lock(sc->kbdc, TRUE)) {
1385 printf("psm%d: unable to lock the controller.\n", unit);
1386 if (bootverbose)

--- 453 unchanged lines hidden (view full) ---

1840 evdev_support_key(evdev_a, BTN_BACK);
1841 evdev_support_key(evdev_a, BTN_FORWARD);
1842 }
1843 if (sc->synhw.capExtended && (sc->synhw.nExtendedButtons > 0))
1844 for (i = 0; i < sc->synhw.nExtendedButtons; i++)
1845 evdev_support_key(evdev_a, BTN_0 + i);
1846
1847 error = evdev_register_mtx(evdev_a, &Giant);
1833 if (!error && sc->synhw.capPassthrough) {
1848 if (!error && (sc->synhw.capPassthrough || sc->muxport != PSM_NOMUX)) {
1834 guest_model = sc->tpinfo.sysctl_tree != NULL ?
1835 MOUSE_MODEL_TRACKPOINT : MOUSE_MODEL_GENERIC;
1836 error = psm_register(dev, guest_model);
1837 }
1838 if (error)
1839 evdev_free(evdev_a);
1840 else
1841 sc->evdev_a = evdev_a;

--- 1103 unchanged lines hidden (view full) ---

2945static void
2946psmintr(void *arg)
2947{
2948 struct psm_softc *sc = arg;
2949 struct timeval now;
2950 int c;
2951 packetbuf_t *pb;
2952
1849 guest_model = sc->tpinfo.sysctl_tree != NULL ?
1850 MOUSE_MODEL_TRACKPOINT : MOUSE_MODEL_GENERIC;
1851 error = psm_register(dev, guest_model);
1852 }
1853 if (error)
1854 evdev_free(evdev_a);
1855 else
1856 sc->evdev_a = evdev_a;

--- 1103 unchanged lines hidden (view full) ---

2960static void
2961psmintr(void *arg)
2962{
2963 struct psm_softc *sc = arg;
2964 struct timeval now;
2965 int c;
2966 packetbuf_t *pb;
2967
2968 if (aux_mux_is_enabled(sc->kbdc))
2969 VLOG(2, (LOG_DEBUG, "psmintr: active multiplexing mode is not "
2970 "supported!\n"));
2953
2954 /* read until there is nothing to read */
2955 while((c = read_aux_data_no_wait(sc->kbdc)) != -1) {
2956 pb = &sc->pqueue[sc->pqueue_end];
2957
2958 /* discard the byte if the device is not open */
2959 if (!(sc->state & (PSM_OPEN | PSM_EV_OPEN_R | PSM_EV_OPEN_A)))
2960 continue;

--- 335 unchanged lines hidden (view full) ---

3296 }
3297
3298 switch (w) {
3299 case 3:
3300 /*
3301 * Handle packets from the guest device. See:
3302 * Synaptics PS/2 TouchPad Interfacing Guide, Section 5.1
3303 */
2971
2972 /* read until there is nothing to read */
2973 while((c = read_aux_data_no_wait(sc->kbdc)) != -1) {
2974 pb = &sc->pqueue[sc->pqueue_end];
2975
2976 /* discard the byte if the device is not open */
2977 if (!(sc->state & (PSM_OPEN | PSM_EV_OPEN_R | PSM_EV_OPEN_A)))
2978 continue;

--- 335 unchanged lines hidden (view full) ---

3314 }
3315
3316 switch (w) {
3317 case 3:
3318 /*
3319 * Handle packets from the guest device. See:
3320 * Synaptics PS/2 TouchPad Interfacing Guide, Section 5.1
3321 */
3304 if (sc->synhw.capPassthrough) {
3322 if (sc->synhw.capPassthrough || sc->muxport != PSM_NOMUX) {
3305 *x = ((pb->ipacket[1] & 0x10) ?
3306 pb->ipacket[4] - 256 : pb->ipacket[4]);
3307 *y = ((pb->ipacket[1] & 0x20) ?
3308 pb->ipacket[5] - 256 : pb->ipacket[5]);
3309 *z = 0;
3310
3311 guest_buttons = 0;
3312 if (pb->ipacket[1] & 0x01)

--- 283 unchanged lines hidden (view full) ---

3596 *z = 0;
3597 ms->button &= ~(MOUSE_BUTTON4DOWN | MOUSE_BUTTON5DOWN |
3598 MOUSE_BUTTON6DOWN | MOUSE_BUTTON7DOWN);
3599
3600 return (0);
3601}
3602
3603static int
3323 *x = ((pb->ipacket[1] & 0x10) ?
3324 pb->ipacket[4] - 256 : pb->ipacket[4]);
3325 *y = ((pb->ipacket[1] & 0x20) ?
3326 pb->ipacket[5] - 256 : pb->ipacket[5]);
3327 *z = 0;
3328
3329 guest_buttons = 0;
3330 if (pb->ipacket[1] & 0x01)

--- 283 unchanged lines hidden (view full) ---

3614 *z = 0;
3615 ms->button &= ~(MOUSE_BUTTON4DOWN | MOUSE_BUTTON5DOWN |
3616 MOUSE_BUTTON6DOWN | MOUSE_BUTTON7DOWN);
3617
3618 return (0);
3619}
3620
3621static int
3622proc_synaptics_mux(struct psm_softc *sc, packetbuf_t *pb)
3623{
3624 int butt;
3625
3626 /*
3627 * Convert 3-byte interleaved mixture of Synaptics and generic mouse
3628 * packets into plain 6-byte Synaptics packet protocol.
3629 * While in hidden multiplexing mode KBC does some editing of the
3630 * packet stream. It remembers the button bits from the last packet
3631 * received from each device, and replaces the button bits of every
3632 * packet with the logical OR of all devices��� most recent button bits.
3633 * This button crosstalk should be filtered out as Synaptics and
3634 * generic mouse encode middle button presses in a different way.
3635 */
3636 switch (pb->ipacket[0] & 0xc0) {
3637 case 0x80: /* First 3 bytes of Synaptics packet */
3638 bcopy(pb->ipacket, sc->muxsave, 3);
3639 /* Compute middle mouse button supression timeout. */
3640 sc->muxmidtimeout.tv_sec = 0;
3641 sc->muxmidtimeout.tv_usec = 50000; /* ~2-3 ints */
3642 timevaladd(&sc->muxmidtimeout, &sc->lastsoftintr);
3643 return (1);
3644
3645 case 0xc0: /* Second 3 bytes of Synaptics packet */
3646 /* Join two 3-bytes absolute packets */
3647 bcopy(pb->ipacket, pb->ipacket + 3, 3);
3648 bcopy(sc->muxsave, pb->ipacket, 3);
3649 /* Prefer trackpoint buttons over touchpad's */
3650 pb->ipacket[0] &= ~(0x08 | sc->muxmsbuttons);
3651 pb->ipacket[3] &= ~(0x08 | sc->muxmsbuttons);
3652 butt = (pb->ipacket[3] & 0x03) << 2 | (pb->ipacket[0] & 0x03);
3653 /* Add hysteresis to remove spurious middle button events */
3654 if (butt != sc->muxtpbuttons && sc->fpcount < 1) {
3655 pb->ipacket[0] &= 0xfc;
3656 pb->ipacket[0] |= sc->muxtpbuttons & 0x03;
3657 pb->ipacket[3] &= 0xfc;
3658 pb->ipacket[3] |= sc->muxtpbuttons >> 2 & 0x03;
3659 ++sc->fpcount;
3660 } else {
3661 sc->fpcount = 0;
3662 sc->muxtpbuttons = butt;
3663 }
3664 /* Filter out impossible w induced by middle trackpoint btn */
3665 if (sc->synhw.capExtended && !sc->synhw.capPassthrough &&
3666 (pb->ipacket[0] & 0x34) == 0x04 &&
3667 (pb->ipacket[3] & 0x04) == 0x04) {
3668 pb->ipacket[0] &= 0xfb;
3669 pb->ipacket[3] &= 0xfb;
3670 }
3671 sc->muxsave[0] &= 0x30;
3672 break;
3673
3674 default: /* Generic mouse (Trackpoint) packet */
3675 /* Filter out middle button events induced by some w values */
3676 if (sc->muxmsbuttons & 0x03 || pb->ipacket[0] & 0x03 ||
3677 (timevalcmp(&sc->lastsoftintr, &sc->muxmidtimeout, <=) &&
3678 (sc->muxsave[0] & 0x30 || sc->muxsave[2] > 8)))
3679 pb->ipacket[0] &= 0xfb;
3680 sc->muxmsbuttons = pb->ipacket[0] & 0x07;
3681 /* Convert to Synaptics pass-through protocol */
3682 pb->ipacket[4] = pb->ipacket[1];
3683 pb->ipacket[5] = pb->ipacket[2];
3684 pb->ipacket[1] = pb->ipacket[0];
3685 pb->ipacket[2] = 0;
3686 pb->ipacket[0] = 0x84 | (sc->muxtpbuttons & 0x03);
3687 pb->ipacket[3] = 0xc4 | (sc->muxtpbuttons >> 2 & 0x03);
3688 }
3689
3690 VLOG(4, (LOG_DEBUG, "synaptics: %02x %02x %02x %02x %02x %02x\n",
3691 pb->ipacket[0], pb->ipacket[1], pb->ipacket[2],
3692 pb->ipacket[3], pb->ipacket[4], pb->ipacket[5]));
3693
3694 pb->inputbytes = MOUSE_SYNAPTICS_PACKETSIZE;
3695 return (0);
3696}
3697
3698static int
3604psmpalmdetect(struct psm_softc *sc, finger_t *f, int nfingers)
3605{
3606 if (!(
3607 ((sc->synhw.capMultiFinger || sc->synhw.capAdvancedGestures) &&
3608 !sc->synhw.capReportsV && nfingers > 1) ||
3609 (sc->synhw.capReportsV && nfingers > 2) ||
3610 (sc->synhw.capPalmDetect && f->w <= sc->syninfo.max_width) ||
3611 (!sc->synhw.capPalmDetect && f->p <= sc->syninfo.max_pressure) ||

--- 1318 unchanged lines hidden (view full) ---

4930 (pb->ipacket[2] & 0x07) ;
4931 } else {
4932 /* preserve previous button states */
4933 ms.button |= ms.obutton & MOUSE_EXTBUTTONS;
4934 }
4935 break;
4936
4937 case MOUSE_MODEL_SYNAPTICS:
3699psmpalmdetect(struct psm_softc *sc, finger_t *f, int nfingers)
3700{
3701 if (!(
3702 ((sc->synhw.capMultiFinger || sc->synhw.capAdvancedGestures) &&
3703 !sc->synhw.capReportsV && nfingers > 1) ||
3704 (sc->synhw.capReportsV && nfingers > 2) ||
3705 (sc->synhw.capPalmDetect && f->w <= sc->syninfo.max_width) ||
3706 (!sc->synhw.capPalmDetect && f->p <= sc->syninfo.max_pressure) ||

--- 1318 unchanged lines hidden (view full) ---

5025 (pb->ipacket[2] & 0x07) ;
5026 } else {
5027 /* preserve previous button states */
5028 ms.button |= ms.obutton & MOUSE_EXTBUTTONS;
5029 }
5030 break;
5031
5032 case MOUSE_MODEL_SYNAPTICS:
5033 if (pb->inputbytes == MOUSE_PS2_PACKETSIZE)
5034 if (proc_synaptics_mux(sc, pb))
5035 goto next;
5036
4938 if (proc_synaptics(sc, pb, &ms, &x, &y, &z) != 0) {
4939 VLOG(3, (LOG_DEBUG, "synaptics: "
4940 "packet rejected\n"));
4941 goto next;
4942 }
4943 break;
4944
4945 case MOUSE_MODEL_ELANTECH:

--- 1094 unchanged lines hidden (view full) ---

6040 */
6041 if ((sc->synhw.capAdvancedGestures || sc->synhw.capReportsV) &&
6042 sc->hw.model == MOUSE_MODEL_SYNAPTICS && !(mode_byte & (1 << 5))) {
6043 mouse_ext_command(sc->kbdc, 3);
6044 set_mouse_sampling_rate(sc->kbdc, 0xc8);
6045 }
6046}
6047
5037 if (proc_synaptics(sc, pb, &ms, &x, &y, &z) != 0) {
5038 VLOG(3, (LOG_DEBUG, "synaptics: "
5039 "packet rejected\n"));
5040 goto next;
5041 }
5042 break;
5043
5044 case MOUSE_MODEL_ELANTECH:

--- 1094 unchanged lines hidden (view full) ---

6139 */
6140 if ((sc->synhw.capAdvancedGestures || sc->synhw.capReportsV) &&
6141 sc->hw.model == MOUSE_MODEL_SYNAPTICS && !(mode_byte & (1 << 5))) {
6142 mouse_ext_command(sc->kbdc, 3);
6143 set_mouse_sampling_rate(sc->kbdc, 0xc8);
6144 }
6145}
6146
6147/*
6148 * AUX MUX detection code should be placed at very beginning of probe sequence
6149 * at least before 4-byte protocol mouse probes e.g. MS IntelliMouse probe as
6150 * latter can trigger switching the MUX to incompatible state.
6151 */
6048static int
6152static int
6153enable_synaptics_mux(struct psm_softc *sc, enum probearg arg)
6154{
6155 KBDC kbdc = sc->kbdc;
6156 int port, version;
6157 int probe = FALSE;
6158 int active_ports_count = 0;
6159 int active_ports_mask = 0;
6160
6161 version = enable_aux_mux(kbdc);
6162 if (version == -1)
6163 return (FALSE);
6164
6165 for (port = 0; port < KBDC_AUX_MUX_NUM_PORTS; port++) {
6166 VLOG(3, (LOG_DEBUG, "aux_mux: ping port %d\n", port));
6167 set_active_aux_mux_port(kbdc, port);
6168 if (enable_aux_dev(kbdc) && disable_aux_dev(kbdc)) {
6169 active_ports_count++;
6170 active_ports_mask |= 1 << port;
6171 }
6172 }
6173
6174 if (verbose >= 2)
6175 printf("Active Multiplexing PS/2 controller v%d.%d with %d "
6176 "active port(s)\n", version >> 4 & 0x0f, version & 0x0f,
6177 active_ports_count);
6178
6179 /* psm has a special support for GenMouse + SynTouchpad combination */
6180 if (active_ports_count >= 2) {
6181 for (port = 0; port < KBDC_AUX_MUX_NUM_PORTS; port++) {
6182 if ((active_ports_mask & 1 << port) == 0)
6183 continue;
6184 VLOG(3, (LOG_DEBUG, "aux_mux: probe port %d\n", port));
6185 set_active_aux_mux_port(kbdc, port);
6186 probe = enable_synaptics(sc, arg);
6187 if (probe) {
6188 if (arg == PROBE)
6189 sc->muxport = port;
6190 break;
6191 }
6192 }
6193 }
6194
6195 /* IRQ handler does not support active multiplexing mode */
6196 disable_aux_mux(kbdc);
6197
6198 return (probe);
6199}
6200
6201static int
6049enable_synaptics(struct psm_softc *sc, enum probearg arg)
6050{
6051 device_t psmcpnp;
6052 struct psmcpnp_softc *psmcpnp_sc;
6053 KBDC kbdc = sc->kbdc;
6054 synapticshw_t synhw;
6055 int status[3];
6202enable_synaptics(struct psm_softc *sc, enum probearg arg)
6203{
6204 device_t psmcpnp;
6205 struct psmcpnp_softc *psmcpnp_sc;
6206 KBDC kbdc = sc->kbdc;
6207 synapticshw_t synhw;
6208 int status[3];
6056 int buttons, middle_byte;
6209 int buttons;
6057
6058 VLOG(3, (LOG_DEBUG, "synaptics: BEGIN init\n"));
6059
6060 /*
6061 * Just to be on the safe side: this avoids troubles with
6062 * following mouse_ext_command() when the previous command
6063 * was PSMC_SET_RESOLUTION. Set Scaling has no effect on
6064 * Synaptics Touchpad behaviour.
6065 */
6066 set_mouse_scaling(kbdc, 1);
6067
6068 /* Identify the Touchpad version. */
6069 if (mouse_ext_command(kbdc, 0) == 0)
6070 return (FALSE);
6071 if (get_mouse_status(kbdc, status, 0, 3) != 3)
6072 return (FALSE);
6210
6211 VLOG(3, (LOG_DEBUG, "synaptics: BEGIN init\n"));
6212
6213 /*
6214 * Just to be on the safe side: this avoids troubles with
6215 * following mouse_ext_command() when the previous command
6216 * was PSMC_SET_RESOLUTION. Set Scaling has no effect on
6217 * Synaptics Touchpad behaviour.
6218 */
6219 set_mouse_scaling(kbdc, 1);
6220
6221 /* Identify the Touchpad version. */
6222 if (mouse_ext_command(kbdc, 0) == 0)
6223 return (FALSE);
6224 if (get_mouse_status(kbdc, status, 0, 3) != 3)
6225 return (FALSE);
6073 middle_byte = status[1];
6074 if (middle_byte != 0x46 && middle_byte != 0x47)
6226 if (status[1] != 0x47)
6075 return (FALSE);
6076
6077 bzero(&synhw, sizeof(synhw));
6078 synhw.infoMinor = status[0];
6079 synhw.infoMajor = status[2] & 0x0f;
6080
6081 if (verbose >= 2)
6082 printf("Synaptics Touchpad v%d.%d\n", synhw.infoMajor,
6083 synhw.infoMinor);
6084
6227 return (FALSE);
6228
6229 bzero(&synhw, sizeof(synhw));
6230 synhw.infoMinor = status[0];
6231 synhw.infoMajor = status[2] & 0x0f;
6232
6233 if (verbose >= 2)
6234 printf("Synaptics Touchpad v%d.%d\n", synhw.infoMajor,
6235 synhw.infoMinor);
6236
6085 /*
6086 * Most synaptics touchpads return 0x47 in middle byte in responce to
6087 * identify command as stated in p.4.4 of "Synaptics PS/2 TouchPad
6088 * Interfacing Guide" and we only support v4.0 or better. But some
6089 * devices return 0x46 here and have a different numbering scheme.
6090 * In the case of 0x46, we allow versions as low as v2.0
6091 */
6092 if ((middle_byte == 0x47 && synhw.infoMajor < 4) ||
6093 (middle_byte == 0x46 && synhw.infoMajor < 2)) {
6237 if (synhw.infoMajor < 4) {
6094 printf(" Unsupported (pre-v4) Touchpad detected\n");
6095 return (FALSE);
6096 }
6097
6098 /* Get the Touchpad model information. */
6099 if (mouse_ext_command(kbdc, 3) == 0)
6100 return (FALSE);
6101 if (get_mouse_status(kbdc, status, 0, 3) != 3)

--- 24 unchanged lines hidden (view full) ---

6126 printf(" infoGeometry: %d\n", synhw.infoGeometry);
6127 }
6128
6129 /* Read the extended capability bits. */
6130 if (mouse_ext_command(kbdc, 2) == 0)
6131 return (FALSE);
6132 if (get_mouse_status(kbdc, status, 0, 3) != 3)
6133 return (FALSE);
6238 printf(" Unsupported (pre-v4) Touchpad detected\n");
6239 return (FALSE);
6240 }
6241
6242 /* Get the Touchpad model information. */
6243 if (mouse_ext_command(kbdc, 3) == 0)
6244 return (FALSE);
6245 if (get_mouse_status(kbdc, status, 0, 3) != 3)

--- 24 unchanged lines hidden (view full) ---

6270 printf(" infoGeometry: %d\n", synhw.infoGeometry);
6271 }
6272
6273 /* Read the extended capability bits. */
6274 if (mouse_ext_command(kbdc, 2) == 0)
6275 return (FALSE);
6276 if (get_mouse_status(kbdc, status, 0, 3) != 3)
6277 return (FALSE);
6134 if (!SYNAPTICS_VERSION_GE(synhw, 7, 5) && status[1] != middle_byte) {
6278 if (!SYNAPTICS_VERSION_GE(synhw, 7, 5) && status[1] != 0x47) {
6135 printf(" Failed to read extended capability bits\n");
6136 return (FALSE);
6137 }
6138
6139 psmcpnp = devclass_get_device(devclass_find(PSMCPNP_DRIVER_NAME),
6140 sc->unit);
6141 psmcpnp_sc = (psmcpnp != NULL) ? device_get_softc(psmcpnp) : NULL;
6142
6279 printf(" Failed to read extended capability bits\n");
6280 return (FALSE);
6281 }
6282
6283 psmcpnp = devclass_get_device(devclass_find(PSMCPNP_DRIVER_NAME),
6284 sc->unit);
6285 psmcpnp_sc = (psmcpnp != NULL) ? device_get_softc(psmcpnp) : NULL;
6286
6143 /*
6144 * Set conservative defaults for 0x46 middle byte touchpads
6145 * as ExtendedQueries return bogus data.
6146 */
6147 if (middle_byte == 0x46) {
6148 synhw.capExtended = 1;
6149 synhw.capPalmDetect = 1;
6150 synhw.capPassthrough = 1;
6151 synhw.capMultiFinger = 1;
6152 synhw.maximumXCoord = SYNAPTICS_DEFAULT_MAX_X;
6153 synhw.maximumYCoord = SYNAPTICS_DEFAULT_MAX_Y;
6154 synhw.minimumXCoord = SYNAPTICS_DEFAULT_MIN_X;
6155 synhw.minimumYCoord = SYNAPTICS_DEFAULT_MIN_Y;
6156 /* Enable multitouch mode for HW v8.1 devices */
6157 if (psmcpnp_sc != NULL &&
6158 psmcpnp_sc->type == PSMCPNP_HPSYN81)
6159 synhw.capReportsV = 1;
6160 } else
6161 synhw.capExtended = (status[0] & 0x80) != 0;
6162
6163 /* Set the different capabilities when they exist. */
6164 buttons = 0;
6287 /* Set the different capabilities when they exist. */
6288 buttons = 0;
6165 if (synhw.capExtended && middle_byte == 0x47) {
6289 synhw.capExtended = (status[0] & 0x80) != 0;
6290 if (synhw.capExtended) {
6166 synhw.nExtendedQueries = (status[0] & 0x70) >> 4;
6167 synhw.capMiddle = (status[0] & 0x04) != 0;
6168 synhw.capPassthrough = (status[2] & 0x80) != 0;
6169 synhw.capLowPower = (status[2] & 0x40) != 0;
6170 synhw.capMultiFingerReport =
6171 (status[2] & 0x20) != 0;
6172 synhw.capSleep = (status[2] & 0x10) != 0;
6173 synhw.capFourButtons = (status[2] & 0x08) != 0;

--- 105 unchanged lines hidden (view full) ---

6279 if (get_mouse_status(kbdc, status, 0, 3) != 3)
6280 return (FALSE);
6281
6282 synhw.maximumXCoord = (status[0] << 5) |
6283 ((status[1] & 0x0f) << 1);
6284 synhw.maximumYCoord = (status[2] << 5) |
6285 ((status[1] & 0xf0) >> 3);
6286 } else {
6291 synhw.nExtendedQueries = (status[0] & 0x70) >> 4;
6292 synhw.capMiddle = (status[0] & 0x04) != 0;
6293 synhw.capPassthrough = (status[2] & 0x80) != 0;
6294 synhw.capLowPower = (status[2] & 0x40) != 0;
6295 synhw.capMultiFingerReport =
6296 (status[2] & 0x20) != 0;
6297 synhw.capSleep = (status[2] & 0x10) != 0;
6298 synhw.capFourButtons = (status[2] & 0x08) != 0;

--- 105 unchanged lines hidden (view full) ---

6404 if (get_mouse_status(kbdc, status, 0, 3) != 3)
6405 return (FALSE);
6406
6407 synhw.maximumXCoord = (status[0] << 5) |
6408 ((status[1] & 0x0f) << 1);
6409 synhw.maximumYCoord = (status[2] << 5) |
6410 ((status[1] & 0xf0) >> 3);
6411 } else {
6287 synhw.maximumXCoord = SYNAPTICS_DEFAULT_MAX_X;
6288 synhw.maximumYCoord = SYNAPTICS_DEFAULT_MAX_Y;
6412 /*
6413 * Typical bezel limits. Taken from 'Synaptics
6414 * PS/2 * TouchPad Interfacing Guide' p.3.2.3.
6415 */
6416 synhw.maximumXCoord = 5472;
6417 synhw.maximumYCoord = 4448;
6289 }
6290
6291 if (synhw.capReportsMin) {
6292 if (!set_mouse_scaling(kbdc, 1))
6293 return (FALSE);
6294 if (mouse_ext_command(kbdc, 0x0f) == 0)
6295 return (FALSE);
6296 if (get_mouse_status(kbdc, status, 0, 3) != 3)
6297 return (FALSE);
6298
6299 synhw.minimumXCoord = (status[0] << 5) |
6300 ((status[1] & 0x0f) << 1);
6301 synhw.minimumYCoord = (status[2] << 5) |
6302 ((status[1] & 0xf0) >> 3);
6303 } else {
6418 }
6419
6420 if (synhw.capReportsMin) {
6421 if (!set_mouse_scaling(kbdc, 1))
6422 return (FALSE);
6423 if (mouse_ext_command(kbdc, 0x0f) == 0)
6424 return (FALSE);
6425 if (get_mouse_status(kbdc, status, 0, 3) != 3)
6426 return (FALSE);
6427
6428 synhw.minimumXCoord = (status[0] << 5) |
6429 ((status[1] & 0x0f) << 1);
6430 synhw.minimumYCoord = (status[2] << 5) |
6431 ((status[1] & 0xf0) >> 3);
6432 } else {
6304 synhw.minimumXCoord = SYNAPTICS_DEFAULT_MIN_X;
6305 synhw.minimumYCoord = SYNAPTICS_DEFAULT_MIN_Y;
6433 /*
6434 * Typical bezel limits. Taken from 'Synaptics
6435 * PS/2 * TouchPad Interfacing Guide' p.3.2.3.
6436 */
6437 synhw.minimumXCoord = 1472;
6438 synhw.minimumYCoord = 1408;
6306 }
6307
6308 /*
6309 * ClickPad properties are not exported through PS/2
6310 * protocol. Detection is based on controller's PnP ID.
6311 */
6312 if (synhw.capClickPad && psmcpnp_sc != NULL) {
6313 switch (psmcpnp_sc->type) {

--- 69 unchanged lines hidden (view full) ---

6383 * XXX: Note the Synaptics documentation also defines the first
6384 * byte of the response to this query to be a constant 0x3b, this
6385 * does not appear to be true for Touchpads with guest devices.
6386 */
6387 if (mouse_ext_command(kbdc, 1) == 0)
6388 return (FALSE);
6389 if (get_mouse_status(kbdc, status, 0, 3) != 3)
6390 return (FALSE);
6439 }
6440
6441 /*
6442 * ClickPad properties are not exported through PS/2
6443 * protocol. Detection is based on controller's PnP ID.
6444 */
6445 if (synhw.capClickPad && psmcpnp_sc != NULL) {
6446 switch (psmcpnp_sc->type) {

--- 69 unchanged lines hidden (view full) ---

6516 * XXX: Note the Synaptics documentation also defines the first
6517 * byte of the response to this query to be a constant 0x3b, this
6518 * does not appear to be true for Touchpads with guest devices.
6519 */
6520 if (mouse_ext_command(kbdc, 1) == 0)
6521 return (FALSE);
6522 if (get_mouse_status(kbdc, status, 0, 3) != 3)
6523 return (FALSE);
6391 if (!SYNAPTICS_VERSION_GE(synhw, 7, 5) && status[1] != middle_byte) {
6524 if (!SYNAPTICS_VERSION_GE(synhw, 7, 5) && status[1] != 0x47) {
6392 printf(" Failed to read mode byte\n");
6393 return (FALSE);
6394 }
6395
6396 if (arg == PROBE)
6397 sc->synhw = synhw;
6398 if (!synaptics_support)
6399 return (FALSE);

--- 806 unchanged lines hidden (view full) ---

7206
7207/* _HID list for quirk detection. Any device below has _CID from psmcpnp_ids */
7208static struct isa_pnp_id forcepad_ids[] = {
7209 { 0x0d302e4f, "HP PS/2 forcepad port" }, /* SYN300D, EB 1040 */
7210 { 0x14302e4f, "HP PS/2 forcepad port" }, /* SYN3014, EB 1040 */
7211 { 0 }
7212};
7213
6525 printf(" Failed to read mode byte\n");
6526 return (FALSE);
6527 }
6528
6529 if (arg == PROBE)
6530 sc->synhw = synhw;
6531 if (!synaptics_support)
6532 return (FALSE);

--- 806 unchanged lines hidden (view full) ---

7339
7340/* _HID list for quirk detection. Any device below has _CID from psmcpnp_ids */
7341static struct isa_pnp_id forcepad_ids[] = {
7342 { 0x0d302e4f, "HP PS/2 forcepad port" }, /* SYN300D, EB 1040 */
7343 { 0x14302e4f, "HP PS/2 forcepad port" }, /* SYN3014, EB 1040 */
7344 { 0 }
7345};
7346
7214/* List of HW v8.1 synaptics touchpads erroneously detected as HW v2.0 */
7215static struct isa_pnp_id hpsyn81_ids[] = {
7216 { 0x9e012e4f, "HP PS/2 trackpad port" }, /* SYN019E, EB 9470 */
7217 { 0 }
7218};
7219
7220static int
7221create_a_copy(device_t atkbdc, device_t me)
7222{
7223 device_t psm;
7224 u_long irq;
7225
7226 /* find the PS/2 mouse device instance under the keyboard controller */
7227 psm = device_find_child(atkbdc, PSM_DRIVER_NAME,

--- 17 unchanged lines hidden (view full) ---

7245{
7246 struct psmcpnp_softc *sc = device_get_softc(dev);
7247 struct resource *res;
7248 u_long irq;
7249 int rid;
7250
7251 if (ISA_PNP_PROBE(device_get_parent(dev), dev, forcepad_ids) == 0)
7252 sc->type = PSMCPNP_FORCEPAD;
7347static int
7348create_a_copy(device_t atkbdc, device_t me)
7349{
7350 device_t psm;
7351 u_long irq;
7352
7353 /* find the PS/2 mouse device instance under the keyboard controller */
7354 psm = device_find_child(atkbdc, PSM_DRIVER_NAME,

--- 17 unchanged lines hidden (view full) ---

7372{
7373 struct psmcpnp_softc *sc = device_get_softc(dev);
7374 struct resource *res;
7375 u_long irq;
7376 int rid;
7377
7378 if (ISA_PNP_PROBE(device_get_parent(dev), dev, forcepad_ids) == 0)
7379 sc->type = PSMCPNP_FORCEPAD;
7253 else if(ISA_PNP_PROBE(device_get_parent(dev), dev, hpsyn81_ids) == 0)
7254 sc->type = PSMCPNP_HPSYN81;
7255 else if (ISA_PNP_PROBE(device_get_parent(dev), dev, psmcpnp_ids) == 0)
7256 sc->type = PSMCPNP_GENERIC;
7257 else
7258 return (ENXIO);
7259
7260 /*
7261 * The PnP BIOS and ACPI are supposed to assign an IRQ (12)
7262 * to the PS/2 mouse device node. But, some buggy PnP BIOS

--- 42 unchanged lines hidden ---
7380 else if (ISA_PNP_PROBE(device_get_parent(dev), dev, psmcpnp_ids) == 0)
7381 sc->type = PSMCPNP_GENERIC;
7382 else
7383 return (ENXIO);
7384
7385 /*
7386 * The PnP BIOS and ACPI are supposed to assign an IRQ (12)
7387 * to the PS/2 mouse device node. But, some buggy PnP BIOS

--- 42 unchanged lines hidden ---