Stdin via the VSC terminal

We are setting up the Torizon toolchain for an apalis board. We have setup the VSC environment and are using C++. Everything is up and running but we realize that the terminal in VSC is only an output terminal, which is also indicated by the name of it “Torizon - Application Container Output”. For debug purposes we would need to send data to stdin but we can’t figure out how to do this in the VSC environment.

We can start the container via portainer and open the terminal and run the program from there but I’m really hoping that there is a setting/method that allows us to use the terminal in VSC directly since that would enable us to debug the code while giving different inputs on the stdin. If that is not possible via VSC, is there other ways to hook up a stdin? Is there for example a way to open up a terminal for stdin/stdout while debugging in VSC? That would also solve our issue.

The team is still discussing this internally. For the time being probably the best workaround/alternative would be opening a ssh terminal from VSCode to the target device. Then using something like “docker attach”: docker attach | Docker Documentation

To interact with the container’s stdin.

Best Regards,
Jeremias

Thanks for the answer. The reason we think this would be handy is that we are communicating with an external device over SPI. We are developing code for the external device as well and we would like to test different inputs to that device over the SPI link and then debug both the answer and the code handling the answer. We would probably also soon like to measure on the physical SPI lines on a circuit board. Then we would like to stop the communication for a while, set up our oscilloscope triggering and then send a defined package. This would be very easy to do if we got control over the stdin.

Best Regards,
Jan-Peter

Greetings @janpeternrhim,

Presently I don’t believe we have a method to do this directly with the extension. What is possible now would be to ssh into the device via the devices pane of the extension. This would give you an SSH terminal into the device from VSCode. Then from there you could perform a “docker exec” on your application container, which would then give you terminal into the container itself. Though I understand this is quite a roundabout way to do this and not exactly straightforward.

By the way, if you don’t mind elaborating for me, what kind of data are you trying to send to stdin? Is your application going to be regularly receiving user input? Or is this data from another processes/application?

This is an interesting question, let me bring this up with our IDE team and see if maybe we can make this experience better in the future. Thank you for this feedback.

Best Regards,
Jeremias