serial port (tty1) problem with microport 2.2

serial port (tty1) problem with microport 2.2

Post by joh » Mon, 02 Jul 1990 16:37:00

A week or so ago I posted a request for help with connecting a mouse
on a Microport SysV system.  Several people sent mail asking how I
got it to work so I thought I would post the solution since it is
very short. Mice run at 1200 baud, no parity, 1 stop bit and one
packet of information is 5 bytes

 b dx1 dy1 dx2 dy2

where dx{n} and dy{n} are signed 8 bit numbers and b has the format

1 0 0 0 0 b1 b2 b3

and b{n} == 1 if the button is UP.

I don't claim the code below is great, it could easily be improved,
but it works.


/* sinmple mouse routines */
#include        <fcntl.h>
#include        <stdio.h>
#include        <termio.h>

static int mfd;


struct termio t;
int i;

mfd = open("/dev/tty1",O_RDONLY);
if (mfd < 1) fprintf(stderr," couldn't open mouse \n");

i=ioctl(mfd,TCGETA, &t);
if (i < 0 ) fprintf(stderr,"ioctl error\n");
t.c_cflag = B1200 | CS8 | CLOCAL | CREAD ;
t.c_lflag = 0;

i=ioctl(mfd,TCSETA, &t);
if (i < 0 ) fprintf(stderr,"ioctl error\n");


/* wait for mouse to send something then return change in x, y and the
   status of the buttons with bn==1 if the button is down
MouseRead(dx, dy, b1, b2, b3)

int     *dx, *dy, *b1, *b2, *b3;

unsigned char   b;
char            bs[4];
int     j;

for (b=0; (b&0370) != 0200 ; ) read(mfd, &b, 1);
/* get here with button byte */
for (j=0; j<4; j++) read(mfd,&(bs[j]),1); /* get coords */

*b3 =  (~b)  & 1;
*b2 =  (~(b>>1)) & 1;
*b1 =  (~(b>>2)) & 1;

*dx = (int ) bs[0];
*dy = (int ) bs[1];
*dx = *dx + (int ) bs[2];
*dy = *dy + (int ) bs[3];



1. Serial Port problems with microPort System V/286 2.2U

Apologies to microport, because we have sent them a fax already, but we
are in a rush for a fix.....

With Microport's Unix System V (release 2.2U) running on a genuine IBM PC
AT, select a free port on the com1 board and spawn a getty process on
it.  Connect a 9600 baud terminal to the  port.  "cat" a large file to
the port.  Output to the terminal will hang after a random amount of
data has been transmitted.  This phenomena can also be observed when
scrolling through a file using vi.  Tping any character causes output to

Is anyone else having this same problem?  And, more importantly, does
anyone  have a fix??  We have the linkkit.  

Please respond using EMail or Call collect
(613) 725-5411

Thanks in advance.
Greg Franks     (613) 725-5411          "Vermont ain't flat"
(Other paths will undoubtably work too - your mileage will vary)

2. Determing wether lib is elf or a.out

3. serial port (tty1) problem with microport2.2

4. a few questions

5. serial ports in Microport (really tape drives)

6. Problem opening connections

7. classic, solaris 2.2, use serial port as console?

8. DPT SCSI Controller drivers ... ????

9. Linux 2.2.x and serial ports

10. Linux kernel 2.2.x and serial port

11. Solaris 2.2/2.3 serial port performance + Patch Status

12. Which Multi-port serial for Linux 2.2?

13. 2.2.x serial problem (overruns, dropped chars) on 486