Added /dev/ttyAMAn devices as possible serial port lines on *nix systems.

Fixed reset disconnect logic for serial lines
This commit is contained in:
Mark Pizzolato 2012-12-26 10:51:19 -08:00
parent 59871d90b8
commit af93ca96c3
2 changed files with 10 additions and 7 deletions

View file

@ -897,6 +897,15 @@ for (i=0; (ports < max) && (i < 64); ++i) {
close (port);
}
}
for (i=0; (ports < max) && (i < 64); ++i) {
sprintf (list[ports].name, "/dev/ttyAMA%d", i);
port = open (list[ports].name, O_RDWR | O_NOCTTY | O_NONBLOCK); /* open the port */
if (port != -1) { /* open OK? */
if (isatty (port)) /* is device a TTY? */
++ports;
close (port);
}
}
for (i=1; (ports < max) && (i < 64); ++i) {
sprintf (list[ports].name, "/dev/tty.serial%d", i);
port = open (list[ports].name, O_RDWR | O_NOCTTY | O_NONBLOCK); /* open the port */

View file

@ -901,14 +901,8 @@ if ((lp->destination) && (!lp->serport)) {
if (lp->connecting)
sim_close_sock (lp->connecting, 0);
lp->connecting = sim_connect_sock (lp->destination, "localhost", NULL);
lp->ipad = malloc (1 + strlen (lp->destination));
strcpy (lp->ipad, lp->destination);
lp->cnms = sim_os_msec ();
}
else {
tmxr_init_line (lp); /* initialize line state */
}
lp->conn = FALSE; /* remove connection flag */
tmxr_init_line (lp); /* initialize line state */
/* Revise the unit's connect string to reflect the current attachments */
lp->mp->uptr->filename = _mux_attach_string (lp->mp->uptr->filename, lp->mp);
/* No connections or listeners exist, then we're equivalent to being fully detached. We should reflect that */