home *** CD-ROM | disk | FTP | other *** search
- Path: sparky!uunet!beartrk!ceilidh!hijo-2!dnichols
- From: dnichols@ceilidh.beartrack.com (Don Nichols (DoN.))
- Newsgroups: comp.sys.3b1
- Subject: Re: Raw mode on a 3b1, for Wizard link
- Message-ID: <1992Jul23.002728.5926@ceilidh.beartrack.com>
- Date: 23 Jul 92 00:27:28 GMT
- References: <1992Jul22.014605.15570@alw.nih.gov>
- Organization: D and D Data, Vienna Virginia
- Lines: 122
-
- In article <1992Jul22.014605.15570@alw.nih.gov> crtb@helix.nih.gov (Chuck Bacon) writes:
- >I've been diddling with the Sharp Wizard code, courtesy of Virgin
- >Software, J. Bruce Dawson and Steve Putz, which has been recently
- >circulating. Reference was made to Sharp documentation describing
- >the communication protocol between the Organizer and anybody's
- >RS232.
- >
- >I've written a perl script which talks to the Organizer on tty000.
- >So far it can request the overall directory, cause the Organizer to
- >exit the PC-link state (to reduce battery drain), and turn the
- >Organizer off completely. But nothing else.
- >
- >Does anybody have the Sharp protocols? The code I have, oz.c, was
- >apparently written for an earlier model, and my OZ-8000 doesn't
- >respond to the Send or Receive commands. Any help?
- >
- >Does anybody know how to invoke raw mode on /dev/tty000 on a 3b1?
- >I managed to do an ioctl() on it which gets it into a pretty decent
- >mode, but I'd be happier with raw mode, especially if I can get a
- >timeout, rather than having the program hang. I can't find any
- >mention of raw mode in any of the 3.51 documentation.
-
- RAW mode was a simple all-or-nothing thing. The termio interface
- gives finer control, but makes simple things like the selection of RAW mode
- more difficult. First off, you have separate control of processing on input
- vs output. There's also an array of characters used to define which
- character invokes which kind of special funcitons. Look in section 7 of the
- manual, under termio, to find more detail than you'll ever want, except how
- to do it simply. :-)
-
- Ioctl() gets you a structure with several fields, including two
- important ones for our purpose: c_iflag, and c_oflag, both unsigned 16-bit
- entities. Each bit of c_iflag has a meaning to turn on some processing of input
- characters (and coditions), as specified below, from <sys/termio.h>. To get
- RAW input, you need to clear all bits in c_iflag.
-
- /* input modes */
- #define IGNBRK 0000001
- #define BRKINT 0000002
- #define IGNPAR 0000004
- #define PARMRK 0000010
- #define INPCK 0000020
- #define ISTRIP 0000040
- #define INLCR 0000100
- #define IGNCR 0000200
- #define ICRNL 0000400
- #define IUCLC 0001000
- #define IXON 0002000
- #define IXANY 0004000
- #define IXOFF 0010000
-
- For output, the selections are made with c_oflag. To get raw output
- processing, all you have to do is clear the OPOST bit in c_oflag. If you
- want some of the output functions, such as translation of LF to CR-LF,
- you'll have to set and clear individual bits to produce the behavior you
- want. Most of the bits are used for specifying various delays, none of
- which should be needed for any reasonably intelligent terminal with adequate
- input buffer and handshaking, but which are needed if you have a
- simple-minded hardcopy terminal like an ASR-33 TeleType. Other bits serve
- to map lower case to upper, and add in the CR to the LF. The relevant
- section of <sys/termio.h> follows.
-
- /* output modes */
- #define OPOST 0000001
- #define OLCUC 0000002
- #define ONLCR 0000004
- #define OCRNL 0000010
- #define ONOCR 0000020
- #define ONLRET 0000040
- #define OFILL 0000100
- #define OFDEL 0000200
- #define NLDLY 0000400
- #define NL0 0
- #define NL1 0000400
- #define CRDLY 0003000
- #define CR0 0
- #define CR1 0001000
- #define CR2 0002000
- #define CR3 0003000
- #define TABDLY 0014000
- #define TAB0 0
- #define TAB1 0004000
- #define TAB2 0010000
- #define TAB3 0014000
- #define BSDLY 0020000
- #define BS0 0
- #define BS1 0020000
- #define VTDLY 0040000
- #define VT0 0
- #define VT1 0040000
- #define FFDLY 0100000
- #define FF0 0
- #define FF1 0100000
-
- Another section of the structure selects the baud rate, and another
- one, i_lflag will enable a half-cooked version. It looks as though you may
- want it fully zeroed, as well, for fully RAW mode. Here's the relevant
- section of <sys/termio.h> for that. If you just clear ISIG, and ICANON,
- that might be enough, but it wouldn't hurt to zero the whole word here as
- well.
-
- /* line discipline 0 modes */
- #define ISIG 0000001
- #define ICANON 0000002
- #define XCASE 0000004
- #define ECHO 0000010
- #define ECHOE 0000020
- #define ECHOK 0000040
- #define ECHONL 0000100
- #define NOFLSH 0000200
-
- If you clear all these bits, you probably want to be on a line
- opened with open(2), rather than fopen(3), since many of the cues for proper
- opreation of fopen()ed files will not be present.
-
- Good Luck
- DoN.
- --
- Donald Nichols (DoN.) | Voice (Days): (703) 704-2280 (Eves): (703) 938-4564
- D&D Data | Email: <dnichols@ceilidh.beartrack.com>
- I said it - no one else | <dnichols@ceilidh.aes.com>
- --- Black Holes are where God is dividing by zero ---
-