From: rossi@mtu.edu (Rossi)
Newsgroups: comp.sys.sequent
Subject: Direct Connected Device Questions
Summary: Help with serial port
Date: 13 Nov 92 18:49:21 GMT
Organization: Michigan Technological University

Hi There!

Help!

Summry:

   System - Sequent S2000/700 running Dynix/Ptx V1.3

   Problem: It's not a: terminal, modem or printer and it's not a 
            direct connection to another Unix system.  It's a 
            nightmare!  (not really it's kinda fun actually) 
            Or I'm just missing something obvious (most likely).
            Also I'm not a certified Unix guru, just trying to
            learn about this stuff and having fun at the same
            time.  :-)


Details:

   I need to connect this device to a serial port.  I currently have
a null modem cable from the device (a scanner) to the port on the
S2000.  It is currently connected through an A/B switch (verified 
working on A - the connection to our mainframe).  I need to read 
each character without any interference or translation.


My current approach:

   What I would like to do is communicate with this device by sending
characters to the device (as in cat file > /dev/ttyGA/GAAI) instead
of writing a C program (which I know).  Is this possible using stty
to set the port and then writing and reading from it?  I'd probably
be using csh so I'd have to also set it's stdin to the same parameters
via stty.  The major question with this is the character translation
from 7 to 8 bits (or doesn't it matter?).  The characters read from
the device are either status messages or data, all straight 7 bit 
ascii.  Any data characters get stuffed into a file.  How does all
this sound?  Do you see any pitfalls with this approach? (other than
the 7 to 8 bit stuff).


Other things I've looked at:

   cu - Doesn't look like it will handle the 7 bit stuff otherwise
        this was my favorite option. 

   getty - I don't want a login process.  The scanner can't send a 
           response to this stuff.  Plus getty doesn't look like it
           can be configured to match the communications parameters
           of the device.

   uucp - Nope.  Doesn't seem to be appropriate.  Nor uugetty for that
          matter.

   kermit - Don't have it.  Not sure it'd help.

   C - Don't want to do in case someone else around here needs to
       mess with it.  (Not many C programmers in this place.  
       I'm not into job security through obscurity. :)

   Device driver - as in write your own.


Observations:

   No books or manuals I've read (about a half dozn so far) really 
give a good example of stty being used this way.  Some have shown
it being used for a printer (where I got the stty params < dev idea
from).  Maybe I'm using the wrong tool for the right job!?  Also
none of these books talk very much about devices other than
printers, modems (rarely without tangling it with uucp stuff), 
terminals, disks, etc. when all I really want is a simple character
at a time I/O to(and from) a very dumb device.  Suggest any general 
references that will help me out here!  The more complete and gory
the better.  Most references so far seem to dance (dances with
surreal ports!) around this subject.


General:

I'm in group grader.


Device Communication Specs:

  Even parity
  2 stop bits
  character length 7 bits
  baud rate 2400
  half duplex


Device name and permissions:

  /dev/ttyGA/GAAI

  ls -l /dev/ttyGA/GAAI

  crw-rw----   1 root      grader    6,   8  Nov 9 13:28 /dev/ttyGA/GAAI


Inittab entry:

  GAAI:234:off:/etc/getty ttyGA/GAAI 2400 vt100 # grader

I understand that this is just a documentation line to keep someone else
from accidentally using this port so getty is not really active (the off
action).  I hope my understanding is correct.


Set it by:

  stty (control modes) (input modes) (output modes) < /dev/ttyGA/GAAI


Other Questions:

   Do I need to own the device in order to change it via stty?  (I think
so, but not sure.)


stty stuff:  (everything but the kitchen sink)

 control modes  (I don't understand stty well you know any good
                 references other than man pages?  Is a control
                 mode parameter sufficient if you want it on 
                 both input and output modes or do I need to
                 put the parameters there too?)

  parenb
  -parodd
  cs7
  2400
  cstopb


 input modes

  -ignbrk
  brkint
  ignpar
  -parmrk
  inpck
  istrip
  -inlcr
  igncr
  -icrnl 
  -iuclc
  -ixon


 output modes

  -opost (Or do I need to specify all of the other parameters?)


 local modes  (What are these?)
 control assignments  (What are these?)

 screen size assignments  (Ignore?)


 combination modes (Hmmmm)

  evenp
  raw  (looks like sushi to me :)
 


What else now that I've written a book?  Maybe a movie...  Revenge of
the Dynixors?  Well any input will be appreciated  (even a quick get
lost is nice when your mailbox is empty at times.  heh)  Thanks much
and be careful.


Steve

         Stephan Rossi               Michigan Technological University
Internet Address: rossi@mtu.edu   (906) 487-2223     Fax: (906) 487-2787
Snail Mail: MTU, Admin Bldg 210, 1400 Townsend Drive, Houghton, MI  49931
Newsgroups: comp.sys.sequent