summaryrefslogtreecommitdiff
path: root/sbin
diff options
context:
space:
mode:
authorMiod Vallat <miod@cvs.openbsd.org>2013-10-20 22:07:58 +0000
committerMiod Vallat <miod@cvs.openbsd.org>2013-10-20 22:07:58 +0000
commit8cc4fd563f15a84de4894f39fcf0e07081336a12 (patch)
treef6d22d7e4069cf9bf4e01b4306878e3a578c8a13 /sbin
parentfb33eeebaac60c24bf5ead035da2d63f675dc290 (diff)
Introduce write-only (for now) display.font parameter, which issues a
WSDISPLAYIO_USEFONT ioctl, asking the wsdisplay driver to change its current display font to the one requested (by name).
Diffstat (limited to 'sbin')
-rw-r--r--sbin/wsconsctl/display.c9
-rw-r--r--sbin/wsconsctl/util.c8
-rw-r--r--sbin/wsconsctl/wsconsctl.h5
3 files changed, 18 insertions, 4 deletions
diff --git a/sbin/wsconsctl/display.c b/sbin/wsconsctl/display.c
index d887020d5b7..87505a82c18 100644
--- a/sbin/wsconsctl/display.c
+++ b/sbin/wsconsctl/display.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: display.c,v 1.18 2013/08/18 16:32:23 guenther Exp $ */
+/* $OpenBSD: display.c,v 1.19 2013/10/20 22:07:57 miod Exp $ */
/* $NetBSD: display.c,v 1.1 1998/12/28 14:01:16 hannken Exp $ */
/*-
@@ -45,6 +45,7 @@ u_int width, height, depth;
int focus;
struct field_pc brightness, contrast, backlight;
int burnon, burnoff, vblank, kbdact, msact, outact;
+char fontname[WSFONT_NAME_SIZE];
struct wsdisplay_emultype emuls;
struct wsdisplay_screentype screens;
@@ -66,6 +67,7 @@ struct field display_field_tab[] = {
{ "kbdact", &kbdact, FMT_BOOL, FLG_MODIFY|FLG_INIT },
{ "msact", &msact, FMT_BOOL, FLG_MODIFY|FLG_INIT },
{ "outact", &outact, FMT_BOOL, FLG_MODIFY|FLG_INIT },
+ { "font", fontname, FMT_STRING, FLG_WRONLY },
{ NULL }
};
@@ -182,6 +184,7 @@ display_put_values(int fd)
{
struct wsdisplay_param param;
struct wsdisplay_burner burners;
+ struct wsdisplay_font font;
struct field *pf;
const char *cmd_str;
void *ptr;
@@ -232,6 +235,10 @@ display_put_values(int fd)
fillioctl(WSDISPLAYIO_SBURNER);
ptr = &burners;
+ } else if (ptr == fontname) {
+ bzero(&font, sizeof(font));
+ strlcpy(font.name, ptr, sizeof font.name);
+ fillioctl(WSDISPLAYIO_USEFONT);
} else
cmd = 0;
diff --git a/sbin/wsconsctl/util.c b/sbin/wsconsctl/util.c
index b8ab5153286..183d2945a60 100644
--- a/sbin/wsconsctl/util.c
+++ b/sbin/wsconsctl/util.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: util.c,v 1.60 2013/10/20 10:43:47 miod Exp $ */
+/* $OpenBSD: util.c,v 1.61 2013/10/20 22:07:57 miod Exp $ */
/* $NetBSD: util.c,v 1.8 2000/03/14 08:11:53 sato Exp $ */
/*-
@@ -305,6 +305,9 @@ pr_field(const char *pre, struct field *f, const char *sep)
case FMT_SCREEN:
print_screen((struct wsdisplay_screentype *) f->valp);
break;
+ case FMT_STRING:
+ printf("%s", (const char *)f->valp);
+ break;
default:
errx(1, "internal error: pr_field: no format %d", f->format);
break;
@@ -455,6 +458,9 @@ rd_field(struct field *f, char *val, int merge)
break;
}
+ case FMT_STRING:
+ strlcpy(f->valp, val, WSFONT_NAME_SIZE);
+ break;
default:
errx(1, "internal error: rd_field: no format %d", f->format);
break;
diff --git a/sbin/wsconsctl/wsconsctl.h b/sbin/wsconsctl/wsconsctl.h
index d4398247a0f..655c8cb794e 100644
--- a/sbin/wsconsctl/wsconsctl.h
+++ b/sbin/wsconsctl/wsconsctl.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: wsconsctl.h,v 1.13 2010/08/20 00:20:55 fgsch Exp $ */
+/* $OpenBSD: wsconsctl.h,v 1.14 2013/10/20 22:07:57 miod Exp $ */
/* $NetBSD: wsconsctl.h 1.1 1998/12/28 14:01:17 hannken Exp $ */
/*-
@@ -46,7 +46,8 @@ struct field {
#define FMT_KBMAP 105 /* keyboard map */
#define FMT_SCALE 106 /* wsmouse scale */
#define FMT_EMUL 107 /* wsdisplay emulations */
-#define FMT_SCREEN 108 /* wddisplay screen types */
+#define FMT_SCREEN 108 /* wsdisplay screen types */
+#define FMT_STRING 109 /* free string */
int format;
#define FLG_RDONLY 0x0001 /* variable cannot be modified */
#define FLG_WRONLY 0x0002 /* variable cannot be displayed */