mirror of
https://github.com/apache/nuttx.git
synced 2026-09-10 19:06:35 +00:00
Documentation/applications/system/nxinit: document the "console" option
Some checks are pending
Build Documentation / build-html (push) Waiting to run
MemBrowse Memory Report / changes-filter (push) Waiting to run
MemBrowse Memory Report / load-targets (push) Waiting to run
MemBrowse Memory Report / identical (push) Blocked by required conditions
MemBrowse Memory Report / analyze (push) Blocked by required conditions
Some checks are pending
Build Documentation / build-html (push) Waiting to run
MemBrowse Memory Report / changes-filter (push) Waiting to run
MemBrowse Memory Report / load-targets (push) Waiting to run
MemBrowse Memory Report / identical (push) Blocked by required conditions
MemBrowse Memory Report / analyze (push) Blocked by required conditions
Document the per-service "console [<device>]" option added to nxinit by the companion apache/nuttx-apps PR: what it does (open the given device, or CONFIG_SYSTEM_NXINIT_CONSOLE_DEV if omitted, and dup it onto the service's stdin/stdout/stderr before spawning), why a plain shell service needs it (unlike nsh, it never opens a console device on its own), and why a USB gadget console additionally needs the gadget brought up first (e.g. via "exec -- sercon"), since the device does not exist until then. Assisted-by: Kiro:claude-sonnet-5 Signed-off-by: wangjianyu3 <wangjianyu3@xiaomi.com>
This commit is contained in:
parent
7e5bf155b5
commit
b4aa94d844
1 changed files with 36 additions and 0 deletions
|
|
@ -52,10 +52,46 @@ File path configured by ``CONFIG_SYSTEM_NXINIT_RC_FILE_PATH``.
|
|||
via the override option).
|
||||
- Options are modifiers for services, affecting their running mode and timing.
|
||||
Examples include class (specify service category for batch start/stop),
|
||||
console (redirect the service's stdio to a console device; see below),
|
||||
override (override previously defined services), restart_period (interval
|
||||
for restarting exited services), and reboot_on_failure (critical services
|
||||
trigger device reboot on startup failure or abnormal exit).
|
||||
|
||||
The ``console`` Option
|
||||
-----------------------
|
||||
|
||||
.. code-block::
|
||||
|
||||
service <name> <pathname> [ <argument> ]*
|
||||
console [ <device> ]
|
||||
|
||||
A service does not open a console device on its own - it simply inherits
|
||||
whatever stdin/stdout/stderr NXInit itself has, which for many boards is
|
||||
never set up at all (there is no ``/dev/console`` unless
|
||||
``CONFIG_DEV_CONSOLE`` is enabled). ``console`` fixes this by opening
|
||||
``<device>`` (``CONFIG_SYSTEM_NXINIT_CONSOLE_DEV``, ``/dev/console`` by
|
||||
default, if omitted) and duplicating it onto the service's stdin, stdout
|
||||
and stderr before it is spawned.
|
||||
|
||||
This is required for a plain shell service (e.g. ``service console sh``)
|
||||
to actually be usable as an interactive console. It is not needed for
|
||||
``nsh`` (the full NSH application, as opposed to plain ``sh``), which
|
||||
already does the equivalent internally via ``nsh_consolemain()``.
|
||||
|
||||
For a USB gadget console (``CONFIG_CDCACM_CONSOLE``/``CONFIG_PL2303_CONSOLE``),
|
||||
the device does not exist until the gadget is actually registered with the
|
||||
USB stack - unlike a plain UART, this does not happen implicitly during
|
||||
early boot. The gadget must be brought up once, before any service using
|
||||
``console`` is started, e.g. via ``apps/system/cdcacm``'s ``sercon``:
|
||||
|
||||
.. code-block::
|
||||
|
||||
on init
|
||||
exec -- sercon
|
||||
|
||||
service console sh
|
||||
console
|
||||
|
||||
Triggers
|
||||
========
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue