-- Real device --
Let's say I an UART cable on /dev/ttyACM0 (and there is another computer connected to the other end of the cable), how can I start a bash session on that /dev/ttyACM0 device? So my other computer would be able to execute bash commands?
-- Pseudo terminal --
Another example, let's say I opened cutecom or minicom in device /dev/ptmx, it will create a corresponding /dev/pts/X device. How can I start a bash session to run on the created /dev/pts/X?
If I understand correct, it doesn't matter to bash (or getty) if it is running on a real or pseudo terminal. So I think that GUI terminals (like xterm) read /dev/ptmx and start a bash on the corresponding /dev/pts/X, if this is true, then I should be able to do the same, how can I accomplish that? Or is my understanding of it wrong?
fork()
a child process. Open the serial device or pseudotty and dup2()
it to fd's 0, 1 and 2. execv()
your preferred shell.