diff options
author | Mats O Jansson <maja@cvs.openbsd.org> | 2010-07-01 02:37:23 +0000 |
---|---|---|
committer | Mats O Jansson <maja@cvs.openbsd.org> | 2010-07-01 02:37:23 +0000 |
commit | a0afd26119be03b59581ed8deca7071b5592941a (patch) | |
tree | c6fa67903554c8713139e0e1d6a0654c38b68ec0 /sbin | |
parent | a939565a3afc49c30e3d7adb3d1d79235e3fbe3a (diff) |
add screen types and emulations to things to be shown for displays.
ok miod@. -moj
Diffstat (limited to 'sbin')
-rw-r--r-- | sbin/wsconsctl/display.c | 16 | ||||
-rw-r--r-- | sbin/wsconsctl/util.c | 50 | ||||
-rw-r--r-- | sbin/wsconsctl/wsconsctl.h | 4 |
3 files changed, 67 insertions, 3 deletions
diff --git a/sbin/wsconsctl/display.c b/sbin/wsconsctl/display.c index e427e10b85d..27f1a061436 100644 --- a/sbin/wsconsctl/display.c +++ b/sbin/wsconsctl/display.c @@ -1,4 +1,4 @@ -/* $OpenBSD: display.c,v 1.13 2009/09/27 06:27:03 maja Exp $ */ +/* $OpenBSD: display.c,v 1.14 2010/07/01 02:37:21 maja Exp $ */ /* $NetBSD: display.c,v 1.1 1998/12/28 14:01:16 hannken Exp $ */ /*- @@ -43,12 +43,16 @@ u_int width, height, depth; int focus; struct field_pc brightness, contrast, backlight; int burnon, burnoff, vblank, kbdact, msact, outact; +struct wsdisplay_emultype emuls; +struct wsdisplay_screentype screens; struct field display_field_tab[] = { { "type", &dpytype, FMT_DPYTYPE, FLG_RDONLY }, { "width", &width, FMT_UINT, FLG_RDONLY }, { "height", &height, FMT_UINT, FLG_RDONLY }, { "depth", &depth, FMT_UINT, FLG_RDONLY }, + { "emulations", &emuls, FMT_EMUL, FLG_RDONLY }, + { "screentypes", &screens, FMT_SCREEN, FLG_RDONLY }, { "focus", &focus, FMT_INT, FLG_MODIFY }, { "brightness", &brightness, FMT_PC, FLG_MODIFY|FLG_INIT }, { "contrast", &contrast, FMT_PC, FLG_MODIFY|FLG_INIT }, @@ -91,6 +95,12 @@ display_get_values(const char *pre, int fd) } else if (ptr == &focus) { fillioctl(WSDISPLAYIO_GETSCREEN); ptr = ℊ + } else if (ptr == &emuls) { + fillioctl(WSDISPLAYIO_GETEMULTYPE); + emuls.idx=0; + } else if (ptr == &screens) { + fillioctl(WSDISPLAYIO_GETSCREENTYPE); + screens.idx=0; } else if (ptr == &brightness) { ptr = ¶m; param.param = WSDISPLAYIO_PARAM_BRIGHTNESS; @@ -150,6 +160,10 @@ display_get_values(const char *pre, int fd) depth = fbinfo.depth; } fbon++; + } else if (ptr == &emuls) { + emuls.idx=fd; + } else if (ptr == &screens) { + screens.idx=fd; } else if (ptr == ¶m) { struct field_pc *pc = pf->valp; diff --git a/sbin/wsconsctl/util.c b/sbin/wsconsctl/util.c index 8bf7d0669ff..9c43d4c0f17 100644 --- a/sbin/wsconsctl/util.c +++ b/sbin/wsconsctl/util.c @@ -1,4 +1,4 @@ -/* $OpenBSD: util.c,v 1.50 2010/06/28 20:40:39 maja Exp $ */ +/* $OpenBSD: util.c,v 1.51 2010/07/01 02:37:21 maja Exp $ */ /* $NetBSD: util.c,v 1.8 2000/03/14 08:11:53 sato Exp $ */ /*- @@ -169,6 +169,8 @@ static const struct nameint kbdvar_tab[] = { char *int2name(int, int, const struct nameint *, int); int name2int(char *, const struct nameint *, int); void print_kmap(struct wskbd_map_data *); +void print_emul(struct wsdisplay_emultype *); +void print_screen(struct wsdisplay_screentype *); struct field * field_by_name(struct field *field_tab, char *name) @@ -287,6 +289,12 @@ pr_field(const char *pre, struct field *f, const char *sep) wmcoords.miny, wmcoords.maxy, wmcoords.swapxy, wmcoords.resx, wmcoords.resy); break; + case FMT_EMUL: + print_emul((struct wsdisplay_emultype *) f->valp); + break; + case FMT_SCREEN: + print_screen((struct wsdisplay_screentype *) f->valp); + break; default: errx(1, "internal error: pr_field: no format %d", f->format); break; @@ -476,3 +484,43 @@ print_kmap(struct wskbd_map_data *map) } ksymenc(0); } + +void +print_emul(struct wsdisplay_emultype *emuls) +{ + struct wsdisplay_emultype e; + int fd,i; + char c='\0'; + + fd=emuls->idx; + e.idx=0; + i = ioctl(fd, WSDISPLAYIO_GETEMULTYPE, &e); + while(i == 0) { + if (c != '0') + printf("%c", c); + printf("%s", e.name); + c=','; + e.idx++; + i = ioctl(fd, WSDISPLAYIO_GETEMULTYPE, &e); + } +} + +void +print_screen(struct wsdisplay_screentype *screens) +{ + struct wsdisplay_screentype s; + int fd,i; + char c='\0'; + + fd=screens->idx; + s.idx=0; + i = ioctl(fd, WSDISPLAYIO_GETSCREENTYPE, &s); + while(i == 0) { + if (c != '0') + printf("%c", c); + printf("%s", s.name); + c=','; + s.idx++; + i = ioctl(fd, WSDISPLAYIO_GETSCREENTYPE, &s); + } +} diff --git a/sbin/wsconsctl/wsconsctl.h b/sbin/wsconsctl/wsconsctl.h index 30c70e081b2..b933d36e1d5 100644 --- a/sbin/wsconsctl/wsconsctl.h +++ b/sbin/wsconsctl/wsconsctl.h @@ -1,4 +1,4 @@ -/* $OpenBSD: wsconsctl.h,v 1.10 2010/06/28 20:40:39 maja Exp $ */ +/* $OpenBSD: wsconsctl.h,v 1.11 2010/07/01 02:37:22 maja Exp $ */ /* $NetBSD: wsconsctl.h 1.1 1998/12/28 14:01:17 hannken Exp $ */ /*- @@ -45,6 +45,8 @@ struct field { #define FMT_KBDENC 104 /* keyboard encoding */ #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 */ int format; #define FLG_RDONLY 0x0001 /* variable cannot be modified */ #define FLG_WRONLY 0x0002 /* variable cannot be displayed */ |