Your message dated Wed, 25 May 2011 21:03:17 +0000
with message-id <[email protected]>
and subject line Bug#617416: fixed in kbd 1.15.3-1
has caused the Debian Bug report #617416,
regarding kbd: [Feature Request] Add userspace utility for adjusting the 
virtual terminal color map
to be marked as done.

This means that you claim that the problem has been dealt with.
If this is not the case it is now your responsibility to reopen the
Bug report if necessary, and/or fix the problem forthwith.

(NB: If you are a system administrator and have no idea what this
message is talking about, this may indicate a serious mail system
misconfiguration somewhere. Please contact [email protected]
immediately.)


-- 
617416: http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=617416
Debian Bug Tracking System
Contact [email protected] with problems
--- Begin Message ---
Package: kbd
Version: 1.15-1ubuntu4
Severity: wishlist

I just uploaded this change to Ubuntu's kbd package, and I thought it prudent 
to send it upstream to Debian as well, as I suspect some Debian users might 
appreciate this utility.

I (co-)wrote a tool, /sbin/setvtrgb, that uses a clever ioctl() to dynamically 
adjust the virtual terminal's (console's) 16-color color map.  There's a 
manpage included in the diff that explains how to (very simply) use the tool.

A separate upload to another source package (console-setup) in Ubuntu will 
install a distro-recommended (though user-adjustable) conffile with an 
attractive palette and an upstart job that applies the configuration on boot.

Debdiff attached.  Thanks!

-- System Information:
Debian Release: squeeze/sid
  APT prefers natty-updates
  APT policy: (500, 'natty-updates'), (500, 'natty-security'), (500, 'natty')
Architecture: amd64 (x86_64)

Kernel: Linux 2.6.38-5-generic (SMP w/4 CPU cores)
Locale: LANG=en_US.UTF-8, LC_CTYPE=en_US.UTF-8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/dash

Versions of packages kbd depends on:
ii  console-setup              1.57ubuntu11  console font and keymap setup prog
ii  initramfs-tools            0.98.8ubuntu2 tools for generating an initramfs
ii  libc6                      2.13-0ubuntu4 Embedded GNU C Library: Shared lib
ii  lsb-base                   4.0-0ubuntu9  Linux Standard Base 4.0 init scrip

kbd recommends no packages.

kbd suggests no packages.

-- no debconf information
diff -u kbd-1.15/debian/copyright kbd-1.15/debian/copyright
--- kbd-1.15/debian/copyright
+++ kbd-1.15/debian/copyright
@@ -63,0 +64,6 @@
+
+Files: setvtrgb.c
+Copyright © 2011 Canonical Ltd.
+License: GPL-2+
+Authors: Seth Forshee <[email protected]>
+         Dustin Kirkland <[email protected]>
diff -u kbd-1.15/debian/changelog kbd-1.15/debian/changelog
--- kbd-1.15/debian/changelog
+++ kbd-1.15/debian/changelog
@@ -1,3 +1,14 @@
+kbd (1.15-1ubuntu4) natty; urgency=low
+
+  * src/setvtrgb.c, man/man8/setvtrgb.8, COPYING, debian/rules,
+    debian/copyright: LP: #730672
+    - Add a 'setvtrgb' utility to configure vt/console colors
+    - add to udeb (so that this can improve installer usability)
+    - add to /sbin, run by root
+    - update copyright statement
+
+ -- Dustin Kirkland <[email protected]>  Tue, 08 Mar 2011 15:32:10 +0000
+
 kbd (1.15-1ubuntu3) lucid; urgency=low
 
   * loadkeys: If not invoked with an explicit console parameter, try to find
diff -u kbd-1.15/debian/rules kbd-1.15/debian/rules
--- kbd-1.15/debian/rules
+++ kbd-1.15/debian/rules
@@ -4,12 +4,12 @@
 KBD = $(TOPDIR)/debian/kbd
 KBD_UDEB = $(TOPDIR)/debian/kbd-udeb
 
