From owner-svn-src-all@FreeBSD.ORG Thu Oct 23 12:38:07 2014 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 38813F2B; Thu, 23 Oct 2014 12:38:07 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 2329EEA8; Thu, 23 Oct 2014 12:38:07 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s9NCc7Go017248; Thu, 23 Oct 2014 12:38:07 GMT (envelope-from dumbbell@FreeBSD.org) Received: (from dumbbell@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s9NCc6ux017244; Thu, 23 Oct 2014 12:38:06 GMT (envelope-from dumbbell@FreeBSD.org) Message-Id: <201410231238.s9NCc6ux017244@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: dumbbell set sender to dumbbell@FreeBSD.org using -f From: Jean-Sebastien Pedron Date: Thu, 23 Oct 2014 12:38:06 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r273544 - in head: sys/dev/vt sys/sys usr.sbin/vidcontrol X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 23 Oct 2014 12:38:07 -0000 Author: dumbbell Date: Thu Oct 23 12:38:05 2014 New Revision: 273544 URL: https://svnweb.freebsd.org/changeset/base/273544 Log: vt(4): Add PIO_VFONT_DEFAULT ioctl to restore the default builtin font To restore the default font using vidcontrol(1), use the "-f" flag without an argument: vidcontrol -f < /dev/ttyv0 PR: 193910 Differential Revision: https://reviews.freebsd.org/D971 Submitted by: Marcin Cieslak Reviewed by: ray@, emaste@ Approved by: ray@ MFC after: 1 week Modified: head/sys/dev/vt/vt_core.c head/sys/sys/consio.h head/usr.sbin/vidcontrol/vidcontrol.1 head/usr.sbin/vidcontrol/vidcontrol.c Modified: head/sys/dev/vt/vt_core.c ============================================================================== --- head/sys/dev/vt/vt_core.c Thu Oct 23 12:02:27 2014 (r273543) +++ head/sys/dev/vt/vt_core.c Thu Oct 23 12:38:05 2014 (r273544) @@ -2218,6 +2218,11 @@ skip_thunk: vtfont_unref(vf); return (error); } + case PIO_VFONT_DEFAULT: { + /* Reset to default font. */ + error = vt_change_font(vw, &vt_font_default); + return (error); + } case GIO_SCRNMAP: { scrmap_t *sm = (scrmap_t *)data; Modified: head/sys/sys/consio.h ============================================================================== --- head/sys/sys/consio.h Thu Oct 23 12:02:27 2014 (r273543) +++ head/sys/sys/consio.h Thu Oct 23 12:38:05 2014 (r273544) @@ -239,6 +239,7 @@ typedef struct vfnt vfnt_t; #define GIO_FONT8x16 _IOR('c', 69, fnt16_t) #define PIO_VFONT _IOW('c', 70, vfnt_t) #define GIO_VFONT _IOR('c', 71, vfnt_t) +#define PIO_VFONT_DEFAULT _IO('c', 72) /* get video mode information */ struct colors { Modified: head/usr.sbin/vidcontrol/vidcontrol.1 ============================================================================== --- head/usr.sbin/vidcontrol/vidcontrol.1 Thu Oct 23 12:02:27 2014 (r273543) +++ head/usr.sbin/vidcontrol/vidcontrol.1 Thu Oct 23 12:38:05 2014 (r273544) @@ -26,9 +26,11 @@ .Op Fl c Ar appearance .Oo .Fl f +.Oo .Op Ar size .Ar file .Oc +.Oc .Op Fl g Ar geometry .Op Fl h Ar size .Op Fl i Cm adapter | mode @@ -136,8 +138,10 @@ The latter is actually a simulation. Print out current output screen map. .It Xo .Fl f +.Oo .Op Ar size .Ar file +.Oc .Xc Load font .Ar file @@ -158,6 +162,14 @@ may be omitted, in this case .Nm will try to guess it from the size of font file. .Pp +When using +.Xr vt 4 +both +.Ar size +and +.Ar font +can be omitted, and the default font will be loaded. +.Pp Note that older video cards, such as MDA and CGA, do not support software font. See also Modified: head/usr.sbin/vidcontrol/vidcontrol.c ============================================================================== --- head/usr.sbin/vidcontrol/vidcontrol.c Thu Oct 23 12:02:27 2014 (r273543) +++ head/usr.sbin/vidcontrol/vidcontrol.c Thu Oct 23 12:38:05 2014 (r273544) @@ -197,7 +197,7 @@ usage(void) { if (vt4_mode) fprintf(stderr, "%s\n%s\n%s\n%s\n%s\n", -"usage: vidcontrol [-CHPpx] [-b color] [-c appearance] [-f [size] file]", +"usage: vidcontrol [-CHPpx] [-b color] [-c appearance] [-f [[size] file]]", " [-g geometry] [-h size] [-i adapter | mode]", " [-M char] [-m on | off] [-r foreground background]", " [-S on | off] [-s number] [-T xterm | cons25] [-t N | off]", @@ -409,6 +409,19 @@ load_vt4mappingtable(unsigned int nmappi return (t); } +/* + * Set the default vt font. + */ + +static void +load_default_vt4font(void) +{ + if (ioctl(0, PIO_VFONT_DEFAULT) == -1) { + revert(); + errc(1, errno, "loading default vt font"); + } +} + static int load_vt4font(FILE *f) { @@ -1328,7 +1341,7 @@ main(int argc, char **argv) dumpopt = DUMP_FBF; termmode = NULL; if (vt4_mode) - opts = "b:Cc:f:g:h:Hi:M:m:pPr:S:s:T:t:x"; + opts = "b:Cc:fg:h:Hi:M:m:pPr:S:s:T:t:x"; else opts = "b:Cc:df:g:h:Hi:l:LM:m:pPr:S:s:T:t:x"; @@ -1349,15 +1362,23 @@ main(int argc, char **argv) print_scrnmap(); break; case 'f': - type = optarg; - font = nextarg(argc, argv, &optind, 'f', 0); + optarg = nextarg(argc, argv, &optind, 'f', 0); + if (optarg != NULL) { + font = nextarg(argc, argv, &optind, 'f', 0); + + if (font == NULL) { + type = NULL; + font = optarg; + } else + type = optarg; - if (font == NULL) { - type = NULL; - font = optarg; - } + load_font(type, font); + } else { + if (!vt4_mode) + usage(); /* Switch syscons to ROM? */ - load_font(type, font); + load_default_vt4font(); + } break; case 'g': if (sscanf(optarg, "%dx%d",