move DEC qvss/pm - compatible (kernel tracks mouse) mouse-input parser
to qvss_compat.c Move low-level mouse initialization to lk201.c.
This commit is contained in:
parent
6d9de6f768
commit
e18d468a1a
@ -346,3 +346,49 @@ LKgetc(dev)
|
||||
}
|
||||
return (c);
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Initialize the mouse. (Doesn't really belong here.)
|
||||
*/
|
||||
void
|
||||
MouseInit(mdev, putc, getc)
|
||||
dev_t mdev;
|
||||
void (*putc) __P((dev_t, int));
|
||||
int (*getc) __P((dev_t));
|
||||
{
|
||||
int id_byte1, id_byte2, id_byte3, id_byte4;
|
||||
|
||||
/*
|
||||
* Initialize the mouse.
|
||||
*/
|
||||
(*putc)(mdev, MOUSE_SELF_TEST);
|
||||
id_byte1 = (*getc)(mdev);
|
||||
if (id_byte1 < 0) {
|
||||
printf("MouseInit: Timeout on 1st byte of self-test report\n");
|
||||
return;
|
||||
}
|
||||
id_byte2 = (*getc)(mdev);
|
||||
if (id_byte2 < 0) {
|
||||
printf("MouseInit: Timeout on 2nd byte of self-test report\n");
|
||||
return;
|
||||
}
|
||||
id_byte3 = (*getc)(mdev);
|
||||
if (id_byte3 < 0) {
|
||||
printf("MouseInit: Timeout on 3rd byte of self-test report\n");
|
||||
return;
|
||||
}
|
||||
id_byte4 = (*getc)(mdev);
|
||||
if (id_byte4 < 0) {
|
||||
printf("MouseInit: Timeout on 4th byte of self-test report\n");
|
||||
return;
|
||||
}
|
||||
if ((id_byte2 & 0x0f) != 0x2)
|
||||
printf("MouseInit: We don't have a mouse!!!\n");
|
||||
/*
|
||||
* For some reason, the mouse doesn't see this command if it comes
|
||||
* too soon after a self test.
|
||||
*/
|
||||
DELAY(100);
|
||||
(*putc)(mdev, MOUSE_INCREMENTAL);
|
||||
}
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: qvss_compat.c,v 1.1 1995/09/11 07:45:47 jonathan Exp $ */
|
||||
/* $NetBSD: qvss_compat.c,v 1.2 1995/09/18 03:01:24 jonathan Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 1992, 1993
|
||||
@ -625,8 +625,53 @@ genDeconfigMouse()
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* And a mouse-report handler for redirected mouse input.
|
||||
*/
|
||||
/**
|
||||
** And a mouse-report handler for redirected mouse input.
|
||||
** Could arguably be in its own source file, but it's only
|
||||
** used when the kernel is performing mouse tracking.
|
||||
**/
|
||||
|
||||
#include "dec_mouse.c"
|
||||
/*
|
||||
* Mouse-event parser. Called as an upcall with each character
|
||||
* read from a serial port. Accumulates complete mouse-event
|
||||
* reports and passes them up to framebuffer layer.
|
||||
* Mouse events are reported as a 3-byte sequence:
|
||||
* header+button state, delta-x, delta-y
|
||||
*/
|
||||
void
|
||||
mouseInput(cc)
|
||||
int cc;
|
||||
{
|
||||
register MouseReport *mrp;
|
||||
static MouseReport currentRep;
|
||||
|
||||
mrp = ¤tRep;
|
||||
mrp->byteCount++;
|
||||
if (cc & MOUSE_START_FRAME) {
|
||||
/*
|
||||
* The first mouse report byte (button state).
|
||||
*/
|
||||
mrp->state = cc;
|
||||
if (mrp->byteCount > 1)
|
||||
mrp->byteCount = 1;
|
||||
} else if (mrp->byteCount == 2) {
|
||||
/*
|
||||
* The second mouse report byte (delta x).
|
||||
*/
|
||||
mrp->dx = cc;
|
||||
} else if (mrp->byteCount == 3) {
|
||||
/*
|
||||
* The final mouse report byte (delta y).
|
||||
*/
|
||||
mrp->dy = cc;
|
||||
mrp->byteCount = 0;
|
||||
if (mrp->dx != 0 || mrp->dy != 0) {
|
||||
/*
|
||||
* If the mouse moved,
|
||||
* post a motion event.
|
||||
*/
|
||||
(genMouseEvent)(mrp);
|
||||
}
|
||||
(genMouseButtons)(mrp);
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user