Received: by 2002:ac0:a5b6:0:0:0:0:0 with SMTP id m51-v6csp4901439imm; Wed, 30 May 2018 14:29:26 -0700 (PDT) X-Google-Smtp-Source: ADUXVKIEuCu87wDARRhmpsZzC66mAu6wrqzmS8CEQ0ZJFYRKO0HPo1jDRtdCu6BWH4gKoOw5+pee X-Received: by 2002:a65:5002:: with SMTP id f2-v6mr3348962pgo.38.1527715766039; Wed, 30 May 2018 14:29:26 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1527715766; cv=none; d=google.com; s=arc-20160816; b=xmeLiF4ZrtMOHy/7wo3dXHpJPBj6kd9Nsuov6qYRHuzn9wyJPpoJAoOSQgxUZ/2LOJ AZGR0X3BqSdw0/rdFY32BNhrfqA+1EjfI9J05yeFX98KZtqlhcYfWdbq8uqRDyiCY5lH tJYBgbXI6evPUcCy8Vgr7I2CS2ZOsmJIOoYVzamFM4J+iDK+b/mHwkq1irhqHBnngyay HTUGmWohvf9aG18SogZvkZzd3BuaKkJBwJoNFgWG4hFlXnymRcJfofGij2Lum3cVAqlW boi6tGC/rUmPKeFNNuTax5aIPMFTAUUAG/Y76ebhXc4CZSsu3+i2zh/pm57YGe/XDA7V RY4w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:message-id:date:subject:cc:to:from :dkim-signature:arc-authentication-results; bh=fVtqwRHllaqnrlONzUas0SGRYUIF6IJ28ci6x9ZBkXk=; b=LYjnqH/qh/1jvUrzsLP4L9SJdTRH5+5K3CN+MCwvVqEYMIhzP9rrQur+/HBL1YqoUt YGZ1iiVqHgm3kpbqvfL0EkHzNsgKwRV9rviPzKdipXzOEUPrFZfGQJ6HKrqIwnmNK9kD /0WLiRgtYxdp1KI07t6JTfGDrPPOC0qeqPuXGZcYz1fGonmR0X4SDdgH0g0/0vL5Quny ZfGgvN46VHke1kDsPhdxHjJUp20W8UVtzUTGz15DpntMBJFpTuH0/mWAvJyuFFuiFbLH ACiovL2C1c0c8atFw5a/dqOqUHa4S0bPJ8mVVG4jatBl572dhSz0ZDagCSsWTK3wxmoy l1QQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@pobox.com header.s=sasl header.b=fw9hpFEz; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id j20-v6si2820312pll.211.2018.05.30.14.29.12; Wed, 30 May 2018 14:29:26 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@pobox.com header.s=sasl header.b=fw9hpFEz; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932580AbeE3V23 (ORCPT + 99 others); Wed, 30 May 2018 17:28:29 -0400 Received: from pb-smtp2.pobox.com ([64.147.108.71]:57115 "EHLO pb-smtp2.pobox.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932364AbeE3V2V (ORCPT ); Wed, 30 May 2018 17:28:21 -0400 Received: from pb-smtp2.pobox.com (unknown [127.0.0.1]) by pb-smtp2.pobox.com (Postfix) with ESMTP id E7B7BF3513; Wed, 30 May 2018 17:28:18 -0400 (EDT) DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=pobox.com; h=from:to:cc :subject:date:message-id; s=sasl; bh=8gq5femkn4t1YHB3Aj0cMLy7O28 =; b=fw9hpFEz2KoqpX30N6uWreT67N3v7Mp4vdp23YEPfHMdvfhqb14G59jsOuD CBJPKOQgD/hZCX4eydrSfJmJqN8JfQhEVW+JJVm9Uk1nLvhJYFTx3uT7gBomAg/7 Xay9d25qNWGrp3TDOWgW+P40tS1K8zys7zbltOhLw+N7TfDw= Received: from pb-smtp2.nyi.icgroup.com (unknown [127.0.0.1]) by pb-smtp2.pobox.com (Postfix) with ESMTP id DEC4FF3511; Wed, 30 May 2018 17:28:18 -0400 (EDT) Received: from yoda.home (unknown [70.82.104.228]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by pb-smtp2.pobox.com (Postfix) with ESMTPSA id 79D6FF350E; Wed, 30 May 2018 17:28:18 -0400 (EDT) Received: from xanadu.home (xanadu.home [192.168.2.2]) by yoda.home (Postfix) with ESMTP id 7C4E02DA016A; Wed, 30 May 2018 17:28:17 -0400 (EDT) From: Nicolas Pitre To: Greg Kroah-Hartman Cc: Dave Mielke , Samuel Thibault , linux-kernel@vger.kernel.org Subject: [PATCH 0/5] have the vt console preserve unicode characters Date: Wed, 30 May 2018 17:27:40 -0400 Message-Id: <20180530212745.10997-1-nicolas.pitre@linaro.org> X-Mailer: git-send-email 2.17.0 X-Pobox-Relay-ID: 5EC85C38-6450-11E8-95E8-67830C78B957-78420484!pb-smtp2.pobox.com Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org The vt code translates UTF-8 strings into glyph index values and stores those glyph values directly in the screen buffer. Because there can only be at most 512 glyphs, it is impossible to represent most unicode characters, in which case a default glyph (often '?') is displayed instead. The original unicode value is then lost. This also means that the /dev/vcs* devices only provide user space with glyph index values, and then user applications must get hold of the unicode-to-glyph table the kernel is using in order to back-translate those into actual characters. It is not possible to get back the original unicode value when multiple unicode characters map to the same glyph, especially for the vast majority that maps to the default replacement glyph. The 512-glyph limitation is inherent to VGA displays, but users of /dev/vcs* shouldn't have to be restricted to a narrow unicode space from lossy screen content because of that. This is especially true for accessibility applications such as BRLTTY that rely on /dev/vcs to rander screen content onto braille terminals. This patch series introduces unicode support to /dev/vcs* devices, allowing full unicode access from userspace to the vt console which can, amongst other purposes, appropriately translate actual unicode screen content into braille. Memory is allocated, and possible CPU overhead introduced, only if /dev/vcsu is read at least once. I'm a prime user of this feature, as well as the BRLTTY maintainer Dave Mielke who implemented support for this in BRLTTY. There is therefore a vested self interest to maintain this feature as necessary. Patch #1 has been picked up by Greg already (commit 4b4ecd9cb8 in linux-next) but it is included here as well, as the rest of the series depends on it to apply properly. Patch #5 was used for validation and is included for completeness, however if people think it is unappropriate for mainline then it can be dropped. This is also available on top of v4.17-rc7 here: git://git.linaro.org/people/nicolas.pitre/linux vt-unicode diffstat: drivers/tty/vt/vc_screen.c | 90 +++++++-- drivers/tty/vt/vt.c | 366 +++++++++++++++++++++++++++++++++-- include/linux/console_struct.h | 2 + include/linux/selection.h | 5 + 4 files changed, 429 insertions(+), 34 deletions(-)