Enable programmatic termination of shell Topic is solved

Use this forum for requesting small changes in ChibiOS. Large changes should be discussed in the development forum. This forum is NOT for support.
User avatar
FXCoder
Posts: 88
Joined: Sun Jun 12, 2016 4:10 am
Location: Sydney, Australia
Has thanked: 19 times
Been thanked: 19 times

Enable programmatic termination of shell  Topic is solved

Postby FXCoder » Thu Apr 19, 2018 2:11 pm

Small change to enable a software shell terminate request to be issued.
I've implemented this change to shell.c for an SDU use case where status output is directed to SDU.
Output to SDU is paused when a shell session is requested (by hitting a key on terminal).
After shell commands, etc. are finished the shell is normally terminated by 'exit' or ^D by the user.
However, when an SDU disconnect event happens due to USB SUSPEND then the shell can be programmatically terminated.

Code: Select all

Index: shell.c
===================================================================
--- shell.c   (revision 11940)
+++ shell.c   (working copy)
@@ -354,7 +354,7 @@
 
   chprintf(chp, SHELL_NEWLINE_STR);
   chprintf(chp, "ChibiOS/RT Shell" SHELL_NEWLINE_STR);
-  while (true) {
+ while (!chThdShouldTerminateX()) {
     chprintf(chp, SHELL_PROMPT_STR);
     if (shellGetLine(scfg, line, sizeof(line), shp)) {
 #if (SHELL_CMD_EXIT_ENABLED == TRUE) && !defined(_CHIBIOS_NIL_)

User avatar
FXCoder
Posts: 88
Joined: Sun Jun 12, 2016 4:10 am
Location: Sydney, Australia
Has thanked: 19 times
Been thanked: 19 times

Re: Enable programmatic termination of shell

Postby FXCoder » Tue Jun 19, 2018 12:32 pm

Bump...

User avatar
Giovanni
Site Admin
Posts: 11025
Joined: Wed May 27, 2009 8:48 am
Location: Salerno, Italy
Has thanked: 354 times
Been thanked: 298 times
Contact:

Re: Enable programmatic termination of shell

Postby Giovanni » Sun Jul 08, 2018 6:58 am

Hi,

Added to trunk and 18.2.

Giovanni


Return to “Small Change Requests”

Who is online

Users browsing this forum: No registered users and 0 guests