Removes the "-unix" element and with it any trademark exposure to The
Open Group.
The split follows the ecosystem layout: SchOS is the system, and the
kernel has its own name. Kernel-identity strings are the only places
that take SchIFT -- uname(2) sysname, /proc/version, and the two licence
sentences that say "kernel" outright. That is what every Unix does here:
`uname -s` on Linux reports the kernel, not the distribution. Everything
a user reads as the product -- panic screen, boot menu, error prefixes,
docs, LICENSE, NOTICE -- is SchOS.
schunix.img is schos.img, the logo assets and the musl TLS patch are
renamed, and __SCHUNIX__ is __SCHOS__ (the define and the patch that
consumes it moved together).
Two things the rename broke, both found by the bootcheck suite:
- shmtest wrote "SCHUNIX-MMAP-OK" with a hardcoded length of 15 and
compared it back by hand-counted offsets (m[3]=='U', m[14]=='K').
The shorter marker left the write running two bytes past the literal
and the compare reading past the data, failing a file-backed mmap
that was working correctly. Now written and compared through one
constant with sizeof.
- bootcheck asserted a 31-byte file after appending to
"hello-from-schunix"; the shorter string makes it 29.
Both are the same mistake: a string literal whose length is written out
somewhere else. Full suite green -- base, Tty, Ps, Sock, Fb, Usb, Evdev.
93 lines
2.9 KiB
C
93 lines
2.9 KiB
C
#pragma once
|
|
|
|
#include "types.h"
|
|
|
|
// Raw input events -- Linux's evdev interface.
|
|
//
|
|
// The console gives characters. That is the right thing for a shell and the
|
|
// wrong thing for everything else: a character stream has no key *releases*,
|
|
// no way to tell left shift from right, no notion of a key being held, and no
|
|
// mouse at all. A game holding W to walk forward, or a compositor deciding
|
|
// which window a click landed in, needs the events underneath the characters.
|
|
//
|
|
// The layout is Linux's, deliberately. It is what every program that reads input
|
|
// already speaks -- SDL, X, libinput, every game engine -- so a program that
|
|
// runs on Linux reads input here without a porting layer. It costs nothing to
|
|
// match: the struct is four fields.
|
|
//
|
|
// Nodes are /dev/input/event0 (keyboard) and /dev/input/event1 (mouse).
|
|
|
|
struct input_timeval {
|
|
int64 tv_sec;
|
|
int64 tv_usec;
|
|
};
|
|
|
|
struct input_event {
|
|
struct input_timeval time;
|
|
uint16 type;
|
|
uint16 code;
|
|
int32 value;
|
|
};
|
|
|
|
// Event types.
|
|
#define EV_SYN 0x00
|
|
#define EV_KEY 0x01
|
|
#define EV_REL 0x02
|
|
#define EV_ABS 0x03
|
|
#define EV_MSC 0x04
|
|
|
|
#define SYN_REPORT 0
|
|
|
|
// Relative axes.
|
|
#define REL_X 0x00
|
|
#define REL_Y 0x01
|
|
#define REL_WHEEL 0x08
|
|
|
|
// Buttons live in the EV_KEY code space alongside keys, which is why the
|
|
// keyboard's codes stop well below 0x100.
|
|
#define BTN_LEFT 0x110
|
|
#define BTN_RIGHT 0x111
|
|
#define BTN_MIDDLE 0x112
|
|
|
|
// Key codes worth naming. The rest are the AT scancode-set-1 numbers, which
|
|
// Linux's keycodes were derived from and still match for everything below
|
|
// 0x54 -- that is not a coincidence and it is why the PS/2 path needs no
|
|
// translation table for unprefixed bytes.
|
|
#define KEY_RESERVED 0
|
|
#define KEY_ESC 1
|
|
#define KEY_ENTER 28
|
|
#define KEY_LEFTCTRL 29
|
|
#define KEY_LEFTSHIFT 42
|
|
#define KEY_RIGHTSHIFT 54
|
|
#define KEY_LEFTALT 56
|
|
#define KEY_SPACE 57
|
|
#define KEY_RIGHTCTRL 97
|
|
#define KEY_RIGHTALT 100
|
|
#define KEY_HOME 102
|
|
#define KEY_UP 103
|
|
#define KEY_PAGEUP 104
|
|
#define KEY_LEFT 105
|
|
#define KEY_RIGHT 106
|
|
#define KEY_END 107
|
|
#define KEY_DOWN 108
|
|
#define KEY_PAGEDOWN 109
|
|
#define KEY_INSERT 110
|
|
#define KEY_DELETE 111
|
|
#define KEY_LEFTMETA 125
|
|
#define KEY_RIGHTMETA 126
|
|
|
|
#define KEY_MAX 255
|
|
|
|
// EVIOCGRAB -- take/release exclusive access to a device.
|
|
//
|
|
// Linux's _IOW('E', 0x90, int). Spelled as the resulting constant rather than
|
|
// built from an _IOW macro because SchOS has no ioctl-encoding macros and
|
|
// inventing a set just for this would be a bigger change than the feature.
|
|
// A non-zero argument grabs, zero releases; the argument is passed by value.
|
|
#define EVIOCGRAB 0x40044590
|
|
|
|
// Which device an event came from. Both are minor numbers under the input
|
|
// major, and both are the index into the driver's array.
|
|
#define INPUT_KBD 0
|
|
#define INPUT_MOUSE 1
|
|
#define NINPUTDEV 2
|