Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/arch/usermode add wsmouse support
details: https://anonhg.NetBSD.org/src/rev/951b6b2b3711
branches: trunk
changeset: 772357:951b6b2b3711
user: jmcneill <jmcneill%NetBSD.org@localhost>
date: Fri Dec 30 20:08:36 2011 +0000
description:
add wsmouse support
diffstat:
sys/arch/usermode/conf/GENERIC.common | 6 ++-
sys/arch/usermode/conf/files.usermode | 4 +-
sys/arch/usermode/dev/vncfb.c | 66 ++++++++++++++++++++++++++++++++--
3 files changed, 68 insertions(+), 8 deletions(-)
diffs (196 lines):
diff -r 386ac9e36d4f -r 951b6b2b3711 sys/arch/usermode/conf/GENERIC.common
--- a/sys/arch/usermode/conf/GENERIC.common Fri Dec 30 20:08:00 2011 +0000
+++ b/sys/arch/usermode/conf/GENERIC.common Fri Dec 30 20:08:36 2011 +0000
@@ -1,9 +1,9 @@
-# $NetBSD: GENERIC.common,v 1.8 2011/12/30 12:14:04 jmcneill Exp $
+# $NetBSD: GENERIC.common,v 1.9 2011/12/30 20:08:36 jmcneill Exp $
include "arch/usermode/conf/std.usermode"
options INCLUDE_CONFIG_FILE
-#ident "GENERIC-$Revision: 1.8 $"
+#ident "GENERIC-$Revision: 1.9 $"
maxusers 32
makeoptions DEBUG="-O1 -g3"
@@ -59,6 +59,7 @@
vncfb0 at thunkbus?
wsdisplay0 at vncfb?
wskbd0 at vncfb?
+wsmouse0 at vncfb? mux 0
options WSEMUL_VT100
options WS_KERNEL_FG=WSCOL_GREEN
options WSKBD_DEFAULT_KEYREPEAT_DEL1=1000
@@ -70,6 +71,7 @@
pseudo-device bpfilter
pseudo-device drvctl
pseudo-device ksyms
+pseudo-device wsmux
# Pull in optional local configuration
cinclude "arch/usermode/conf/GENERIC.local"
diff -r 386ac9e36d4f -r 951b6b2b3711 sys/arch/usermode/conf/files.usermode
--- a/sys/arch/usermode/conf/files.usermode Fri Dec 30 20:08:00 2011 +0000
+++ b/sys/arch/usermode/conf/files.usermode Fri Dec 30 20:08:36 2011 +0000
@@ -1,4 +1,4 @@
-# $NetBSD: files.usermode,v 1.15 2011/12/29 21:22:49 jmcneill Exp $
+# $NetBSD: files.usermode,v 1.16 2011/12/30 20:08:36 jmcneill Exp $
maxpartitions 8
maxusers 8 16 64
@@ -37,7 +37,7 @@
attach ld at thunkbus with ld_thunkbus
file arch/usermode/dev/ld_thunkbus.c ld_thunkbus
-device vncfb { } : wsemuldisplaydev, rasops32, vcons, wskbddev
+device vncfb { } : wsemuldisplaydev, rasops32, vcons, wskbddev, wsmousedev
attach vncfb at thunkbus
file arch/usermode/dev/vncfb.c vncfb
file arch/usermode/dev/vnckbdmap.c vncfb
diff -r 386ac9e36d4f -r 951b6b2b3711 sys/arch/usermode/dev/vncfb.c
--- a/sys/arch/usermode/dev/vncfb.c Fri Dec 30 20:08:00 2011 +0000
+++ b/sys/arch/usermode/dev/vncfb.c Fri Dec 30 20:08:36 2011 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: vncfb.c,v 1.9 2011/12/30 19:32:32 jmcneill Exp $ */
+/* $NetBSD: vncfb.c,v 1.10 2011/12/30 20:08:36 jmcneill Exp $ */
/*-
* Copyright (c) 2011 Jared D. McNeill <jmcneill%invisible.ca@localhost>
@@ -35,7 +35,7 @@
#include "opt_wsemul.h"
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: vncfb.c,v 1.9 2011/12/30 19:32:32 jmcneill Exp $");
+__KERNEL_RCSID(0, "$NetBSD: vncfb.c,v 1.10 2011/12/30 20:08:36 jmcneill Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@@ -56,6 +56,8 @@
#include <dev/wscons/wsksymdef.h>
#include <dev/wscons/wsksymvar.h>
+#include <dev/wscons/wsmousevar.h>
+
#include <machine/mainbus.h>
#include <machine/thunk.h>
@@ -73,6 +75,7 @@
struct vncfb_softc {
device_t sc_dev;
device_t sc_wskbddev;
+ device_t sc_wsmousedev;
thunk_rfb_t sc_rfb;
unsigned int sc_width;
unsigned int sc_height;
@@ -86,6 +89,7 @@
struct vncfb_fbops sc_ops;
int sc_kbd_enable;
+ int sc_mouse_enable;
void *sc_ih;
void *sc_sih;
@@ -128,6 +132,10 @@
static void vncfb_kbd_cnpollc(void *, int);
static void vncfb_kbd_bell(void *, u_int, u_int, u_int);
+static int vncfb_mouse_enable(void *);
+static int vncfb_mouse_ioctl(void *, u_long, void *, int, lwp_t *);
+static void vncfb_mouse_disable(void *);
+
static struct vcons_screen vncfb_console_screen;
static struct wsscreen_descr vncfb_defaultscreen = {
@@ -170,6 +178,12 @@
vncfb_kbd_bell,
};
+static const struct wsmouse_accessops vncfb_mouse_accessops = {
+ vncfb_mouse_enable,
+ vncfb_mouse_ioctl,
+ vncfb_mouse_disable,
+};
+
static int
vncfb_match(device_t parent, cfdata_t match, void *priv)
{
@@ -185,6 +199,7 @@
struct thunkbus_attach_args *taa = priv;
struct wsemuldisplaydev_attach_args waa;
struct wskbddev_attach_args kaa;
+ struct wsmousedev_attach_args maa;
struct rasops_info *ri;
unsigned long defattr;
@@ -208,8 +223,6 @@
aprint_naive("\n");
aprint_normal(": %ux%u %ubpp (port %u)\n",
sc->sc_width, sc->sc_height, sc->sc_depth, taa->u.vnc.port);
- aprint_normal_dev(self, "mem @ %p\n", sc->sc_mem);
- aprint_normal_dev(self, "fb @ %p\n", sc->sc_framebuf);
sc->sc_rfb.width = sc->sc_width;
sc->sc_rfb.height = sc->sc_height;
@@ -262,6 +275,12 @@
sc->sc_wskbddev = config_found_ia(self, "wskbddev", &kaa,
wskbddevprint);
+
+ maa.accessops = &vncfb_mouse_accessops;
+ maa.accesscookie = sc;
+
+ sc->sc_wsmousedev = config_found_ia(self, "wsmousedev", &maa,
+ wsmousedevprint);
}
static void
@@ -555,6 +574,15 @@
event.data.key_event.keysym & 0xfff);
splx(s);
break;
+ case THUNK_RFB_POINTER_EVENT:
+ s = spltty();
+ wsmouse_input(sc->sc_wsmousedev,
+ event.data.pointer_event.button_mask,
+ event.data.pointer_event.absx,
+ event.data.pointer_event.absy,
+ 0, 0,
+ WSMOUSE_INPUT_ABSOLUTE_X|WSMOUSE_INPUT_ABSOLUTE_Y);
+ splx(s);
default:
break;
}
@@ -638,3 +666,33 @@
thunk_rfb_bell(&sc->sc_rfb);
softint_schedule(sc->sc_sih);
}
+
+static int
+vncfb_mouse_enable(void *priv)
+{
+ struct vncfb_softc *sc = priv;
+
+ sc->sc_mouse_enable = 1;
+
+ return 0;
+}
+
+static int
+vncfb_mouse_ioctl(void *priv, u_long cmd, void *data, int flag, lwp_t *l)
+{
+ switch (cmd) {
+ case WSMOUSEIO_GTYPE:
+ *(u_int *)data = WSMOUSE_TYPE_PSEUDO;
+ return 0;
+ default:
+ return EPASSTHROUGH;
+ }
+}
+
+static void
+vncfb_mouse_disable(void *priv)
+{
+ struct vncfb_softc *sc = priv;
+
+ sc->sc_mouse_enable = 0;
+}
Home |
Main Index |
Thread Index |
Old Index