Received: by 2002:ac0:a581:0:0:0:0:0 with SMTP id m1-v6csp733931imm; Fri, 29 Jun 2018 05:38:09 -0700 (PDT) X-Google-Smtp-Source: AAOMgpcV0H29vJG8ZkcZHfglI8Qq2eCsk6+eCbQLz/OPQ4gT6deXxybCo/XxBPBBmlkeS+SIM7SQ X-Received: by 2002:a62:4556:: with SMTP id s83-v6mr14421813pfa.73.1530275889017; Fri, 29 Jun 2018 05:38:09 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1530275888; cv=none; d=google.com; s=arc-20160816; b=vp0C9n2LpCSzf4WqhKMYvbTeD3seCbbSsBU1aC/3ez9dlM9v9F4MdVsqqh9ESGcn8x vRUsHOixHMsX0fCfR6N3k1VN1OjJptwf6v5qrqtVl0+kAMxgatBEHtm8BT/+wGqjkhkN Uxhmk4AAX3KfEYM53lwxgDd3RALJjMqI8yoiRPazvzL7HKTvvcopwfdqQHR0Mwtn9+XI BxubQC9jLd1U/ao3uHxmVuTuj03bNXa44Eqsloz5WWLrhdobEnkYPEaU6ODvfGlYD6S6 UpneXnYENyjekrZSGg4zvRjOJ2/hzyZ4Q2TUet/+W9z9YN3nZAIks32r/pte54MZdZOL YLew== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:cc:to:subject :message-id:date:from:in-reply-to:references:mime-version :arc-authentication-results; bh=5rZEIgPFqR4N/RZ0RcCop4IPD4hMaH0OJIHeGlVKMJo=; b=cbP95XUPQXcovAiu3X8ENohcS/AhEFCneab53yk2E41FoCjaz/vYTtxNtJIHvoQyVN iaayVm50fF310wbYalbXjfaG8YEYrhjm893tUQI61m3kU/rLSGrKn2hjYnZxW9QKnIDB 2poDqTJjYcOnl7IT0zeUIPBVBDFEEBGViroWDw6keAiz8RYvs3ckVc9OKoM4M9Z6KNGj 6aQYkP1FNd5Bqlq2bO8TTMIaKPCrgk+bbjCtpdIGGVn6e+AnzejTbSz0G1ACpQC3yuR1 7KCgJXZQffu/LVlxjVEN7zage731gI0Mh+JGtstlFfwHvkHm46G4ngnhsSSywex29CQ1 Ztmw== ARC-Authentication-Results: i=1; mx.google.com; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id p1-v6si9466701plb.204.2018.06.29.05.37.54; Fri, 29 Jun 2018 05:38:08 -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; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S933463AbeF2IPo convert rfc822-to-8bit (ORCPT + 99 others); Fri, 29 Jun 2018 04:15:44 -0400 Received: from mail-vk0-f65.google.com ([209.85.213.65]:44070 "EHLO mail-vk0-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752071AbeF2IPi (ORCPT ); Fri, 29 Jun 2018 04:15:38 -0400 Received: by mail-vk0-f65.google.com with SMTP id x4-v6so4849611vkx.11; Fri, 29 Jun 2018 01:15:38 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc:content-transfer-encoding; bh=ksb85eCHgRCsZIzOuTOtRCOIsJgDt7FmFZQUHs+Ml/Y=; b=q3MdW6ZjAJbKpVzdjFgahsf/Mh+a8GTUVms4gldDOEi6bzUPfTZk3RZj8w/UyQ+oDn WPNWQrTaV7e7zvsfx4H4JmSlPvG46yNFKngMR5kHtPyXXrfQSp91vflXPtnIMDr+arXC w50hwEb09OrMqssRHD/BQQPpXGXqxjLLGU6oEHx/i2rwfOrxw14Llc9R3DSuaFc3CCKG s5eSv0QfKnivS4fTxJej2Nnu+9knIk3FqYeTPjeirDcOhT639BjKiKDlf8iiGy/nSFJe KXvz29PhXdzAuviSdtHpP+6S7IwshmjmoxcGOi6BxKfNQ7dRPgZO3YXbS7e9xf9Slirc aP9A== X-Gm-Message-State: APt69E3s7tvipv6xTxiqvUPaYib6A6tRpYrt8X9xRouBDh3+os7K07mO YkU/eM+Ysq6Ve0CPIXbqspcNp/aYAz+zNmlPkes= X-Received: by 2002:a1f:2c0d:: with SMTP id s13-v6mr8065292vks.106.1530260137552; Fri, 29 Jun 2018 01:15:37 -0700 (PDT) MIME-Version: 1.0 References: <20180627035642.8561-1-nicolas.pitre@linaro.org> <20180627035642.8561-3-nicolas.pitre@linaro.org> In-Reply-To: <20180627035642.8561-3-nicolas.pitre@linaro.org> From: Geert Uytterhoeven Date: Fri, 29 Jun 2018 10:15:26 +0200 Message-ID: Subject: Re: [PATCH v3 2/3] vt: introduce unicode mode for /dev/vcs To: Nicolas Pitre Cc: Greg KH , Dave@mielke.cc, Samuel Thibault , Adam Borowski , One Thousand Gnomes , Linux Kernel Mailing List , linux-console@vger.kernel.org Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: 8BIT Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Nicolas, On Wed, Jun 27, 2018 at 7:03 AM Nicolas Pitre wrote: > Now that the core vt code knows how to preserve unicode values for each > displayed character, it is then possible to let user space access it via > /dev/vcs*. > > Unicode characters are presented as 32 bit values in native endianity > via the /dev/vcsu* devices, mimicking the simple /dev/vcs* devices. > Unicode with attributes (similarly to /dev/vcsa*) is not supported at > the moment. > > Data is available only as long as the console is in UTF-8 mode. ENODATA > is returned otherwise. > > This was tested with the latest development version (to become > version 5.7) of BRLTTY. Amongst other things, this allows ⠋⠕⠗ ⠞⠓⠊⠎ > ⠃⠗⠁⠊⠇⠇⠑⠀⠞⠑⠭⠞⠀to appear directly on braille displays regardless of the > console font being used. > > Signed-off-by: Nicolas Pitre Thanks for your patch (which is now in tty-next). > --- a/drivers/tty/vt/vc_screen.c > +++ b/drivers/tty/vt/vc_screen.c > @@ -51,6 +57,26 @@ > > #define CON_BUF_SIZE (CONFIG_BASE_SMALL ? 256 : PAGE_SIZE) > > +/* > + * Our minor space: > + * > + * 0 ... 63 glyph mode without attributes > + * 64 ... 127 unicode mode without attributes > + * 128 ... 191 glyph mode with attributes > + * 192 ... 255 unused (reserved for unicode with attributes) > + * > + * This relies on MAX_NR_CONSOLES being <= 63, meaning 63 actual consoles > + * with minors 0, 64, 128 and 192 being proxies for the foreground console. > + */ > +#if MAX_NR_CONSOLES > 63 > +#warning "/dev/vcs* devices may not accommodate more than 63 consoles" > +#endif MAX_NR_CONSOLES is part of UAPI, so it cannot change. It doesn't hurt to have an explicit check here, though. However, looking into that I noticed include/uapi/linux/vt.h says: #define MAX_NR_CONSOLES 63 /* serial lines start at 64 */ But that seems to apply to /dev/tty* (major 4), not /dev/vcs* (major 7), so you're safe. > + > +#define console(inode) (iminor(inode) & 63) > +#define use_unicode(inode) (iminor(inode) & 64) > +#define use_attributes(inode) (iminor(inode) & 128) I guess you need to update Documentation/admin-guide/devices.txt, and add /dev/vcsu*? Gr{oetje,eeting}s, Geert -- Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org In personal conversations with technical people, I call myself a hacker. But when I'm talking to journalists I just say "programmer" or something like that. -- Linus Torvalds