From 7756cb8cd4df2be180513e28b0f55153fedc46ec Mon Sep 17 00:00:00 2001 From: Mark Pizzolato Date: Mon, 18 Mar 2013 05:53:39 -0700 Subject: [PATCH] Added HP-UX Serial port detection (for SHOW SERIAL) from Mikulas Patocka --- sim_serial.c | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/sim_serial.c b/sim_serial.c index b291f627..58c66aa5 100644 --- a/sim_serial.c +++ b/sim_serial.c @@ -859,7 +859,7 @@ return; -#elif defined (__unix__) || defined(__APPLE__) +#elif defined (__unix__) || defined(__APPLE__) || defined(__hpux) #if defined(__linux) || defined(__linux__) #include @@ -921,7 +921,17 @@ if (1) { } free (namelist); } -#else /* Non Linux, just try some well known device names */ +#elif defined(__hpux) +for (i=0; (ports < max) && (i < 64); ++i) { + sprintf (list[ports].name, "/dev/tty%dp%d", i/8, i%8); + 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); + } + } +#else /* Non Linux/HP-UX, just try some well known device names */ for (i=0; (ports < max) && (i < 64); ++i) { sprintf (list[ports].name, "/dev/ttyS%d", i); port = open (list[ports].name, O_RDWR | O_NOCTTY | O_NONBLOCK); /* open the port */