-UDEB_BINARIES = loadkeys kbd_mode setfont
+UDEB_BINARIES = loadkeys kbd_mode setfont setvtrgb
 EXTRA_BINARIES = screendump setlogcons setvesablank
 CONTRIB_BINARIES = codepage splitfont vcstime
 
 MOVE_TO_BIN = kbd_mode setfont fgconsole openvt chvt dumpkeys unicode_start loadkeys
-MOVE_TO_SBIN = kbdrate
+MOVE_TO_SBIN = kbdrate setvtrgb
 MOVE_TO_USR_SBIN = vcstime setvesablank
 
 configure: configure-stamp
diff -u kbd-1.15/src/loadkeys.c kbd-1.15/src/loadkeys.c
only in patch2:
unchanged:
--- kbd-1.15.orig/COPYING
+++ kbd-1.15/COPYING
@@ -28,6 +28,12 @@
 (and changes to earlier mentioned programs)
 are Copyright (C) 1994-1999 Andries E. Brouwer.
 
+The file
+	setvtrgb.c
+is Copyright (C) 2011 Canonical Ltd.
+     Authors: Seth Forshee <[email protected]>
+              Dustin Kirkland <[email protected]>
+
 All files in this package may be freely copied under the terms
 of the GNU General Public License (GPL), version 2, or at your
 option any later version - except possibly for the restrictions
only in patch2:
unchanged:
only in patch2:
unchanged:
only in patch2:
unchanged:
--- kbd-1.15.orig/src/Makefile.am
+++ kbd-1.15/src/Makefile.am
@@ -4,7 +4,7 @@
 PROGS = \
 	dumpkeys loadkeys showkey setfont showconsolefont \
 	setleds setmetamode kbd_mode chvt deallocvt \
-	psfxtable kbdrate fgconsole openvt
+	psfxtable kbdrate fgconsole openvt setvtrgb
 
 if KEYCODES_PROGS
 PROGS += getkeycodes setkeycodes
@@ -54,6 +54,7 @@
 screendump_SOURCES      = $(ALL_S) screendump.c $(XMAL_S)
 setfont_SOURCES         = $(ALL_S) setfont.c $(FIND_S) $(XMAL_S) $(GETFD_S) mapscrn.c $(KDMA_S) $(PSF_S) $(UTF8_S) kdfontop.c kdfontop.h $(UNIM_S)
 setkeycodes_SOURCES     = $(ALL_S) setkeycodes.c $(GETFD_S)
+setvtrgb_SOURCES        = $(ALL_S) setvtrgb.c $(GETFD_S)
 setlogcons_SOURCES      = $(ALL_S) setlogcons.c $(GETFD_S)
 setpalette_SOURCES      = $(ALL_S) setpalette.c $(GETFD_S)
 setvesablank_SOURCES    = $(ALL_S) setvesablank.c $(GETFD_S)
