Jetson TX2 Developer Board Turn off and Reboot Process

Hi!

I would like to send 2 commands to Jetson TX2 Developer Board which are ‘Turn off’ and ‘Reboot’ via serial port. I have a programme which was written C# form application for sending these two command. This programme runs on window OS base PC. I receive these 2 commands from Jetson TX2 Developer Board side over ttyTHS2 serial port in C programme. The question is how can i execute these commands in Jetson? I want to run “sudo reboot” and “sudo shutdown -r now” commands with software.

Just use “sudo”. The serial console login is as user “nvidia”, but “nvidia” must use “sudo” for those commands (it will ask for a password):

sudo shutdown -h now # shutdown
sudo shutdown -r now # reboot

There isn’t anything else. It is just as you have noted with sudo. Is there another side to the question which I am missing?

I do not want to use terminal or something else. I want to send these command with a software which was written with C programming language. How can i send these commands via serial port(ttyTHS2) to Jetson TX2 developer board?

That is what I am saying…the C way and the shutdown commands are the same thing when going over serial console:

# Open the serial port, e.g., "fopen". Set up port, e.g., ioctl calls.
fprintf(pointer_to_ths2, "sudo shutdown -h now\n");
# ...read and reply for password...

One must be logged in to issue such a command, and it assumes ttyTHS2 is a serial console. Is the UART in question not a console (normally ttyTHS2 is not, but can be configured for this)?