diff options
author | Matthieu Herrb <matthieu@cvs.openbsd.org> | 2004-11-28 15:43:44 +0000 |
---|---|---|
committer | Matthieu Herrb <matthieu@cvs.openbsd.org> | 2004-11-28 15:43:44 +0000 |
commit | 41641016c7b0c5cedb23ad6def5d45e8c4638181 (patch) | |
tree | 765867f35769919853e9b41cc2eca245cee7dffa /sys/arch/macppc/dev | |
parent | c6bb5516772f641d8c7cdc213f9c7712ea5a33c0 (diff) |
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@
Diffstat (limited to 'sys/arch/macppc/dev')
-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; |