Changeset 13 for rxprtutl/trunk/notes


Ignore:
Timestamp:
May 2, 2013, 3:35:06 PM (12 years ago)
Author:
Alex Taylor
Message:

Added RPUPortQuery function, improved discussion of port driver settings in 'notes'.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • rxprtutl/trunk/notes

    r3 r13  
    1 USING RPUPortSet
     1Using RPUPortQuery & RPUPortSet
     2===============================
     3
     4These functions return or accept a buffer (passed as a REXX string) which
     5contains the current port configuration data as raw bytes.  The format of
     6this data depends on the port driver which controls the particular port
     7being queried or set.
     8
     9The data formats for several common port drivers are described below.
     10
     11NOTE: All data must be in raw byte (or 'character') form.  This is the form
     12      outputted by functions like D2C() or X2C().
     13
     14      In addition, multi-byte integer values like (U)LONG and (U)SHORT must
     15      be passed in little-endian order.
     16
     17      i.e.
     18      To convert <number> to USHORT:  ushort = REVERSE( X2C( D2X( number, 4 )))
     19      To convert <number> to ULONG:   ulong  = REVERSE( X2C( D2X( number, 8 )))
     20
     21
     22SERIAL.PDR, PARALLEL.PDR
     23------------------------
    224
    325The standard serial and parallel port drivers do not support the SplPdSet API.
    426
    5 The PAR1284 port driver takes a data structure with the following format:
    627
     28PAR1284.PDR
     29-----------
     30
     31The high-speed BIDI parallel port (PAR1284) driver uses a data structure with
     32the following format (information taken from IBM DDK headers):
     33
     34typedef struct _PORTSETTINGS{
    735   ULONG   signature;           /* Must be 0x52464E49 ('INFR')               */
    836   ULONG   ulVersion;           /* Must be 0x00000001                        */
     
    74102   ULONG   ulpszDeviceID;       /* -> 1284 deviceID for printer on port  */
    75103} PORTSETTINGS, *PPORTSETTINGS;
    76 #define PAR12_SIGNATURE
    77104
     105/* Structure for setting timeouts                                        */
     106/*                                                                       */
     107/* This port driver will assume that bidi capable printers can accept    */
     108/* data at a reasonable rate, so the WriteIdle timeout will default to a */
     109/* small value(like 15 seconds). The actual WriteTimeout specified by    */
     110/* the user can be larger, and our PdWrite API will handle retrying      */
     111/* requests that do not complete.  However, we will always have a        */
     112/* ParReadThread for each bidi port, and this read will typically be     */
     113/* queued up after the write. When a write completes(even if only        */
     114/* partial buffer was sent), the queued read request will reverse the    */
     115/* channel and check for data coming from the printer.  This read must   */
     116/* not take a long time(to avoid performance degradation for writes).    */
     117/*                                                                       */
     118/* We set a small ReadInterrupt timeout( about 200 ms default ) so that  */
     119/* if no data is waiting to be read, the read request returns and lets   */
     120/* the write request be processed.                                       */
     121/*                                                                       */
     122/* We set a longer ReadIdle timeout( 1000 ms ) to attempt to get the     */
     123/* entire buffer from the peripheral if there is data waiting to be sent */
     124/* to the host.                                                          */
     125/*                                                                       */
     126/* For now, we set the WriteIdle and WriteInterrupt timeouts to be the   */
     127/* same.  This means we will always return within the WriteIdle timeout  */
     128/* value specified.                                                      */
     129/*                                                                       */
    78130typedef struct _PPTIMEOUTCHANNEL{
    79131   ULONG   ulReadIdleTimeOut;  // millisecs DD has to complete entire Read
     
    84136} PPTIMEOUTCHANNEL, *PPPTIMEOUTCHANNEL;
    85137
     138(Refer to the header file wpshell\src\wpsh\par1284\pdrtypes.h from the IBM
     139DDK for more information.)
    86140
    87141
     142CUPS.PDR
     143--------
    88144
    89 Port settings structure for CUPS.PDR:
     145The eCups port driver (CUPS.PDR) uses the following port settings structure:
    90146
    91147typedef struct _PORTSETTINGS {
     
    94150} PORTSETTINGS, *PPORTSETTINGS;
    95151
     152(At least version 1.04 of CUPS.PDR is required.)
    96153
    97154
    98 Port setting structure for SMB.PDR:
     155SMB.PDR
     156-------
    99157
    100 /* szPortData contains all of the port parameters in a single buffer:  */
    101 /*   host                                                              */
    102 /*   printer                                                           */
    103 /*   workgroup                                                         */
    104 /*   userid                                                            */
    105 /*   copies                                                            */
    106 /*   password                                                          */
    107 /* All except 'password' are verbatim character strings; 'password' is */
    108 /* a hexadecimal string.  Fields are separated by '#'.  All fields are */
    109 /* required; those with unspecified values are left empty.             */
     158The Samba port driver (SMB.PDR) takes a single 256-byte buffer.  This
     159buffer must take the following format:
    110160
    111 typedef struct _PORTSETTINGS {
    112     CHAR  szPortData[ 256 ];
    113 } PORTSETTINGS, *PPORTSETTINGS;
     161    host#printer#workgroup#userid#copies#password
     162
     163All fields are required; those whose values are unspecified must be left
     164empty.  (Replace each field name above with its corresponding value.)
     165The buffer is padded with 0 bytes to a length of 256 as needed.
     166
     167The 'password' field is a hexadecimal string; all others are standard
     168character strings.
     169
     170For example, to set the following configuration:
     171  host:      PRINTSRV
     172  printer:   LJET01
     173  workgroup: <none>
     174  userid:    mrmuffin
     175  password:  blueberry
     176  copies:    1
     177
     178In REXX:
     179  params = 'PRINTSRV#LJET01##mrmuffin#1#626C75656265727279'
     180  IF LENGTH( params <= 256 ) THEN DO
     181      buffer = params || COPIES('00'x, 256 - LENGTH( params ))
     182      CALL RPUPortSet 'SMB', buffer
     183  END
     184
Note: See TracChangeset for help on using the changeset viewer.