Module Name: src
Committed By: jmcneill
Date: Fri Dec 30 20:08:36 UTC 2011
Modified Files:
src/sys/arch/usermode/conf: GENERIC.common files.usermode
src/sys/arch/usermode/dev: vncfb.c
Log Message:
add wsmouse support
To generate a diff of this commit:
cvs rdiff -u -r1.8 -r1.9 src/sys/arch/usermode/conf/GENERIC.common
cvs rdiff -u -r1.15 -r1.16 src/sys/arch/usermode/conf/files.usermode
cvs rdiff -u -r1.9 -r1.10 src/sys/arch/usermode/dev/vncfb.c
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
Modified files:
Index: src/sys/arch/usermode/conf/GENERIC.common
diff -u src/sys/arch/usermode/conf/GENERIC.common:1.8 src/sys/arch/usermode/conf/GENERIC.common:1.9
--- src/sys/arch/usermode/conf/GENERIC.common:1.8 Fri Dec 30 12:14:04 2011
+++ src/sys/arch/usermode/conf/GENERIC.common Fri Dec 30 20:08:36 2011
@@ -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 @@ audio0 at vaudio0
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 pty
pseudo-device bpfilter
pseudo-device drvctl
pseudo-device ksyms
+pseudo-device wsmux
# Pull in optional local configuration
cinclude "arch/usermode/conf/GENERIC.local"
Index: src/sys/arch/usermode/conf/files.usermode
diff -u src/sys/arch/usermode/conf/files.usermode:1.15 src/sys/arch/usermode/conf/files.usermode:1.16
--- src/sys/arch/usermode/conf/files.usermode:1.15 Thu Dec 29 21:22:49 2011
+++ src/sys/arch/usermode/conf/files.usermode Fri Dec 30 20:08:36 2011
@@ -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 @@ file arch/usermode/dev/vaudio.c vaudio
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
Index: src/sys/arch/usermode/dev/vncfb.c
diff -u src/sys/arch/usermode/dev/vncfb.c:1.9 src/sys/arch/usermode/dev/vncfb.c:1.10
--- src/sys/arch/usermode/dev/vncfb.c:1.9 Fri Dec 30 19:32:32 2011
+++ src/sys/arch/usermode/dev/vncfb.c Fri Dec 30 20:08:36 2011
@@ -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 <[email protected]>
@@ -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 @@ __KERNEL_RCSID(0, "$NetBSD: vncfb.c,v 1.
#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_fbops {
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_softc {
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_cngetc(void *, u_i
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 @@ static const struct wskbd_consops vncfb_
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 @@ vncfb_attach(device_t parent, device_t s
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 @@ vncfb_attach(device_t parent, device_t s
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 @@ vncfb_attach(device_t parent, device_t s
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 @@ vncfb_softintr(void *priv)
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 @@ vncfb_kbd_bell(void *priv, u_int pitch,
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;
+}