From 60307f0ef1cad361fa6d3d90c19452a79f65cba3 Mon Sep 17 00:00:00 2001 From: tsubai Date: Wed, 17 Feb 1999 14:56:56 +0000 Subject: [PATCH] Sync with mac68k. --- sys/arch/macppc/dev/aed.c | 28 +++++++++++++++++----------- sys/arch/macppc/dev/akbd.c | 6 +++--- sys/arch/macppc/dev/akbdvar.h | 12 ++++++------ sys/arch/macppc/dev/ams.c | 29 +++++++++++++++++------------ sys/arch/macppc/dev/amsvar.h | 8 ++++---- 5 files changed, 47 insertions(+), 36 deletions(-) diff --git a/sys/arch/macppc/dev/aed.c b/sys/arch/macppc/dev/aed.c index 1cb60d75d19a..82ab2ea97ca1 100644 --- a/sys/arch/macppc/dev/aed.c +++ b/sys/arch/macppc/dev/aed.c @@ -1,4 +1,4 @@ -/* $NetBSD: aed.c,v 1.3 1998/10/18 09:31:41 tsubai Exp $ */ +/* $NetBSD: aed.c,v 1.4 1999/02/17 14:56:56 tsubai Exp $ */ /* * Copyright (C) 1994 Bradley A. Grantham @@ -68,7 +68,7 @@ extern int adb_polling; /* Are we polling? (Debugger mode) */ /* * Local variables. */ -static struct aed_softc * aed_sc = NULL; +static struct aed_softc *aed_sc = NULL; static int aed_options = 0; /* | AED_MSEMUL; */ /* Driver definition */ @@ -84,7 +84,7 @@ aedmatch(parent, cf, aux) struct cfdata *cf; void *aux; { - struct adb_attach_args * aa_args = (struct adb_attach_args *)aux; + struct adb_attach_args *aa_args = (struct adb_attach_args *)aux; static int aed_matched = 0; /* Allow only one instance. */ @@ -100,7 +100,7 @@ aedattach(parent, self, aux) struct device *parent, *self; void *aux; { - struct adb_attach_args * aa_args = (struct adb_attach_args *)aux; + struct adb_attach_args *aa_args = (struct adb_attach_args *)aux; struct aed_softc *sc = (struct aed_softc *)self; sc->origaddr = aa_args->origaddr; @@ -150,6 +150,7 @@ aed_input(event) aed_dokeyupdown(&new_event); break; case ADBADDR_MS: + new_event.u.m.buttons |= aed_sc->sc_buttons; aed_handoff(&new_event); break; default: /* God only knows. */ @@ -199,7 +200,7 @@ aed_emulate_mouse(event) aed_handoff(&new_event); break; case ADBK_KEYUP(ADBK_1): - aed_c->sc_buttons &= ~1; /* left up */ + aed_sc->sc_buttons &= ~1; /* left up */ new_event.def_addr = ADBADDR_MS; new_event.u.m.buttons = aed_sc->sc_buttons; new_event.u.m.dx = new_event.u.m.dy = 0; @@ -241,7 +242,9 @@ aed_emulate_mouse(event) aed_handoff(&new_event); break; case ADBK_KEYUP(ADBK_RIGHT): +#ifdef ALTXBUTTONS case ADBK_KEYUP(ADBK_3): +#endif aed_sc->sc_buttons &= ~4; /* right up */ new_event.def_addr = ADBADDR_MS; new_event.u.m.buttons = aed_sc->sc_buttons; @@ -249,9 +252,12 @@ aed_emulate_mouse(event) microtime(&new_event.timestamp); aed_handoff(&new_event); break; - case ADBK_KEYVAL(ADBK_SHIFT): - case ADBK_KEYVAL(ADBK_CONTROL): - case ADBK_KEYVAL(ADBK_FLOWER): + case ADBK_KEYUP(ADBK_SHIFT): + case ADBK_KEYDOWN(ADBK_SHIFT): + case ADBK_KEYUP(ADBK_CONTROL): + case ADBK_KEYDOWN(ADBK_CONTROL): + case ADBK_KEYUP(ADBK_FLOWER): + case ADBK_KEYDOWN(ADBK_FLOWER): /* ctrl, shift, cmd */ aed_dokeyupdown(event); break; @@ -303,7 +309,7 @@ static void aed_kbdrpt(kstate) void *kstate; { - struct aed_softc * aed_sc = (struct aed_softc *)kstate; + struct aed_softc *aed_sc = (struct aed_softc *)kstate; aed_sc->sc_rptevent.bytes[0] |= 0x80; microtime(&aed_sc->sc_rptevent.timestamp); @@ -526,8 +532,8 @@ aedioctl(dev, cmd, data, flag, p) for (i = 1; i <= totaldevs; i++) { adbaddr = GetIndADB(&adbdata, i); di->dev[adbaddr].addr = adbaddr; - di->dev[adbaddr].default_addr = adbdata.origADBAddr; - di->dev[adbaddr].handler_id = adbdata.devType; + di->dev[adbaddr].default_addr = (int)(adbdata.origADBAddr); + di->dev[adbaddr].handler_id = (int)(adbdata.devType); } /* Must call ADB Manager to get devices now */ diff --git a/sys/arch/macppc/dev/akbd.c b/sys/arch/macppc/dev/akbd.c index 86c00588ef0d..051fdf37a979 100644 --- a/sys/arch/macppc/dev/akbd.c +++ b/sys/arch/macppc/dev/akbd.c @@ -1,4 +1,4 @@ -/* $NetBSD: akbd.c,v 1.5 1999/01/10 10:39:13 tsubai Exp $ */ +/* $NetBSD: akbd.c,v 1.6 1999/02/17 14:56:56 tsubai Exp $ */ /* * Copyright (C) 1998 Colin Wood @@ -366,7 +366,7 @@ setleds(ksc, leds) if ((leds & 0x07) == (ksc->sc_leds & 0x07)) return (0); - addr = (int)ksc->adbaddr; + addr = ksc->adbaddr; buffer[0] = 0; kbd_done = 0; @@ -416,7 +416,7 @@ blinkleds(ksc) int addr, i; u_char blinkleds, origleds; - addr = (int)ksc->adbaddr; + addr = ksc->adbaddr; origleds = getleds(addr); blinkleds = LED_NUMLOCK | LED_CAPSLOCK | LED_SCROLL_LOCK; diff --git a/sys/arch/macppc/dev/akbdvar.h b/sys/arch/macppc/dev/akbdvar.h index aebe45b3a1d0..ba5905a60d52 100644 --- a/sys/arch/macppc/dev/akbdvar.h +++ b/sys/arch/macppc/dev/akbdvar.h @@ -1,4 +1,4 @@ -/* $NetBSD: akbdvar.h,v 1.3 1998/10/14 13:21:10 tsubai Exp $ */ +/* $NetBSD: akbdvar.h,v 1.4 1999/02/17 14:56:56 tsubai Exp $ */ /* * Copyright (C) 1998 Colin Wood @@ -39,12 +39,12 @@ * State info, per keyboard instance. */ struct akbd_softc { - struct device sc_dev; + struct device sc_dev; /* ADB info */ - u_int8_t origaddr; /* ADB device type (ADBADDR_KBD) */ - u_int8_t adbaddr; /* current ADB address */ - u_int8_t handler_id; /* type of keyboard */ + int origaddr; /* ADB device type (ADBADDR_KBD) */ + int adbaddr; /* current ADB address */ + int handler_id; /* type of keyboard */ u_int8_t sc_leds; /* current LED state */ struct device *sc_wskbddev; @@ -55,6 +55,6 @@ struct akbd_softc { #define LED_CAPSLOCK 0x2 #define LED_SCROLL_LOCK 0x4 -void kbd_adbcomplete __P((caddr_t buffer, caddr_t data_area, int adb_command)); +void kbd_adbcomplete __P((caddr_t buffer, caddr_t data_area, int adb_command)); #endif /* _MACPPC_KBDVAR_H_ */ diff --git a/sys/arch/macppc/dev/ams.c b/sys/arch/macppc/dev/ams.c index 1b7cf425f7fe..1b94627faa3b 100644 --- a/sys/arch/macppc/dev/ams.c +++ b/sys/arch/macppc/dev/ams.c @@ -1,4 +1,4 @@ -/* $NetBSD: ams.c,v 1.4 1999/01/18 12:36:36 tsubai Exp $ */ +/* $NetBSD: ams.c,v 1.5 1999/02/17 14:56:56 tsubai Exp $ */ /* * Copyright (C) 1998 Colin Wood @@ -131,20 +131,23 @@ amsattach(parent, self, aux) switch (sc->handler_id) { case ADBMS_100DPI: printf("%d-button, %d dpi mouse\n", sc->sc_buttons, - sc->sc_res); + (int)(sc->sc_res)); break; case ADBMS_200DPI: sc->sc_res = 200; printf("%d-button, %d dpi mouse\n", sc->sc_buttons, - sc->sc_res); + (int)(sc->sc_res)); break; case ADBMS_MSA3: printf("Mouse Systems A3 mouse, %d-button, %d dpi\n", - sc->sc_buttons, sc->sc_res); + sc->sc_buttons, (int)(sc->sc_res)); break; case ADBMS_USPEED: printf("MicroSpeed mouse, default parameters\n"); break; + case ADBMS_UCONTOUR: + printf("Contour mouse, default parameters\n"); + break; case ADBMS_EXTENDED: if (sc->sc_devid[0] == '\0') { printf("Logitech "); @@ -177,7 +180,7 @@ amsattach(parent, self, aux) break; } printf(" <%s> %d-button, %d dpi\n", sc->sc_devid, - sc->sc_buttons, sc->sc_res); + sc->sc_buttons, (int)(sc->sc_res)); } break; default: @@ -209,7 +212,7 @@ amsattach(parent, self, aux) */ void ems_init(sc) - struct ams_softc * sc; + struct ams_softc *sc; { int adbaddr, count; short cmd; @@ -218,14 +221,15 @@ ems_init(sc) adbaddr = sc->adbaddr; if (sc->origaddr != ADBADDR_MS) return; - if (sc->handler_id == ADBMS_USPEED) { - /* Found MicroSpeed Mouse Deluxe Mac */ + if (sc->handler_id == ADBMS_USPEED || + sc->handler_id == ADBMS_UCONTOUR) { + /* Found MicroSpeed Mouse Deluxe Mac or Contour Mouse */ cmd = ((adbaddr<<4)&0xF0)|0x9; /* listen 1 */ /* - * To setup the MicroSpeed, it appears that we can - * send the following command to the mouse and then - * expect data back in the form: + * To setup the MicroSpeed or the Contour, it appears + * that we can send the following command to the mouse + * and then expect data back in the form: * buffer[0] = 4 (bytes) * buffer[1], buffer[2] as std. mouse * buffer[3] = buffer[4] = 0xff when no buttons @@ -497,7 +501,8 @@ ms_processevent(event, msc) button_bit = 1; switch (event->hand_id) { case ADBMS_USPEED: - /* MicroSpeed mouse */ + case ADBMS_UCONTOUR: + /* MicroSpeed mouse and Contour mouse */ if (max_byte == 4) buttons = (~event->bytes[2]) & 0xff; else diff --git a/sys/arch/macppc/dev/amsvar.h b/sys/arch/macppc/dev/amsvar.h index 2ad764f81c98..70ad0c683d96 100644 --- a/sys/arch/macppc/dev/amsvar.h +++ b/sys/arch/macppc/dev/amsvar.h @@ -1,4 +1,4 @@ -/* $NetBSD: amsvar.h,v 1.2 1998/10/18 09:31:41 tsubai Exp $ */ +/* $NetBSD: amsvar.h,v 1.3 1999/02/17 14:56:56 tsubai Exp $ */ /* * Copyright (C) 1998 Colin Wood @@ -40,9 +40,9 @@ struct ams_softc { struct device sc_dev; /* ADB info */ - u_int8_t origaddr; /* ADB device type (ADBADDR_MS) */ - u_int8_t adbaddr; /* current ADB address */ - u_int8_t handler_id; /* type of mouse */ + int origaddr; /* ADB device type (ADBADDR_MS) */ + int adbaddr; /* current ADB address */ + int handler_id; /* type of mouse */ /* Extended Mouse Protocol info, faked for non-EMP mice */ u_int8_t sc_class; /* mouse class (mouse, trackball) */