diff options
author | Matthieu Herrb <matthieu@cvs.openbsd.org> | 2006-02-03 21:51:51 +0000 |
---|---|---|
committer | Matthieu Herrb <matthieu@cvs.openbsd.org> | 2006-02-03 21:51:51 +0000 |
commit | d94015f2730668a756180e3fd25367ffe1e07d14 (patch) | |
tree | eee004d46bc12b76a2e38354d7e7adc289608a8c /sys/dev/adb | |
parent | b6e3e03c2ad957cd6dbc2b4ca3aa48fa2ae3a947 (diff) |
Restore patch from rev 1.9 of macppc/dev/ams.c that got lost in code
factorization: prevent ADB devices other than mices from generating
"extended" protocol events. ok miod@
Diffstat (limited to 'sys/dev/adb')
-rw-r--r-- | sys/dev/adb/ams.c | 23 |
1 files changed, 12 insertions, 11 deletions
diff --git a/sys/dev/adb/ams.c b/sys/dev/adb/ams.c index 97edff1b7a5..114f5cebe98 100644 --- a/sys/dev/adb/ams.c +++ b/sys/dev/adb/ams.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ams.c,v 1.1 2006/01/18 23:21:17 miod Exp $ */ +/* $OpenBSD: ams.c,v 1.2 2006/02/03 21:51:50 matthieu Exp $ */ /* $NetBSD: ams.c,v 1.11 2000/12/19 03:13:40 tsubai Exp $ */ /* @@ -488,16 +488,17 @@ ms_processevent(adb_event_t *event, struct ams_softc *sc) 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) + 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; |