only in patch2:
unchanged:
--- kbd-1.15.orig/src/setvtrgb.c
+++ kbd-1.15/src/setvtrgb.c
@@ -0,0 +1,135 @@
+/*
+ *    setvtrgb - set the virtual terminal RGB colors
+ *    Copyright (C) 2011 Canonical Ltd.
+ *
+ *    Authors: Seth Forshee <[email protected]>
+ *	       Dustin Kirkland <[email protected]>
+ *
+ *    This program is free software; you can redistribute it and/or modify
+ *    it under the terms of the GNU General Public License as published by
+ *    the Free Software Foundation; either version 2 of the License, or
+ *    (at your option) any later version.
+ *   
+ *    This program is distributed in the hope that it will be useful,
+ *    but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *    GNU General Public License for more details.
+ * 
+ *    You should have received a copy of the GNU General Public License along
+ *    with this program; if not, write to the Free Software Foundation, Inc.,
+ *    51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ */
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <fcntl.h>
+#include <unistd.h>
+#include <sys/ioctl.h>
+#include <linux/kd.h>
+#include <errno.h>
+
+/* Standard VGA terminal colors, matching those hardcoded in the Linux kernel's
+ * drivers/tty/vt/vt.c
+ */
+unsigned char vga_colors[] = {
+	0x00, 0x00, 0x00,
+	0xaa, 0x00, 0x00,
+	0x00, 0xaa, 0x00,
+	0xaa, 0x55, 0x00,
+	0x00, 0x00, 0xaa,
+	0xaa, 0x00, 0xaa,
+	0x00, 0xaa, 0xaa,
+	0xaa, 0xaa, 0xaa,
+	0x55, 0x55, 0x55,
+	0xff, 0x55, 0x55,
+	0x55, 0xff, 0x55,
+	0xff, 0xff, 0x55,
+	0x55, 0x55, 0xff,
+	0xff, 0x55, 0xff,
+	0x55, 0xff, 0xff,
+	0xff, 0xff, 0xff,
+};
+
+/* Usage statement */
+void usage(void) {
+	fprintf(stderr,
+"\nUSAGE: setvtrgb vga|[FILE]\n"
+"\n"
+"If you use the FILE parameter, FILE should be exactly 3 lines of\n"
+"comma-separated decimal values for RED, GREEN, and BLUE.\n"
+"\n"
+"To seed a valid FILE:\n"
+"  cat /sys/module/vt/parameters/default_{red,grn,blu} > FILE\n"
+"\n"
+"And then edit the values in FILE.\n\n"
+);
+	exit(EINVAL);
+}
+
+int main(int argc, const char *argv[]) {
+	int fd;
+	FILE *fp = NULL;
+	int i, j;
+	char *c;
+	unsigned char *cmap;
+	char s[1024];
+
+	/* Must have at least one argument */
+	if (argc != 2)
+		usage();
+
+	if (strcmp(argv[1], "vga") == 0)
+		/* Use the Standard VGA colors */
+		cmap = vga_colors;
+	else if (fp = fopen(argv[1], "r" )) {
+		/* Use a color palette specified in a file */
+		/* Allocate a 48 character array */
+		cmap = calloc(3*16, sizeof(unsigned char));
+		for (i=0; i<3; i++) {
+			/* Retrieve a line from file */
+			/* Tokenize the CSV string, convert to int, then to char */
+			if (fgets(s, sizeof(s), fp)) {
+				if ((c = strtok(s, ",")) != NULL)
+					cmap[i*16] = (unsigned char)atoi(c);
+				else {
+					fprintf(stderr, "ERROR: Error reading color value at line [%d], position [%d], file [%s]\n", i+1, 1, argv[1]);
+					usage();
+				}
+				for (j=1; j<16; j++) {
+					if ((c = strtok(NULL, ",")) != NULL)
+						cmap[i+j*3] = (unsigned char)atoi(c);
+					else {
+						fprintf(stderr, "ERROR: Error reading color value at line [%d], position [%d], file [%s]\n", i+1, j+1, argv[1]);
+						usage();
+					}
+				}
+			} else {
+				fprintf(stderr, "ERROR: Invalid file at [%s]\n", argv[1]);
+				usage();
+			}
+		}
+		fclose(fp);
+	} else {
+		perror(argv[1]);
+		usage();
+	}
+
+	/* Ensure that this user can open tty, before going further */
+	fd = open("/dev/tty0", O_RDONLY);
+	if (fd < 0) {
+		perror(argv[1]);
+		exit(errno);
+	}
+
+	/* Apply the color map to the tty via ioctl */
+	if (ioctl(fd, PIO_CMAP, cmap) < 0) {
+		perror("ioctl");
+		exit(errno);
+	}
+	close(fd);
+	return(0);
+}
only in patch2:
unchanged:
--- kbd-1.15.orig/man/man8/setvtrgb.8
+++ kbd-1.15/man/man8/setvtrgb.8
@@ -0,0 +1,21 @@
+.\" @(#)man/man8/setvtrgb.8	1.0 Mar  3 12:32:18 CST 2011
+.TH SETVTRGB 8 "3 Mar 2011" "Set Virtual Terminal RGB Colors"
+.SH NAME
+setvtrgb \- set the virtual terminal RGB colors
+.SH SYNOPSIS
+.B setvtrgb
+.I vga|[FILE]
+.SH DESCRIPTION
+The
+.I setvtrgb
+command takes a single argument, either the string "vga", or a path to a file containing the red, green, and blue colors to be used by the Linux virtual terminals.
+
+If you use the FILE parameter, FILE should be exactly 3 lines of 16 comma-separated decimal values for RED, GREEN, and BLUE.
+
+To seed a valid FILE:
+  cat /sys/module/vt/parameters/default_{red,grn,blu} > FILE
+
+And then edit the values in FILE.
+
+.SH AUTHOR
+This manpage and the utility were written by Dustin Kirkland <[email protected]> for Ubuntu systems (but may be used by others).   Permission is  granted to copy, distribute and/or modify this document and the utility under the terms of the GNU General Public License, Version 2 or any later version published by the Free Software Foundation.  The complete text  of  the  GNU  General  Public  License  can  be  found  in  /usr/share/common-licenses/GPL-2  on  Debian/Ubuntu  systems, or on the web at http://www.gnu.org/licenses/gpl2.txt.
only in patch2:
unchanged:
--- kbd-1.15.orig/man/man8/Makefile.am
+++ kbd-1.15/man/man8/Makefile.am
@@ -1,6 +1,6 @@
 gen_MANS = loadunimap.8 mapscrn.8 setfont.8
 dist_man_MANS = getkeycodes.8 kbdrate.8 resizecons.8 setkeycodes.8 \
