Request for Help on Interactive COM2: access
Eric Johnson
erc at pai.UUCP
Tue Dec 19 03:40:21 AEST 1989
I'm having some problems accessing the second serial port
under Interactive UNIX. I have a no-name 386 clone with
two serial ports clearly marked on the back. I`m running
Interactive's 386/ix release 2.0 (release notes Dec 88).
COM1: works fine (I have a MS serial mouse clone hooked up to
it and the mouse works fine with the X Window System).
There are no getty's running on any serial ports (at least
that's what /etc/inittab says).
What I want to do is access the second serial port through a C
program, for my own serial I/O. Since the first port is used by the
mouse, I need to use the second port.
Interactive's documentation seems to say that the asy driver comes
pre-installed and that it handles both COM1: and COM2:. None of the
kconfig/sysadm menus seem to want to give me any information
regarding the serial ports.
When I try to open the port with a simple C program (source below),
I get error #6 (ENXIO in sys/errno.h):
No such device or address.
The code looks like:
______________________________________________________________
/*
** foo.c
** Test program to open a port.
**
** E F Johnson
**
*/
#include <stdio.h>
#include <fcntl.h>
#include <termio.h>
#include <errno.h>
extern int errno;
#define BUFSIZE 256
#define MY_PORT "/dev/tty01"
main( argc, argv )
int argc;
char *argv[];
{
int port, i;
char error_message[ BUFSIZE + 1 ];
char dev_file[ BUFSIZE + 1 ];
/*
** Check for -dev devicefile on command line
*/
strcpy( dev_file, MY_PORT );
i = 1;
while( i < argc )
{
if ( strcmp( "-dev", argv[ i ] ) == 0 )
{
i++;
if ( i < argc )
{
strcpy( dev_file, argv[ i ] );
}
}
i++;
}
port = open( dev_file, O_RDWR + O_NDELAY );
if ( port == (-1) )
{
sprintf( error_message, "ERROR %d: Could not open %s.",
errno, dev_file );
perror( error_message );
}
else
{
close( port );
printf( "Port %s opened successfully\n", dev_file );
}
exit( 0 );
}
/*
** end of file.
*/
______________________________________________________________
Am I doing anything wrong in the software? This same program
opens /dev/tty00 (COM1:) just fine.
Should I tear open the machine and check the hardware switch settings?
Perhaps this indicates that the COM2: is not set up properly
in hardware?
The documentation seems to indicate that the device file mapping is:
COM1: /dev/tty00
COM2: /dev/tty01
Is this correct?
Is there anywhere else I should check? (Section 11.10 Adding a New Terminal
in the 386/ix Operating System Guide doesn't really seem to help.)
Does anyone have any ideas? Any help would be appreciated.
Thanks,
-Eric
--
Eric F. Johnson, Boulware Technologies, Inc.
415 W. Travelers Trail, Burnsville, MN 55337 USA. Phone: +1 612-894-0313.
erc at pai.mn.org - or - bungia!pai!erc
(We have a very dumb mailer, so please send a bang-!-style return address.)
More information about the Comp.unix.i386
mailing list