You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@mynewt.apache.org by Jerzy Kasenberg <je...@codecoup.pl> on 2019/12/04 10:10:01 UTC

Console usability changes

Hi,

  This information is meant for those who don't follow what is being merged
to mynewt
core code. It outlines new features recently added to system console that
could
be useful for users.

  Mynewt system console (uart or RTT) has recently been changed a little.
Changes should not affect unaware users, all new features are turned off by
default.
The most important addition is shell prompt visible all the time at the
bottom of the
terminal window. This change was driven by btshell users who run scan
command
which in turn prints a lot.
  With massive amount of output logs visible on the screen it was difficult
to enter
new commands since whatever was typed was immediately lost in logs.
  Now with just one syscfg value, prompt line is visible at the bottom of
the window
and commands can by typed even if prints are flooding.

  When this newt sticky prompt was introduced, a couple of small changes
were also
added:
- HOME, END keys sent by some terminals are handled in the usual way.
- CTRL^C clears current input line (much like in bash).
- ignoring non-NLIP input was really ignoring everything that was non-NLIP
(now
 line endings are not ignored since that was used by some users).

  With sticky prompt activated user can experience some unexpected behaviour
after terminal window is resized.  Terminals change some settings when
resized,
and those changes are not passed to an application that controls terminal
(it this
case mynewt system console). When user sees some strange behaviour,
rescue key is CTRL-L (much line in gdb or vim).

  Some more changes are coming (
https://github.com/apache/mynewt-core/pull/2093).
This change was also inspired by btshell users who use complicated commands
and often store them in some files for later use.
  This PR adds possibility to store commands in device persistent storage
so they
could be reused after reboot. Command history can be stored in dedicated
flash area or it can use one of the existing persistent logs (if there is
no room on
flash that could be used for this history alone).
  To improve shell user experience even more, automatic history search can
be
activated that pops up history commands while user start to type them
(feature
known from web browsers' address bar).

  All new features can be activated with syscfg values (there are two
packages for
history handling, but they will be included when history features are
turned on).
New features syscfg values can be found in:
- sys/console/full/syscfg.yml
- sys/console/full/history_ram/syscfg.yml
- sys/console/full/history_log/syscfg.yml

The most important ones are here:
* CONSOLE_PROMPT_STICKY enables prompt visible at the bottom of terminal

       CONSOLE_PROMPT_STICKY: 1

     There are some more syscfg values that could customize prompt
behaviour and look.
     When console is used with putty terminal, recommended values are:

       CONSOLE_PROMPT_STICKY: 1
       CONSOLE_PROMPT_SOFT_CURSOR: 1
       CONSOLE_PROMPT_SOFT_CURSOR_ATTR: '"30;42m"'
       CONSOLE_PROMPT_HIDE_CURSOR_IN_LOG_AREA: 1

* CONSOLE_HISTORY selects how history is handled
    none - equivalent to CONSOLE_HISTORY_SIZE = 0
    ram - equivalent to CONSOLE_HISTORY_SIZE > 0
    log - history is stored in log

   No history (default):

         CONSOLE_HISTORY: none

   For history stored in ram there is settings specifying how many lines
are to be kept
      CONSOLE_HISTORY_RAM_HISTORY_SIZE this value means what
      CONSOLE_HISTORY_SIZE used to mean before log-backed history was added

          CONSOLE_HISTORY: ram
          CONSOLE_HISTORY_RAM_HISTORY_SIZE: 16

    For history stored in flash there are two options:
      - history kept in existing log, to use this the following lines are
needed (reboot_log is
        used as an example only).

          CONSOLE_HISTORY: log
          CONSOLE_HISTORY_LOG_NAME: '"reboot_log"'

      - history kept in dedicated flash area syscfg value

          CONSOLE_HISTORY: log

        following changes need to be in bsp.yml
             FLASH_AREA_CONSOLE_HISTORY: # This name is important
                  user_id: 10
                  device: 0
                  offset: 0x000E0000 # example only should be valid value
for given BSP
                  size: 8kB

* CONSOLE_HISTORY_AUTO_SEARCH activates history search when user types
  command. To activate:

      CONSOLE_HISTORY_AUTO_SEARCH: 1

Finally syscfg value CONSOLE_HISTORY_SIZE was marked as defunct and should
be removed from targets. Keeping it would make configuration values names
inconsistent. Description shown during build clearly states what needs to
be done
if it is used in existing target.

best regards
Jerzy