Hello

I have created a Pseudo Terminal slave port (and master) and I am listening to this slave port in my program. Is it possible to use Picocom to enter data on this slave port stream?


I have attempted to connect using the following Picocom command:

picocom -b 9600 /dev/SLAVE_PORT_NAME
I can connect successfully but typing in data into the terminal doesn't result in my process receiving and data. Is my problem with my picocom 'write' end or with my receive end?


My code to create the Pseudo Terminal:


Code:
    int main()    {
        cout << "Hello world!" << endl;
    
        int fdm, fds;
        int res = openpty(&fdm, &fds, NULL, NULL, NULL);
        if (res < 0) {
            cout << "Failed to open\n";
            exit(1);
        }
    
        char sym_cmd[100];
        sprintf(sym_cmd, "sudo ln -s -F %s %s", ptsname(fdm), "/dev/gps0");
        system(sym_cmd); // Create symbolic link
    
        for (;;) {
            fd_set input;
            //struct timeval timeout;
            FD_ZERO(&input);
            FD_SET(fds, &input);
            //timeout.tv_sec = 10 // 10 secs
            //timeout.tv_usec = 0;
    
            int res;
            for (;;) {
                res = select(fds+1, &input, NULL, NULL, NULL);
    
                if (res == -1) {
                    cerr << "Error: " << endl;
                    break;
                }
                /*else if (res == 0) {
                    printf("No messages during period");
                }*/
                else  {
                    if (FD_ISSET(fds, &input)) {
                        char input[100];
                        int chars_read = read(fds, input, 99);
                        cout << "Msg: " << input << endl;
                    }
                }
            } /* forever */
        }
    
        return 0;
    }