Support for posix signals over uart using console component

mbutura
Posts: 10
Joined: Tue Jan 02, 2018 3:38 pm

Support for posix signals over uart using console component

Postby mbutura » Fri Feb 23, 2018 7:05 am

I have the situation at hand whereby I have a battery of runtime tests that test say:
1. Communication
2. I/O among others.

Some of the tests need to be run for a long time thus it would be good if posix signals were supported in the console component to end a test at user's will. Example ctrl-c (C-c) to exit cleanly and go back to the console menu. I believe this would be possible as the monitor program implements its own set of signals i.e: (ctrl-]) while the standard signals are unused which would make it a likely candidate.

Are my thoughts far fetched? How would I go about implementing the above and would it break anything.

I wouldn't mind making modification and pull request on the code-base for this if needed.

User avatar
kolban
Posts: 1683
Joined: Mon Nov 16, 2015 4:43 pm
Location: Texas, USA

Re: Support for posix signals over uart using console component

Postby kolban » Sat Feb 24, 2018 3:09 pm

I think you are going to have to describe the nature of the tests. For example, you don't say whether the tests are running exclusively on the ESP32 that is serial port connected or on a PC that is connected to the ESP32. Where is the application running that you wish to be cognizant of the interrupt instructions?
Free book on ESP32 available here: https://leanpub.com/kolban-ESP32

mbutura
Posts: 10
Joined: Tue Jan 02, 2018 3:38 pm

Re: Support for posix signals over uart using console component

Postby mbutura » Sat Feb 24, 2018 4:23 pm

Here is a recorded terminal session: https://asciinema.org/a/1sNPQn8cf3f3XRStNkNUJShZt

In brief the ESP32 is connected over serial to my computer. I send initial configurations to as an SPIFFS filesystem on my computer. The reads the configurations and esp32 writes the results of the tests chosen over console either in json or protobuf binary format to an SPIFFS filesystem on flash. I then readback the results as a SPIFFS image fromthe esp32 and unpack it on my computer for analysis.

Sometimes I would need or like to run one test after another without quiting monitor or restarting in order to analyse haphazard events.

User avatar
kolban
Posts: 1683
Joined: Mon Nov 16, 2015 4:43 pm
Location: Texas, USA

Re: Support for posix signals over uart using console component

Postby kolban » Sat Feb 24, 2018 6:54 pm

If I'm understanding correctly, you have an ESP32 serial connected to a PC and the ESP32 is running tests directed from the PC by user entry. What you want to be able to do is have a human "signal" that you wish to interrupt the test?

I am also suspecting that there is a user written application running on the ESP32 that is receiving and processing the requests received over serial. I am then suspecting that when a command is entered, the ESP32 parses the request to run the command and then goes and executes it before examining the serial input a second time. If that is the case, it feels like you have two choices.

Your testing logic can poll the serial input while it is running and look for an interrupt character code / sequence or else you can setup an interrupt handler that asynchronously (to your running test) is fired when a character code / sequence is received over serial. In either case, I would suspect that you would set a flag and your test would examine that flag and, if set, quit early.
Free book on ESP32 available here: https://leanpub.com/kolban-ESP32

mbutura
Posts: 10
Joined: Tue Jan 02, 2018 3:38 pm

Re: Support for posix signals over uart using console component

Postby mbutura » Wed Feb 28, 2018 10:20 am

kolban wrote:If I'm understanding correctly, you have an ESP32 serial connected to a PC and the ESP32 is running tests directed from the PC by user entry. What you want to be able to do is have a human "signal" that you wish to interrupt the test?

I am also suspecting that there is a user written application running on the ESP32 that is receiving and processing the requests received over serial. I am then suspecting that when a command is entered, the ESP32 parses the request to run the command and then goes and executes it before examining the serial input a second time. If that is the case, it feels like you have two choices.

Your testing logic can poll the serial input while it is running and look for an interrupt character code / sequence or else you can setup an interrupt handler that asynchronously (to your running test) is fired when a character code / sequence is received over serial. In either case, I would suspect that you would set a flag and your test would examine that flag and, if set, quit early.
Thanks for this.I have decided to implement this as a separate task to the main code that polls the serial line for the character of interest and sets an event-group bit, which signals the end of the main task cleanly and finally deletion.

Who is online

Users browsing this forum: Baidu [Spider], usulrasolas and 23 guests