1 |
Hello, Gentoo. |
2 |
|
3 |
On Wed, Jan 20, 2021 at 19:59:09 +0000, Alan Mackenzie wrote: |
4 |
|
5 |
[Context: Scrolling on the Linux text console using the keys |
6 |
<shift><PgUp> and <shift><PgDn> has been removed from the kernel. This |
7 |
is not a Good Thing.] |
8 |
|
9 |
> What I have in mind now is writing a Linux driver, a small piece of code |
10 |
> which would piggy-back on the existing virtual terminal drivers, and |
11 |
> simply pass everything through to and from the main driver, filtering out |
12 |
> things relevant to scrolling, and processing these in my new driver. |
13 |
> I've spent the last few evenings reading up on drivers, and reading the |
14 |
> relevant source code from 4.19.97. I can understand the kernel |
15 |
> maintainers not being enthusiastic about the existing code. But that |
16 |
> dates from, I believe, the 1990s, when RAM was measured in megabytes, and |
17 |
> processor speeds in megahertz. Optimisation for speed and store usage |
18 |
> just isn't important any more. |
19 |
|
20 |
I finally got around to looking into this seriously in the last couple |
21 |
of weeks. The above plan turned out not to be the right thing. |
22 |
|
23 |
I've now cobbled together a working console scroll on Linux |
24 |
5.4.80-gentoo-r1. In the end, I reused much of the old machinery which |
25 |
was still present in 4.19.97. Once I've tidied it up, I hope that the |
26 |
resulting patch file will apply cleanly also to later versions than |
27 |
5.4.80-r1. |
28 |
|
29 |
As a matter of interest, the kernel code for the console is not the |
30 |
easiest in the world to deal with, having too many abstractions and too |
31 |
few comments. ;-( |
32 |
|
33 |
I've enhanced the mechanism so that each tty has its own scrollback |
34 |
buffer, rather than one buffer being shared between all tty's. The |
35 |
default size of these buffers is now 128kB, but can be set in make |
36 |
menuconfig. I'm intending to make sharing a buffer between all tty's be |
37 |
an option, but haven't implemented that yet. |
38 |
|
39 |
The code, as yet, is a bit scruffy (in fact, very scruffy), and I have |
40 |
several technical problems: |
41 |
|
42 |
(i) The scrolling doesn't work on /dev/tty1 aka the console. |
43 |
(ii) When, e.g., /dev/tty6 has been scrolled upwards a bit, and then |
44 |
<Alt><F2> pressed to go to /dev/tty2, on returning to /dev/tty6, the |
45 |
scrolling has been cancelled and the cursor is no longer visible. |
46 |
However, the scrollback buffer is still present. |
47 |
|
48 |
I think I'm fairly likely to be able to solve (ii). However, (i), the |
49 |
problem with /dev/tty1, has me baffled. I don't know where to start |
50 |
looking for the problem. If anybody with some kernel knowledge could |
51 |
make any suggestions, I'd be very grateful. |
52 |
|
53 |
-- |
54 |
Alan Mackenzie (Nuremberg, Germany). |