erc@pai.UUCP (Eric Johnson) (12/19/89)
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@pai.mn.org - or - bungia!pai!erc (We have a very dumb mailer, so please send a bang-!-style return address.)
tron1@tronsbox.UUCP (HIM) (12/23/89)
>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. I will post this BOTH in email and on the net to be sure you get it. The interactive system >I< run (2.0.2 W/X.5 ASY FIX) did NOT come so configured, the easy way to change this is : in the file "/etc/conf/sdevice.d/asy you will see the following .. asy Y 1 7 1 4 3f8 3ff 0 0 asy N 1 7 1 3 2f8 2ff 0 0 You will notice that COM2: is disabled. Edit that file so that it reads... asy Y 1 7 1 4 3f8 3ff 0 0 asy Y 1 7 1 3 2f8 2ff 0 0 And do a rebuild from kconfig. There are probably better ways to check it , but I think this is a good way to fix it. BTW: If you DONT have the ASY FIX X.5 and the 2.0.2 set , umm, GET EM) **************************************************************************** "Perfume and leather baby , you and me together baby, what good is living in paradise, if you don't let yourself once or twice." -Tiffany Kenneth J. Jamieson ---- THE BOSS at Xanadu Enterprises Inc. UUCP: tron1@tronsbox.UUCP BEST PATH ---> uunet!tronsbox!tron1 Sysop, The Penthouse ]I[ BBS - (201)759-8450 / (201)759-8568 ****************************************************************************