-		showconsolefont.8 $(gen_MANS)
+		showconsolefont.8 setvtrgb.8 $(gen_MANS)
 
 install-data-hook:
 	cd $(DESTDIR)$(mandir)/man8 && \

--- End Message ---
--- Begin Message ---
Source: kbd
Source-Version: 1.15.3-1

We believe that the bug you reported is fixed in the latest version of
kbd, which is due to be installed in the Debian FTP archive:

kbd-udeb_1.15.3-1_i386.udeb
  to main/k/kbd/kbd-udeb_1.15.3-1_i386.udeb
kbd_1.15.3-1.debian.tar.gz
  to main/k/kbd/kbd_1.15.3-1.debian.tar.gz
kbd_1.15.3-1.dsc
  to main/k/kbd/kbd_1.15.3-1.dsc
kbd_1.15.3-1_i386.deb
  to main/k/kbd/kbd_1.15.3-1_i386.deb
kbd_1.15.3.orig.tar.gz
  to main/k/kbd/kbd_1.15.3.orig.tar.gz



A summary of the changes between this version and the previous one is
attached.

Thank you for reporting the bug, which will now be closed.  If you
have further comments please address them to [email protected],
and the maintainer will reopen the bug report if appropriate.

Debian distribution maintenance software
pp.
Michael Schutte <[email protected]> (supplier of updated kbd package)

(This message was generated automatically at their request; if you
believe that there is a problem with it please contact the archive
administrators by mailing [email protected])


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA256

Format: 1.8
Date: Wed, 25 May 2011 21:48:07 +0200
Source: kbd
Binary: kbd kbd-udeb
Architecture: source i386
Version: 1.15.3-1
Distribution: unstable
Urgency: low
Maintainer: Console utilities maintainers 
<[email protected]>
Changed-By: Michael Schutte <[email protected]>
Description: 
 kbd        - Linux console font and keytable utilities
 kbd-udeb   - Linux console keyboard setup utilities (udeb)
