Преглед на файлове

terminal: seriallog show prints the whole capture

Drop the xhci/usbhid/touchpad line filter: seriallog show is the serial-less board general-purpose view of the always-on COM1 ring, so print every line (still dropping CRs and reporting ring truncation).  Update AGENTS.md and the development page.
Johannes Zellner преди 3 часа
родител
ревизия
acb4473af9
променени са 3 файла, в които са добавени 12 реда и са изтрити 35 реда
  1. 4 5
      AGENTS.md
  2. 1 1
      docs/development.html
  3. 7 29
      kernel/terminal.c

+ 4 - 5
AGENTS.md

@@ -2656,7 +2656,7 @@ it to `0x7E00`.  The kernel region itself only has one wall (`_end` below
 `cd [path]`, `ls [path]`, `cat <path>`, `save <path> <text>`, `rm <path>`,
 `mkdir <path>`, `rmdir <path>`, `hello`, `acpidump` (writes the mapped
 DSDT to `/share/DSDT.BIN`), `reboot`, `poweroff`,
-`display`, `cpuinfo`, `mouseinfo`, `gfxbench`, `lsusb`, `touchpad [probe] [rightclick off|tap|corner|both] [tapclick on|off] [scroll on|off|natural|traditional] [invert on|off]`, `lspci [id]`, `peek <addr> [len]`, `poke <addr> <val>`, `storage`, `disks` (the ngui storage manager), `meminfo`, `top`, `process` (the ngui task manager), `bootscan` (the live boot storage-scan window), `seriallog save <path>|show` (write the always-on COM1 capture to a file, or print only its xhci/usb/touchpad lines on screen), `sched`, `format [-y] <device> [size]` (binary units, e.g. `format ide0 100mb` or `1gb`; no size formats the whole disk; `-y` skips the prompt), `install [-y] <target> [source|self]` (clone the live image, or write the running image; auto-detects the source, preferring `usb0`; `auto` targets the only non-USB NebOS disk),
+`display`, `cpuinfo`, `mouseinfo`, `gfxbench`, `lsusb`, `touchpad [probe] [rightclick off|tap|corner|both] [tapclick on|off] [scroll on|off|natural|traditional] [invert on|off]`, `lspci [id]`, `peek <addr> [len]`, `poke <addr> <val>`, `storage`, `disks` (the ngui storage manager), `meminfo`, `top`, `process` (the ngui task manager), `bootscan` (the live boot storage-scan window), `seriallog save <path>|show` (write the always-on COM1 capture to a file, or print the whole capture on screen), `sched`, `format [-y] <device> [size]` (binary units, e.g. `format ide0 100mb` or `1gb`; no size formats the whole disk; `-y` skips the prompt), `install [-y] <target> [source|self]` (clone the live image, or write the running image; auto-detects the source, preferring `usb0`; `auto` targets the only non-USB NebOS disk),
 `ps`, `renice <pid> <weight>`, `kill <pid>`, `idle [auto|hlt|c1e|c3|c6]`, `power`, `powerinfo`, `cpufreq [auto|min|max|off|<pstate>]`, `spin [ms]`, `membench` (ring-3 speed check: TSC, ALU, heap/BSS memcpy, syscall rates), `backlight [0-100|up|down]` (also `probe`), `keytest` (raw scancode tap), `help`, `clear`, `serial test`, `kexec`, `dbg`, `service [list|status <name>|start|stop|restart|kill <name>|logs <name>|logtail <name>|--gui]` (init's client; `websrv` is the first service and holds the raw NIC receiver while running), `view <file>` (image viewer; PNG, baseline/progressive JPEG, animated GIF, BMP, TGA, PNM, ICO, PAM), `browser [url|file]` (disk app launcher; waits for the app so a terminal launch is foreground), and `chat [config-path]` (Cloudron Chat client).
 
 Network: `netinfo`, `netrecv`, `netsend`, `netip [a.b.c.d]`, `dhcp` (re-run the
@@ -3197,10 +3197,9 @@ touchpad probe
 seriallog show
 ```
 
-`seriallog show` prints only the xhci/usb/touchpad lines, so the filtered
-trace is readable on screen even when no USB volume is mounted; `seriallog
-save /usb0p3/USBLOG.TXT` writes the complete capture to the boot stick's FAT
-ESP instead.  The file contains the xHCI init lines for every controller,
+`seriallog show` prints the whole capture on screen, so the trace is readable
+even when no USB volume is mounted; `seriallog save /usb0p3/USBLOG.TXT` writes
+the complete capture to the boot stick's FAT ESP instead.  The file contains the xHCI init lines for every controller,
 every `usbhid:` attach/detach/first-report line, USB port-reset/Address
 Device errors (with the completion code), and the touchpad probe's serial
 copy (`tp_serial_status()` includes the LPSS id/BAR, component type,

+ 1 - 1
docs/development.html

@@ -365,7 +365,7 @@ make net-cmds                   # replace /ramfs only</code></pre>
 		<ul>
 			<li><strong>Serial log.</strong> <code>make monitor</code> shows the boot trace and printf-style driver output. The <code>NebOS v… booted</code> line is written before the framebuffer is ready.</li>
 			<li><strong>Boot time.</strong> Timestamp COM1 on the host (QEMU <code>-serial stdio</code>): the kernel starts at <code>NebOS v… booted</code>, the desktop at <code>wm: first frame</code>, and the terminal is on screen at <code>wm: first window frame (term) at N ms</code> (kernel uptime; the <code>bootscan</code> window presents just before it and is not counted).  On QEMU the USB image reaches it about 0.5 s after the kernel starts; USB, the NIC and the disks are probed after that (<code>[boot] usb/net/storage</code> lines).</li>
-			<li><strong>No serial port.</strong> The boot console is the early log. After the desktop, <code>bootlog</code> prints the captured text and <code>bootlog save /usb0p3/BOOTLOG.TXT</code> writes it to the live stick's FAT ESP (mount that partition on the host to read it).  <code>seriallog show</code> prints only the always-on COM1 capture's <code>xhci</code>/<code>usb</code>/<code>touchpad</code> lines on screen, which works even when no USB volume is mounted; <code>seriallog save /usb0p3/USBLOG.TXT</code> writes the full capture instead.  The capture includes the xHCI init/Address Device failure lines for both controllers and the touchpad probe's LPSS/PMECTRL/pad diagnostics; run <code>touchpad probe</code> first.  Once DHCP works, <code>make netmon</code> mirrors serial and terminal output to UDP 19290, so it becomes the serial console.</li>
+			<li><strong>No serial port.</strong> The boot console is the early log. After the desktop, <code>bootlog</code> prints the captured text and <code>bootlog save /usb0p3/BOOTLOG.TXT</code> writes it to the live stick's FAT ESP (mount that partition on the host to read it).  <code>seriallog show</code> prints the whole always-on COM1 capture on screen, which works even when no USB volume is mounted; <code>seriallog save /usb0p3/USBLOG.TXT</code> writes it to a file instead.  The capture includes the xHCI init/Address Device failure lines for both controllers and the touchpad probe's LPSS/PMECTRL/pad diagnostics; run <code>touchpad probe</code> first.  Once DHCP works, <code>make netmon</code> mirrors serial and terminal output to UDP 19290, so it becomes the serial console.</li>
 			<li><strong>Network console.</strong> <code>make netmon</code> listens to UDP 19290 for serial and terminal output; <code>netconsole host &lt;ip&gt;</code> narrows the target.</li>
 			<li><strong>dbg.</strong> The ring-0 serial monitor accepts <code>r addr len</code>, <code>w addr b0 …</code>, <code>i port</code>, <code>o port val</code>, <code>h</code> and <code>q</code>.</li>
 			<li><strong>Keys.</strong> <code>keytest</code> drains the raw scancode tap in <span class="file">io.c</span> and prints every byte with its E0-prefix state, make/break kind and decoded <code>IO_KEY_*</code>/ASCII value; Ctrl+C stops it.  It sees releases and keys the decoder ignores, so an unknown action-row key is easy to identify.</li>

+ 7 - 29
kernel/terminal.c

@@ -216,9 +216,9 @@ static int cmd_bootlog(struct term *t, const char *args)
 	return 0;
 }
 
-/* Save the always-on COM1 capture (xHCI, usbhid, USB errors and explicit
- * touchpad diagnostics) to a file.  On a serial-less board, write it to the
- * USB ESP and read it from Linux after a reboot. */
+/* Save the always-on COM1 capture to a file, or print the whole capture on
+ * screen.  On a serial-less board, write it to the USB ESP and read it from
+ * Linux after a reboot. */
 static int cmd_seriallog(struct term *t, const char *args)
 {
 	const char *p;
@@ -234,35 +234,13 @@ static int cmd_seriallog(struct term *t, const char *args)
 
 		while (i < len) {
 			unsigned int j = i, k;
-			int show = 0;
 
 			while (j < len && p[j] != '\n')
 				j++;
-			{
-				static const char *const pat[3] = {
-					"xhci", "usbhid", "touchpad"
-				};
-
-				for (k = 0; k < 3; k++) {
-					const char *q = pat[k];
-					unsigned int a, b;
-
-					for (a = i; a < j && !show; a++) {
-						for (b = 0; q[b] &&
-						     a + b < j &&
-						     p[a + b] == q[b]; b++)
-							;
-						if (!q[b])
-							show = 1;
-					}
-				}
-			}
-			if (show) {
-				for (k = i; k < j; k++)
-					if (p[k] != '\r')
-						io_putchar(p[k]);
-				io_putchar('\n');
-			}
+			for (k = i; k < j; k++)
+				if (p[k] != '\r')
+					io_putchar(p[k]);
+			io_putchar('\n');
 			i = j < len ? j + 1 : j;
 		}
 		if (bootcon_serlog_truncated())