Sync with mac68k.

This commit is contained in:
tsubai 1999-02-17 14:56:56 +00:00
parent e717f0bc2b
commit 60307f0ef1
5 changed files with 47 additions and 36 deletions

View File

@ -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 */

View File

@ -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;

View File

@ -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_ */

View File

@ -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

View File

@ -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) */