A From:	SMTP%"RELAY-INFO-VAX@CRVAX.SRI.COM" 29-JUL-1993 12:02:50.20  To:	EVERHART CC:	4 Subj:	Re: HELP: $QIO, IO$_SENSEMODE, V24, Frame Size  ( From: steve@dbaccess.com (Steve Suttles) X-Newsgroups: comp.os.vms 7 Subject: Re: HELP: $QIO, IO$_SENSEMODE, V24, Frame Size $ Message-ID: <251@mccoy.dbaccess.com> Date: 28 Jul 93 22:27:08 GMT1 Organization: Cross Access Corp., Santa Clara, CA 
 Lines: 104# X-Newsreader: TIN [version 1.1 PL8]  To: Info-VAX@KL.SRI.COM  X-Gateway-Source-Info: USENET   ? Out of the mind of Andy Settle (Journeyman@spliff.demon.co.uk):  > I'm looking for help....  I > I'm currently writing a util to monitor our system's V24 modem ports on E > the VAX; it shows send and receive speeds, CTS, DTR, DSR etc... The > > program is written in C and has not caused *too* much grief.  B > Except that i can't seem to figure out how to get the following:  , >         - Port Frame size (e.g 7 or 8 bit)( >         - Parity (e.g Odd, Even, None)  K > I've got a little way on the frame size setting but i'm not sure i've got G > all angles covered; I've read I/O Ref' manual Terminal driver section G > numerous times now (and even Device Support in desparation!), and can D > even see the tt$v_altframe fields in TTDEF.H but how do i read it?   > TIA.  ! No flames, please.  This is fact.   K Some time ago (VMS V3), I wrote a program that needed the same information. F I needed to modify the settings and then set them back.  At that time, there E were different device drivers for each type of terminal interface.  I C submitted quite a few SPRs about the fact that the drivers returned E results in these fields that were not suitable for use to IO$SETMODE, > as was documented.  Various changes resulted; new drivers, new" documentation, new correspondents.  C The SPR process could take as much as 6 months back then, and often E resulted in a response of "We will address [not necessarily fix] this D in a future major release [not necessarily the next one, or even theE next major one]".  Since I was not willing to wait on this project, I B continued to look for workarounds.  I did some exhaustive analysisA (tried all the settings, see what SENSEMODE returned) and found a B one-to-one bit mapping that worked.  I wrote code to rearrange the bits, and I was happy.  C UNTIL, we hooked up another modem, this time to a different type of D board.  Having done it before, I had all the tools handy, and it wasC quick work to remap the bits.  Since the device type was different, < I could tell which algorithm to use.  I was happy once more.  G UNTIL, the third modem was plugged in.  I got pretty good at eyeballing G the results of my analysis program, and writing code on the fly.  I got $ to thinking pretty highly of myself.  E UNTIL, the next release of VMS showed up with all new drivers, all of E which mapped differently.  A couple of days work, and our modems were B all back on line.  I even wrote a utility to do the eyeballing--itC printed out a before mask and after mask for each bit.  I figured I " could make it rain if I wanted to.  A UNTIL, the next release of VMS showed up, with "class" and "port" E drivers.  I could no longer distinguish easily what kind of interface E it was on.  And we traded in our boards a few times, and moved modems 1 to boards that they weren't on before, and so on.   D So I built the analysis into the application, and stopped submittingA SPRs.  As of around VMS V5.2, the following was still the "right"  answer: ' 	1) Do a sense mode.  Save the results. 9 	2) Cycle through all the possibilities, saving both what ) 		you used to set it and what was sensed. < 	3) Find your saved results in your chart.  Use the set that# 		generated that particular nugget. C I put checks in to ensure that the bits were mapped one-to-one, but G they -never- went off.  There are some extra bits in the sense that are D either always one or always zero, but they are unrelated to the set.  F Once I made this change, I didn't have to touch it again.  It survivedF several updates to VMS, and as far as I know, they are still using theF utility.  On certain hardware interfaces, with RS-232 equipment on theG far end that distinguishes it, the testing cycle generates some framing D errors--why, I don't know; it should not if the line was idle (which? was part of the context of our situation).  However, since that 2 bothered only me, I promptly learned to ignore it.  D I can't ship you the source code, and it's in MACRO anyways, and youE wouldn't like it (but Dave, if you're lurking and also inclined to do = so, you may inflict the source on this man with my blessing).     D So the simple answer is: You can't get there from here.  You alreadyD have the complex answer that justifies this.  All that's left is theC theory behind the bug:  Nobody tested it.  These bits (specified in @ the set) have to be passed to hardware-dependent code which mustF shuffle them until they line up with the registers.  That gets tested.C The sense function should be the inverse, but it is consistent that F the bits "forget" to be shuffled or get shuffled improperly.  Since itG occurred in all hardware drivers (before separation) and all port/class C combinations (after separation) I suspect it is a flaw in the first F driver that got cloned when the second was derived, etc, etc, and whenB the port/class split occurred, was taken as gospel and left alone.G The shuffling properly belongs in the port driver, but I suspect it was B put into the class driver, and only works right for one particular interface...which we never had.    --  N Steve Suttles                Internet:  steve@dbaccess.com      Dr. DCL is IN!N CROSS ACCESS Corporation     UUCP: {uunet,sgiblab}!troi!steve  Yo speako TECO!N 2900 Gordon Ave, Suite 100   fax: (408) 735-0328              Talk data to me!N Santa Clara, CA 95051-0718   vox: (408) 735-7545   HA! It's under 4 lines NOW!  