-
Notifications
You must be signed in to change notification settings - Fork 0
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add emulated serial port #16
base: main
Are you sure you want to change the base?
Conversation
Comment "en passant": may be a good idea to use, if I recall their names, a "named pipe" instead of TCP socket. In this way the serial port is actually mapped to a file and can be accessed like a real serial port, avoiding socat. |
if (ret == 0) // timeout | ||
return; | ||
|
||
connfd = accept(sockfd, NULL, NULL); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
IIUC you never check for return value
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This module implements the CEDAModule
interface (see src/module.h
), which means that this function is polled in the main loop, so the check is performed during next loop iteration, and (if I did not get something wrong) nothing will break.
Anyhow, I'm always printing the "accept client" message, which may actually be wrong. Fixed.
@@ -293,14 +293,12 @@ uint8_t sio2_in(ceda_ioaddr_t address) { | |||
#endif | |||
|
|||
if (address == SIO2_CHA_DATA_REG) { | |||
// TODO(giomba): read external RS232 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: why not squashing this commit in the previous one?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I kept two different commits because the first one (Implement TX-ready channel flag in SIO/2) actually implements a new feature, which can be kept in its independent commit, while this one (Remove TODO comments for virtual serial port emulation) is more like a "chore" commit where I just remove some outdated comments (some of which are related to the implementation in the previous commit, but others aren't, like the ones referring to the keyboard).
I tought about using a pipe, but decided to go with the TCP solution, because I've already seen and used it on other emulators (eg. Vice for the Commodore machines).
You can open a follow-up issue. |
0906053
to
e7426aa
Compare
e7426aa
to
c8b1f44
Compare
Desciption
This pull request implements an emulated serial port which you can use to communicate with the emulated software. Serial port is emulated as a TCP socket.
Review by commit is possible, but full-review is okay too.
Usage
serial open
in the emulator's command line (with an optional port number): the emulator will start listening for an incoming connection at the specified port (or 52955 (0xCEDB) in case no port is given)socat
to emulate a serial port which can be used by serial port libraries, and connect it to the TCP socket, for example:socat -v -d -d pty TCP4:127.0.0.1:52955
(the-d -d
option is used to show which virtual/dev/pts
is created)/dev/pts/x
using your favorite application/serial terminal emulator/kermit client/whatever