From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.2.5 (2008-06-10) on sa.int.altlinux.org X-Spam-Level: X-Spam-Status: No, score=-1.5 required=5.0 tests=BAYES_00,DNS_FROM_OPENWHOIS autolearn=no version=3.2.5 Date: Mon, 21 Mar 2011 22:42:36 +0100 From: Michael Schutte To: kbd@lists.altlinux.org Message-ID: <20110321214236.GA13370@graeme> Mail-Followup-To: kbd@lists.altlinux.org MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="ZfOjI3PrQbgiZnxM" Content-Disposition: inline Jabber-ID: michi@uiae.at User-Agent: Mutt/1.5.17 (2007-11-01) Subject: [kbd] New vt_mode tool for kbd? X-BeenThere: kbd@lists.altlinux.org X-Mailman-Version: 2.1.12 Precedence: list Reply-To: Linux console tools development discussion List-Id: Linux console tools development discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 21 Mar 2011 21:43:12 -0000 Archived-At: List-Archive: --ZfOjI3PrQbgiZnxM Content-Type: multipart/mixed; boundary="EeQfGwPcQSOJBaQU" Content-Disposition: inline --EeQfGwPcQSOJBaQU Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable Hi Alexey, The console-setup package in Debian needs a way to check for the text/graphics mode of the active VT (from a shell script). This can be done with =E2=80=9Csetfont -v -o /dev/null=E2=80=9D, for example, but that = isn=E2=80=99t very elegant. Julien Cristau has proposed a small utility (which I=E2=80=99m ca= lling =E2=80=9Cvt_mode=E2=80=9D for now) to report this information in a canonica= l fashion. I=E2=80=99ve adapted it to kbd; see attachment. Do you think this code is suitable for inclusion? If so, I am going to integrate it into the build system and write a short man page for it, so I can send you a proper patch. I=E2=80=99d like to hear your opinion! All the best, --=20 Michael Schutte | michi@{uiae.at,debian.org} Innsbruck, Austria | happily accepting encrypted mail OpenPGP: 0x16fb 517b a866 c3f6 8f11 1485 f3e4 122f 1D8C 261A --EeQfGwPcQSOJBaQU Content-Type: text/x-csrc; charset=us-ascii Content-Disposition: attachment; filename="vt_mode.c" /* * vt_mode: report VT mode (text or graphics) * * Contributed by Julien Cristau in * http://bugs.debian.org/618573; * adapted to kbd by Michael Schutte . */ #include #include #include #include #include #include #include #include "getfd.h" #include "nls.h" #include "version.h" static void attr_noreturn usage(int code) { fprintf(stderr, _("Usage: vt_mode [-C DEVICE]\n")); exit(code); } int main(int argc, char *argv[]) { int fd, rc, mode, c; char *console = NULL; set_progname(argv[0]); #ifndef __klibc__ setlocale(LC_ALL, ""); bindtextdomain(PACKAGE_NAME, LOCALEDIR); textdomain(PACKAGE_NAME); #endif while ((c = getopt(argc, argv, "C:hV")) != EOF) { switch (c) { case 'C': if (optarg == NULL || optarg[0] == '\0') usage(1); console = optarg; break; case 'h': usage(0); break; case 'V': print_version_and_exit(); break; default: usage(1); } } fd = getfd(console); rc = ioctl(fd, KDGETMODE, &mode); if (rc < 0) { fprintf(stderr, _("%s: Error reading VT mode.\n"), progname); return 1; } switch (mode) { case KD_TEXT: printf("text\n"); break; case KD_GRAPHICS: printf("graphics\n"); break; default: printf("other (%d)\n", mode); break; } return 0; } --EeQfGwPcQSOJBaQU-- --ZfOjI3PrQbgiZnxM Content-Type: application/pgp-signature; name="signature.asc" Content-Description: Digital signature Content-Disposition: inline -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.11 (GNU/Linux) iQEcBAEBCAAGBQJNh8ZMAAoJEPPkEi8djCYaSfoH/2yqQPE+OwrS7pNXosqHy/PE DDndgyuwWSPYMfMZput+O/odOKp+3ohRQVEMECwnVU9CyVW6hqA8PP5G0egzaNgE pWYnPLUaAjRaXnuLp+UgewzSVTcJ9Fj9px0cn6pLBiWfz1ArnR5+RgwiRnZjiktB 6BhxN/oxYDwnwzKyuUaMl39HIuJnU46BZKkmNI+x+K8YGS9Sl6T11mZpe0g59svp rGI2+QLP2Al8rMVqN0Nmg9GRhqVpC3uivhg+Dx1iCFfx8Jpsy2ytvw+3mr3ldyyq SFkkRQ56qkHWeEuO0EJN5Xm8rLH4lJJtWCGzxOmWqz2yR/YIBORUGDgldPsdW2U= =l7qM -----END PGP SIGNATURE----- --ZfOjI3PrQbgiZnxM--