X gets a VT: keyboard, terminal switching, and a way out
Xorg uses VTs only when stat("/dev/tty0") reports Linux's tty major 4.
SchOS's terminals sit under major 1, so X ran on no VT at all: the console
kept drawing over it, Ctrl+Alt+F-keys did nothing, and nothing ended the
session. stat now reports terminals under Linux's numbers.
startx picks the VT only when uname says Linux, so root's xserverrc passes
the current one itself. An xorg.conf.d file names X's input devices, since
Alpine's Xorg looks them up through udev and SchOS has none yet.
Alt+F1..F6 and Ctrl+Alt+F1..F6 now switch terminals as on Linux, alongside
the settable chord. USB keyboards gain arrows, Home/End/PgUp/PgDn/Ins/Del
and the switch keys, which the PS/2 path always had.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01S1giNvrHTrPMPw7V6x1kQ4
This commit is contained in:
parent
df1394eaa3
commit
4a7165c951
5 changed files with 123 additions and 9 deletions
|
|
@ -70,6 +70,22 @@ linux_makedev(uint32 major, uint32 minor)
|
|||
| ((uint64)(major & ~0xfffu) << 32) | ((uint64)(minor & ~0xffu) << 12);
|
||||
}
|
||||
|
||||
// Terminals as Linux numbers them: tty0..63 are (4, n), /dev/tty is (5, 0) and
|
||||
// /dev/console (5, 1). SchOS keeps them all under major 1 (kernel/fs/devfs.c),
|
||||
// and Linux programs look at the number rather than the name. Xorg is the one
|
||||
// that matters: it uses VTs only if stat("/dev/tty0") says major 4
|
||||
// (xf86HasTTYs), and otherwise runs on none -- no VT switch, no KD_GRAPHICS,
|
||||
// the console drawing over it, and Ctrl+Alt+F-keys doing nothing.
|
||||
static uint64
|
||||
linux_tty_rdev(uint32 major, uint32 minor)
|
||||
{
|
||||
if (major == 1 && minor == 0) return linux_makedev(4, 0);
|
||||
if (major == 1 && minor >= 11 && minor <= 16) return linux_makedev(4, minor - 10);
|
||||
if (major == 1 && minor == 10) return linux_makedev(5, 0);
|
||||
if (major == 1 && minor == 1) return linux_makedev(5, 1);
|
||||
return linux_makedev(major, minor);
|
||||
}
|
||||
|
||||
static void
|
||||
stati_linux(struct inode *ip, struct linux_stat *st)
|
||||
{
|
||||
|
|
@ -102,7 +118,7 @@ stati_linux(struct inode *ip, struct linux_stat *st)
|
|||
// entry in /dev printed as "0, 0" under ls -l -- harmless while nothing
|
||||
// read it, and wrong the moment something has to tell two disks apart.
|
||||
if (ip->type == T_DEV)
|
||||
st->st_rdev = linux_makedev(ip->major, ip->minor);
|
||||
st->st_rdev = linux_tty_rdev(ip->major, ip->minor);
|
||||
|
||||
st->st_atime = ip->atime; st->st_mtime = ip->mtime; st->st_ctime = ip->ctime;
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue