Skip to content

Commit

Permalink
docs: Document AskfirstInitializer
Browse files Browse the repository at this point in the history
Signed-off-by: Harald Seiler <hws@denx.de>
  • Loading branch information
Rahix committed Aug 24, 2023
1 parent 07f7612 commit b561037
Show file tree
Hide file tree
Showing 2 changed files with 36 additions and 0 deletions.
3 changes: 3 additions & 0 deletions Documentation/modules/machine_board.rst
Original file line number Diff line number Diff line change
Expand Up @@ -205,3 +205,6 @@ and login.

.. autoclass:: tbot.machine.board.LinuxBootLogin
:members:

.. autoclass:: tbot.machine.board.AskfirstInitializer
:members:
33 changes: 33 additions & 0 deletions tbot/machine/board/linux.py
Original file line number Diff line number Diff line change
Expand Up @@ -202,8 +202,41 @@ def _init_machine(self) -> typing.Iterator:


class AskfirstInitializer(machine.Initializer, LinuxBoot):
"""
Initializer to deal with ``askfirst`` TTYs.
On some boards, the console is configured with ``askfirst`` which means that
the getty for logging in is only spawned after an initial ENTER is sent.
This initializer takes care of that by first waiting for the ``askfirst``
prompt and then sending ENTER.
The ``askfirst`` prompt can be customized with the ``askfirst_prompt`` attribute.
**Example**:
.. code-block:: python
from tbot.machine import board, linux
class StandaloneLinux(
board.Connector,
board.AskfirstInitializer,
board.LinuxBootLogin,
linux.Bash,
):
# board.LinuxBootLogin config:
username = "root"
password = "hunter2"
.. versionadded:: UNRELEASED
"""

askfirst_prompt = "Please press Enter to activate this console."
"""
Prompt that indicates the board is waiting for ``askfirst`` confirmation.
"""

# For proper integration with LinuxBootLogin
boot_timeout: typing.Optional[float] = None
_boot_start: typing.Optional[float] = None
bootlog: str
Expand Down

0 comments on commit b561037

Please sign in to comment.