Module Name: src
Committed By: jmcneill
Date: Fri Dec 30 12:54:42 UTC 2011
Modified Files:
src/sys/arch/usermode/dev: vncfb.c
src/sys/arch/usermode/include: thunk.h
src/sys/arch/usermode/usermode: thunk.c
Log Message:
support wskbd bell
To generate a diff of this commit:
cvs rdiff -u -r1.4 -r1.5 src/sys/arch/usermode/dev/vncfb.c
cvs rdiff -u -r1.50 -r1.51 src/sys/arch/usermode/include/thunk.h
cvs rdiff -u -r1.63 -r1.64 src/sys/arch/usermode/usermode/thunk.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/dev/vncfb.c
diff -u src/sys/arch/usermode/dev/vncfb.c:1.4 src/sys/arch/usermode/dev/vncfb.c:1.5
--- src/sys/arch/usermode/dev/vncfb.c:1.4 Fri Dec 30 11:06:18 2011
+++ src/sys/arch/usermode/dev/vncfb.c Fri Dec 30 12:54:41 2011
@@ -1,4 +1,4 @@
-/* $NetBSD: vncfb.c,v 1.4 2011/12/30 11:06:18 jmcneill Exp $ */
+/* $NetBSD: vncfb.c,v 1.5 2011/12/30 12:54:41 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.4 2011/12/30 11:06:18 jmcneill Exp $");
+__KERNEL_RCSID(0, "$NetBSD: vncfb.c,v 1.5 2011/12/30 12:54:41 jmcneill Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@@ -112,6 +112,7 @@ static int vncfb_kbd_ioctl(void *, u_lon
static void vncfb_kbd_cngetc(void *, u_int *, int *);
static void vncfb_kbd_cnpollc(void *, int);
+static void vncfb_kbd_bell(void *, u_int, u_int, u_int);
static struct vcons_screen vncfb_console_screen;
@@ -152,7 +153,7 @@ static struct wskbd_accessops vncfb_kbd_
static const struct wskbd_consops vncfb_kbd_consops = {
vncfb_kbd_cngetc,
vncfb_kbd_cnpollc,
- NULL, /* bell */
+ vncfb_kbd_bell,
};
static int
@@ -506,10 +507,16 @@ vncfb_kbd_set_leds(void *priv, int leds)
static int
vncfb_kbd_ioctl(void *priv, u_long cmd, void *data, int flag, lwp_t *l)
{
+ struct wskbd_bell_data *bd;
+
switch (cmd) {
case WSKBDIO_GTYPE:
*(int *)data = WSKBD_TYPE_RFB;
return 0;
+ case WSKBDIO_COMPLEXBELL:
+ bd = data;
+ vncfb_kbd_bell(priv, bd->pitch, bd->period, bd->volume);
+ return 0;
default:
return EPASSTHROUGH;
}
@@ -524,3 +531,12 @@ static void
vncfb_kbd_cnpollc(void *priv, int on)
{
}
+
+static void
+vncfb_kbd_bell(void *priv, u_int pitch, u_int period, u_int volume)
+{
+ struct vncfb_softc *sc = priv;
+
+ thunk_rfb_bell(&sc->sc_rfb);
+ softint_schedule(sc->sc_sih);
+}
Index: src/sys/arch/usermode/include/thunk.h
diff -u src/sys/arch/usermode/include/thunk.h:1.50 src/sys/arch/usermode/include/thunk.h:1.51
--- src/sys/arch/usermode/include/thunk.h:1.50 Fri Dec 30 12:07:33 2011
+++ src/sys/arch/usermode/include/thunk.h Fri Dec 30 12:54:41 2011
@@ -1,4 +1,4 @@
-/* $NetBSD: thunk.h,v 1.50 2011/12/30 12:07:33 reinoud Exp $ */
+/* $NetBSD: thunk.h,v 1.51 2011/12/30 12:54:41 jmcneill Exp $ */
/*-
* Copyright (c) 2011 Jared D. McNeill <[email protected]>
@@ -216,6 +216,7 @@ typedef struct {
char name[64];
uint8_t *framebuf;
+ bool schedule_bell;
unsigned int nupdates;
unsigned int first_mergable;
thunk_rfb_update_t update[THUNK_RFB_QUEUELEN];
@@ -223,6 +224,7 @@ typedef struct {
int thunk_rfb_open(thunk_rfb_t *, uint16_t);
int thunk_rfb_poll(thunk_rfb_t *, thunk_rfb_event_t *);
+void thunk_rfb_bell(thunk_rfb_t *);
void thunk_rfb_update(thunk_rfb_t *, int, int, int, int);
void thunk_rfb_copyrect(thunk_rfb_t *, int, int, int, int, int, int);
Index: src/sys/arch/usermode/usermode/thunk.c
diff -u src/sys/arch/usermode/usermode/thunk.c:1.63 src/sys/arch/usermode/usermode/thunk.c:1.64
--- src/sys/arch/usermode/usermode/thunk.c:1.63 Fri Dec 30 12:13:31 2011
+++ src/sys/arch/usermode/usermode/thunk.c Fri Dec 30 12:54:42 2011
@@ -1,4 +1,4 @@
-/* $NetBSD: thunk.c,v 1.63 2011/12/30 12:13:31 jmcneill Exp $ */
+/* $NetBSD: thunk.c,v 1.64 2011/12/30 12:54:42 jmcneill Exp $ */
/*-
* Copyright (c) 2011 Jared D. McNeill <[email protected]>
@@ -28,7 +28,7 @@
#include <sys/cdefs.h>
#ifdef __NetBSD__
-__RCSID("$NetBSD: thunk.c,v 1.63 2011/12/30 12:13:31 jmcneill Exp $");
+__RCSID("$NetBSD: thunk.c,v 1.64 2011/12/30 12:54:42 jmcneill Exp $");
#endif
#include <sys/types.h>
@@ -76,8 +76,6 @@ __RCSID("$NetBSD: thunk.c,v 1.63 2011/12
#define MAP_ANON MAP_ANONYMOUS
#endif
-#define RFB_DEBUG
-
extern int boothowto;
void
@@ -1124,6 +1122,7 @@ thunk_rfb_poll(thunk_rfb_t *rfb, thunk_r
return -1;
}
+ rfb->schedule_bell = false;
rfb->nupdates = 0;
rfb->first_mergable = 0;
thunk_rfb_update(rfb, 0, 0, rfb->width, rfb->height);
@@ -1133,6 +1132,12 @@ thunk_rfb_poll(thunk_rfb_t *rfb, thunk_r
if (rfb->clientfd == -1)
return -1;
+ if (rfb->schedule_bell) {
+ uint8_t msg_type = 2; /* bell */
+ safe_send(rfb->clientfd, &msg_type, sizeof(msg_type));
+ rfb->schedule_bell = false;
+ }
+
error = ioctl(rfb->clientfd, FIONREAD, &len);
if (error) {
//printf("rfb: FIONREAD failed: %s\n", strerror(errno));
@@ -1225,6 +1230,15 @@ thunk_rfb_update(thunk_rfb_t *rfb, int x
}
void
+thunk_rfb_bell(thunk_rfb_t *rfb)
+{
+#ifdef RFB_DEBUG
+ fprintf(stdout, "rfb: schedule bell\n");
+#endif
+ rfb->schedule_bell = true;
+}
+
+void
thunk_rfb_copyrect(thunk_rfb_t *rfb, int x, int y, int w, int h,
int srcx, int srcy)
{