diff options
author | 2004-11-28 15:43:43 +0000 | |
---|---|---|
committer | 2004-11-28 15:43:43 +0000 | |
commit | df47e0c07bb58be8af7a27c2b76a1d590a9b5d55 (patch) | |
tree | 6c5d03cf4345071abdcd9a5c3e6be1451cd84a43 | |
parent | make sure va_end() is always called in all possible paths (diff) | |
download | wireguard-openbsd-df47e0c07bb58be8af7a27c2b76a1d590a9b5d55.tar.xz wireguard-openbsd-df47e0c07bb58be8af7a27c2b76a1d590a9b5d55.zip |
Prevent ADB devices other than mices of generating "extended" protocol events.
This fixes a problem with some iBooks were the touchpad generates a
button6 event everytime the pad is touched.
Based on my observations and a similar patch from Aymeric Vincent
for NetBSD. Enhancements and ok miod@
-rw-r--r-- | sys/arch/macppc/dev/ams.c | 25 |
1 files changed, 13 insertions, 12 deletions
diff --git a/sys/arch/macppc/dev/ams.c b/sys/arch/macppc/dev/ams.c index fab8a53ef9f..033c5c60141 100644 --- a/sys/arch/macppc/dev/ams.c +++ b/sys/arch/macppc/dev/ams.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ams.c,v 1.8 2003/10/16 03:54:48 deraadt Exp $ */ +/* $OpenBSD: ams.c,v 1.9 2004/11/28 15:43:43 matthieu Exp $ */ /* $NetBSD: ams.c,v 1.11 2000/12/19 03:13:40 tsubai Exp $ */ /* @@ -490,17 +490,18 @@ ms_processevent(adb_event_t *event, struct ams_softc *sc) buttons |= button_bit; else buttons &= ~button_bit; - /* Extended Protocol (up to 6 more buttons) */ - for (mask = 0x80; i < max_byte; - i += (mask == 0x80), button_bit <<= 1) { - /* 0 when button down */ - if (!(event->bytes[i] & mask)) - buttons |= button_bit; - else - buttons &= ~button_bit; - mask = ((mask >> 4) & 0xf) - | ((mask & 0xf) << 4); - } + if (sc->sc_class == MSCLASS_MOUSE) + /* Extended Protocol (up to 6 more buttons) */ + for (mask = 0x80; i < max_byte; + i += (mask == 0x80), button_bit <<= 1) { + /* 0 when button down */ + if (!(event->bytes[i] & mask)) + buttons |= button_bit; + else + buttons &= ~button_bit; + mask = ((mask >> 4) & 0xf) + | ((mask & 0xf) << 4); + } break; } new_event.u.m.buttons = sc->sc_mb | buttons; |