Closes: 617416 618573
Changes: 
 kbd (1.15.3-1) unstable; urgency=low
 .
   * New upstream release.
     - Drop the compose_as_usual patch (merged upstream).
     - Includes Dustin Kirkland’s setvtrgb utility, closes: #617416; and
       kbdinfo, vaguely based on Julien Cristau’s VT mode query code,
       closes: #618573.
     - Reflect changes to the build system in debian/rules.
     - Spanish translations had to be dropped due to problems with the
       es.po file.
   * Upgrade Standards-Version to 3.9.2, no changes needed.
   * Point Vcs-* to anonscm.debian.org.
Checksums-Sha1: 
 0238df94c90fbddd70c564b529e7bd99ce800b33 1556 kbd_1.15.3-1.dsc
 1da0c02cb802d2e68b34b1ba68839929b4255cde 1659867 kbd_1.15.3.orig.tar.gz
 147f8beab21eaed8aa95d8817c7607817f665725 32851 kbd_1.15.3-1.debian.tar.gz
 c7ede7934e727283363b56c00d43d68ca6d55406 451374 kbd_1.15.3-1_i386.deb
 d21e810194b5aaaa1d003b11e922f79e30597f8f 54418 kbd-udeb_1.15.3-1_i386.udeb
Checksums-Sha256: 
 e1d6cae12fe029c306183a4bbe5253869b572cd20ea7990f40a1794a2a16f4db 1556 
kbd_1.15.3-1.dsc
 86505713c3bb81b1517203c5bd1ad8ffacf90ef211214ee26d12ea1ed21194ed 1659867 
kbd_1.15.3.orig.tar.gz
 872123eb79fb6c56571690b0b72a9f6fbe8cd5d7cdfea41e544be42985d012bb 32851 
kbd_1.15.3-1.debian.tar.gz
 9450e4a6818ee0a5d782bf3700e652391c9f3abcfc4c96c21ed1ea5c23a2e88b 451374 
kbd_1.15.3-1_i386.deb
 f926b0f003f8cfd163684c83a9457c7ae93d6d37434287d43749bd824c3c858e 54418 
kbd-udeb_1.15.3-1_i386.udeb
Files: 
 2711e1fa527d0e220bf50ebaef28c75d 1556 utils optional kbd_1.15.3-1.dsc
 8143e179a0f3c25646ce5085e8777200 1659867 utils optional kbd_1.15.3.orig.tar.gz
 88fa8a80e7872b11a6b6c476949a8076 32851 utils optional 
kbd_1.15.3-1.debian.tar.gz
 69f061bce90278d78292253f4202a272 451374 utils optional kbd_1.15.3-1_i386.deb
 3777fef7803462ecaa96d713bd66da09 54418 debian-installer optional 
kbd-udeb_1.15.3-1_i386.udeb

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.11 (GNU/Linux)

iQEcBAEBCAAGBQJN3V5DAAoJEPPkEi8djCYagK4H/i8D0bOqrzJsFDbG2iO1yiML
acNosuFdcJNVhap0wyHuv3W+SP9PzPjWShVhCNUTY1BKmVe8u3JlFSXjMkYwWXkD
fjTDaXRcwqhic1itDszLHXXoVR1ndzUw68I0i9vTT3zUpnS0wWJcAF9+z7mdAMob
ozaeMzruPzlTvJkq6776xdwEB2X2Jp+VFUtpGoKxFErOrqAn+sikMCP7OA92rUQx
gKyKgBeoEPx2yfRJMV6CoUWEWVDbpidzwNTSjOLvb5eXHXYtz31zRRuqgFawOqrl
THQ2R0A7zfs9RZFY6LBU8RsIvY/vxajxSTrpY5Kj382VpxEPP/DDKLGecoUGIIk=
=PENB
-----END PGP SIGNATURE-----



--- End Message ---

Reply via email to