Hi!
I'm trying to create a simple remote management program where a user can connect to my little device and "take over" the current stdio of the system. For example:
System boots with console=serial port --> client connects, redirect input/output to the socket
I have already accomplished the redirection to network part (by reading through a lot of man pages. Man, I have never appreciated these man pages until now! :D) using the pty functionalities of Linux.
openpty() -> grantpt() -> unlockpt() --> client connects, perform login_tty()
My program then handles the monitoring of the master FD and the socket. However, I have a big problem: I don't know how to redirect the output back. I tried the following:
o hardcode opening the serial port file
o use the opened serial port file in login_tty()
but it doesn't seem to work (something about process groups and being the leader of the process group after performing the first login_tty()). Any suggestions or ideas?
Does login_tty() have an "inverse" function of some sort?
I would appreciate any help I could get.
Thanks!
Ty