Using a /dev/tty as if it were a serial port
So, somewhat complex setup: I have written a bunch of code to talk to an external device that's connected with a USB-serial interface such as an FTDI adapter. I'm using QSerialPort to do all this. Works great. Now what I'd like to do is access this stuff remotely over a network. I've got a Linux single-board computer with serial ports. I've managed to figure out how to do this with socat. On my desktop machine, socat creates a pseudo terminal in the form of /dev/ttys001. I've tested this with a simple modem-style terminal program on the remote end and cat'ing the /dev/ttys001. So this part works.
Where I'm having trouble is that QSerialPort doesn't work with just any /dev entry. Even though I tried hacking the module to remove file name filtering, opening the port fails because configuration functions such as setting the baud rate or parity don't work.
So, the question is: How do you talk to a /dev/tty without completely throwing away all the QSerialPort code I've written? I don't really need flow control stuff but I do need waitForReadyRead and peek functionality.
In your case, wouldn't a QFile be enough ?
I did manage to figure out a workable solution. I run ser2net on the embedded computer which makes things like /dev/ttyUSB0 available as TCP ports on the network. That's only half the solution though. I had to modify my Qt code to use a QTcpSocket instead of QSerialPort. This works since ser2net takes care of the serial protocol and since I don't need flow control or DTR/CTS lines.
Kudos to the Qt designers for structuring the QIODevice system the way it is.
Tested two hardware devices now. So far, so good.
That was going to be my next suggestion :)
Since you have it working now, please update the thread title prepending [solved] so other forum users may know a solution has been found :)