From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: <gentoo-user+bounces-195586-garchives=archives.gentoo.org@lists.gentoo.org> Received: from lists.gentoo.org (pigeon.gentoo.org [208.92.234.80]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by finch.gentoo.org (Postfix) with ESMTPS id 434951382C5 for <garchives@archives.gentoo.org>; Fri, 2 Apr 2021 18:30:09 +0000 (UTC) Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id C81A8E088A; Fri, 2 Apr 2021 18:30:03 +0000 (UTC) Received: from mail.muc.de (colin.muc.de [193.149.48.1]) by pigeon.gentoo.org (Postfix) with SMTP id 2822CE087A for <gentoo-user@lists.gentoo.org>; Fri, 2 Apr 2021 18:30:02 +0000 (UTC) Received: (qmail 56016 invoked by uid 3782); 2 Apr 2021 18:30:01 -0000 Received: from acm.muc.de (p4fe15d59.dip0.t-ipconnect.de [79.225.93.89]) (using STARTTLS) by colin.muc.de (tmda-ofmipd) with ESMTP; Fri, 02 Apr 2021 20:30:01 +0200 Received: (qmail 4016 invoked by uid 1000); 2 Apr 2021 18:30:00 -0000 Date: Fri, 2 Apr 2021 18:30:00 +0000 To: gentoo-user@lists.gentoo.org Subject: Re: [gentoo-user] Console scrollback Message-ID: <YGdiqHoM+SPijiAb@ACM> References: <2189375.ElGaqSPkdT@peak> <X/84j2kqNylahvcE@ACM> <fc016ba5-f0ae-e29b-94fc-aa1bb568ebfa@spamtrap.tnetconsulting.net> <X/9so7lnwoT7d/bk@ACM> <rtnrdt$5ek$2@ciao.gmane.io> <YABsDhC+lpzPq4R2@ACM> <YALVrMTrEcNE72ie@ACM> <20210117051748.B8178E0863@pigeon.gentoo.org> <5b91facce60a6e491d843421316ccab78bdd2bee.camel@openeye.net> <YAiLjZKM9eGrZjY2@ACM> Precedence: bulk List-Post: <mailto:gentoo-user@lists.gentoo.org> List-Help: <mailto:gentoo-user+help@lists.gentoo.org> List-Unsubscribe: <mailto:gentoo-user+unsubscribe@lists.gentoo.org> List-Subscribe: <mailto:gentoo-user+subscribe@lists.gentoo.org> List-Id: Gentoo Linux mail <gentoo-user.gentoo.org> X-BeenThere: gentoo-user@lists.gentoo.org Reply-to: gentoo-user@lists.gentoo.org X-Auto-Response-Suppress: DR, RN, NRN, OOF, AutoReply MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <YAiLjZKM9eGrZjY2@ACM> X-Submission-Agent: TMDA/1.3.x (Ph3nix) From: Alan Mackenzie <acm@muc.de> X-Primary-Address: acm@muc.de X-Archives-Salt: a62f7fd2-560b-44fc-b8bd-f14dc1b2b706 X-Archives-Hash: 73fc2540630bffc69bc8901ffea351ba Hello, Gentoo. On Wed, Jan 20, 2021 at 19:59:09 +0000, Alan Mackenzie wrote: [Context: Scrolling on the Linux text console using the keys <shift><PgUp> and <shift><PgDn> has been removed from the kernel. This is not a Good Thing.] > What I have in mind now is writing a Linux driver, a small piece of code > which would piggy-back on the existing virtual terminal drivers, and > simply pass everything through to and from the main driver, filtering out > things relevant to scrolling, and processing these in my new driver. > I've spent the last few evenings reading up on drivers, and reading the > relevant source code from 4.19.97. I can understand the kernel > maintainers not being enthusiastic about the existing code. But that > dates from, I believe, the 1990s, when RAM was measured in megabytes, and > processor speeds in megahertz. Optimisation for speed and store usage > just isn't important any more. I finally got around to looking into this seriously in the last couple of weeks. The above plan turned out not to be the right thing. I've now cobbled together a working console scroll on Linux 5.4.80-gentoo-r1. In the end, I reused much of the old machinery which was still present in 4.19.97. Once I've tidied it up, I hope that the resulting patch file will apply cleanly also to later versions than 5.4.80-r1. As a matter of interest, the kernel code for the console is not the easiest in the world to deal with, having too many abstractions and too few comments. ;-( I've enhanced the mechanism so that each tty has its own scrollback buffer, rather than one buffer being shared between all tty's. The default size of these buffers is now 128kB, but can be set in make menuconfig. I'm intending to make sharing a buffer between all tty's be an option, but haven't implemented that yet. The code, as yet, is a bit scruffy (in fact, very scruffy), and I have several technical problems: (i) The scrolling doesn't work on /dev/tty1 aka the console. (ii) When, e.g., /dev/tty6 has been scrolled upwards a bit, and then <Alt><F2> pressed to go to /dev/tty2, on returning to /dev/tty6, the scrolling has been cancelled and the cursor is no longer visible. However, the scrollback buffer is still present. I think I'm fairly likely to be able to solve (ii). However, (i), the problem with /dev/tty1, has me baffled. I don't know where to start looking for the problem. If anybody with some kernel knowledge could make any suggestions, I'd be very grateful. -- Alan Mackenzie (Nuremberg, Germany).