summaryrefslogtreecommitdiff
path: root/os/pc/mouse.c
diff options
context:
space:
mode:
authorKonstantin Kirik (snegovick) <snegovick@uprojects.org>2025-12-28 12:27:31 +0300
committerKonstantin Kirik (snegovick) <snegovick@uprojects.org>2025-12-28 12:27:31 +0300
commit78ee7d5717807e6ac779293d0d3c78341de6130a (patch)
treea43e3b0f61318ac45e6d907c7cc5bad2c6d7f497 /os/pc/mouse.c
parentbdaf46cf45bbb59261da245d548a179d95a42768 (diff)
Move existing boards into subdits split per arch
Diffstat (limited to 'os/pc/mouse.c')
-rw-r--r--os/pc/mouse.c84
1 files changed, 0 insertions, 84 deletions
diff --git a/os/pc/mouse.c b/os/pc/mouse.c
deleted file mode 100644
index 49654bad..00000000
--- a/os/pc/mouse.c
+++ /dev/null
@@ -1,84 +0,0 @@
-#include "u.h"
-#include "../port/lib.h"
-#include "mem.h"
-#include "dat.h"
-#include "fns.h"
-#include "../port/error.h"
-#include "io.h"
-
-/*
- * mouse types
- */
-enum
-{
- Mouseother= 0,
- Mouseserial= 1,
- MousePS2= 2,
-};
-
-static int mousetype;
-
-/*
- * ps/2 mouse message is three bytes
- *
- * byte 0 - 0 0 SDY SDX 1 M R L
- * byte 1 - DX
- * byte 2 - DY
- *
- * shift & left button is the same as middle button
- */
-static void
-ps2mouseputc(int c, int shift)
-{
- static short msg[3];
- static int nb;
- static uchar b[] = {0, 1, 4, 5, 2, 3, 6, 7, 0, 1, 2, 5, 2, 3, 6, 7 };
- int buttons, dx, dy;
-
- /*
- * check byte 0 for consistency
- */
- if(nb==0 && (c&0xc8)!=0x08)
- return;
-
- msg[nb] = c;
- if(++nb == 3){
- nb = 0;
- if(msg[0] & 0x10)
- msg[1] |= 0xFF00;
- if(msg[0] & 0x20)
- msg[2] |= 0xFF00;
-
- buttons = b[(msg[0]&7) | (shift ? 8 : 0)];
- dx = msg[1];
- dy = -msg[2];
- mousetrack(buttons, dx, dy, 1);
- }
- return;
-}
-
-/*
- * set up a ps2 mouse
- */
-static void
-ps2mouse(void)
-{
- if(mousetype == MousePS2)
- return;
-
- i8042auxenable(ps2mouseputc);
- /* make mouse streaming, enabled */
- i8042auxcmd(0xEA);
- i8042auxcmd(0xF4);
-
- mousetype = MousePS2;
-}
-
-void
-ps2mouselink(void)
-{
- /*
- * hack
- */
- ps2mouse();
-}