diff options
author | yokota <yokota@FreeBSD.org> | 2000-12-01 05:24:30 +0000 |
---|---|---|
committer | yokota <yokota@FreeBSD.org> | 2000-12-01 05:24:30 +0000 |
commit | 042c77017bb57a06b9a452bcd27d57c352098035 (patch) | |
tree | a94d4adcca5bd72e7ad5c47653e2dabc560eab61 /sys/isa | |
parent | 95fb73d49504aef8d7a10a5e1a9e4fcd7af9492c (diff) | |
download | FreeBSD-src-042c77017bb57a06b9a452bcd27d57c352098035.zip FreeBSD-src-042c77017bb57a06b9a452bcd27d57c352098035.tar.gz |
- Slightly rearrnage IntelliMouse Explorer and Logitech
MouseMan+ identification routines for efficiency.
No functional change.
Diffstat (limited to 'sys/isa')
-rw-r--r-- | sys/isa/psm.c | 69 |
1 files changed, 39 insertions, 30 deletions
diff --git a/sys/isa/psm.c b/sys/isa/psm.c index fe1866e..3884ba4 100644 --- a/sys/isa/psm.c +++ b/sys/isa/psm.c @@ -247,6 +247,7 @@ static void psmtimeout __P((void *)); typedef int probefunc_t __P((struct psm_softc *)); static int mouse_id_proc1 __P((KBDC, int, int, int *)); +static int mouse_ext_command __P((KBDC, int)); static probefunc_t enable_groller; static probefunc_t enable_gmouse; static probefunc_t enable_aglide; @@ -2272,6 +2273,26 @@ static int mouse_id_proc1(KBDC kbdc, int res, int scale, int *status) return FALSE; } +static int +mouse_ext_command(KBDC kbdc, int command) +{ + int c; + + c = (command >> 6) & 0x03; + if (set_mouse_resolution(kbdc, c) != c) + return FALSE; + c = (command >> 4) & 0x03; + if (set_mouse_resolution(kbdc, c) != c) + return FALSE; + c = (command >> 2) & 0x03; + if (set_mouse_resolution(kbdc, c) != c) + return FALSE; + c = (command >> 0) & 0x03; + if (set_mouse_resolution(kbdc, c) != c) + return FALSE; + return TRUE; +} + #if notyet /* Logitech MouseMan Cordless II */ static int @@ -2435,14 +2456,8 @@ enable_kmouse(struct psm_softc *sc) static int enable_mmanplus(struct psm_softc *sc) { - static char res[] = { - -1, PSMD_RES_LOW, PSMD_RES_HIGH, PSMD_RES_MEDIUM_HIGH, - PSMD_RES_MEDIUM_LOW, -1, PSMD_RES_HIGH, PSMD_RES_MEDIUM_LOW, - PSMD_RES_MEDIUM_HIGH, PSMD_RES_HIGH, - }; KBDC kbdc = sc->kbdc; int data[3]; - int i; /* the special sequence to enable the fourth button and the roller. */ /* @@ -2450,16 +2465,10 @@ enable_mmanplus(struct psm_softc *sc) * must be called exactly three times since the last RESET command * before this sequence. XXX */ - for (i = 0; i < sizeof(res)/sizeof(res[0]); ++i) { - if (res[i] < 0) { - if (!set_mouse_scaling(kbdc, 1)) - return FALSE; - } else { - if (set_mouse_resolution(kbdc, res[i]) != res[i]) - return FALSE; - } - } - + if (!set_mouse_scaling(kbdc, 1)) + return FALSE; + if (!mouse_ext_command(kbdc, 0x39) || !mouse_ext_command(kbdc, 0xdb)) + return FALSE; if (get_mouse_status(kbdc, data, 1, 3) < 3) return FALSE; @@ -2508,6 +2517,19 @@ enable_msexplorer(struct psm_softc *sc) int id; int i; + /* the special sequence to enable the extra buttons and the roller. */ + for (i = 0; i < sizeof(rate1)/sizeof(rate1[0]); ++i) { + if (set_mouse_sampling_rate(kbdc, rate1[i]) != rate1[i]) + return FALSE; + } + /* the device will give the genuine ID only after the above sequence */ + id = get_aux_id(kbdc); + if (id != PSM_EXPLORER_ID) + return FALSE; + + sc->hw.hwid = id; + sc->hw.buttons = 5; /* IntelliMouse Explorer XXX */ + /* * XXX: this is a kludge to fool some KVM switch products * which think they are clever enough to know the 4-byte IntelliMouse @@ -2520,22 +2542,9 @@ enable_msexplorer(struct psm_softc *sc) */ for (i = 0; i < sizeof(rate0)/sizeof(rate0[0]); ++i) { if (set_mouse_sampling_rate(kbdc, rate0[i]) != rate0[i]) - return FALSE; - } - id = get_aux_id(kbdc); - - /* the special sequence to enable the extra buttons and the roller. */ - for (i = 0; i < sizeof(rate1)/sizeof(rate1[0]); ++i) { - if (set_mouse_sampling_rate(kbdc, rate1[i]) != rate1[i]) - return FALSE; + break; } - /* the device will give the genuine ID only after the above sequence */ id = get_aux_id(kbdc); - if (id != PSM_EXPLORER_ID) - return FALSE; - - sc->hw.hwid = id; - sc->hw.buttons = 5; /* IntelliMouse Explorer XXX */ return TRUE; } |