Changeset 13 for rxprtutl/trunk/notes
- Timestamp:
- May 2, 2013, 3:35:06 PM (12 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
rxprtutl/trunk/notes
r3 r13 1 USING RPUPortSet 1 Using RPUPortQuery & RPUPortSet 2 =============================== 3 4 These functions return or accept a buffer (passed as a REXX string) which 5 contains the current port configuration data as raw bytes. The format of 6 this data depends on the port driver which controls the particular port 7 being queried or set. 8 9 The data formats for several common port drivers are described below. 10 11 NOTE: 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 22 SERIAL.PDR, PARALLEL.PDR 23 ------------------------ 2 24 3 25 The standard serial and parallel port drivers do not support the SplPdSet API. 4 26 5 The PAR1284 port driver takes a data structure with the following format:6 27 28 PAR1284.PDR 29 ----------- 30 31 The high-speed BIDI parallel port (PAR1284) driver uses a data structure with 32 the following format (information taken from IBM DDK headers): 33 34 typedef struct _PORTSETTINGS{ 7 35 ULONG signature; /* Must be 0x52464E49 ('INFR') */ 8 36 ULONG ulVersion; /* Must be 0x00000001 */ … … 74 102 ULONG ulpszDeviceID; /* -> 1284 deviceID for printer on port */ 75 103 } PORTSETTINGS, *PPORTSETTINGS; 76 #define PAR12_SIGNATURE77 104 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 /* */ 78 130 typedef struct _PPTIMEOUTCHANNEL{ 79 131 ULONG ulReadIdleTimeOut; // millisecs DD has to complete entire Read … … 84 136 } PPTIMEOUTCHANNEL, *PPPTIMEOUTCHANNEL; 85 137 138 (Refer to the header file wpshell\src\wpsh\par1284\pdrtypes.h from the IBM 139 DDK for more information.) 86 140 87 141 142 CUPS.PDR 143 -------- 88 144 89 Port settings structure for CUPS.PDR:145 The eCups port driver (CUPS.PDR) uses the following port settings structure: 90 146 91 147 typedef struct _PORTSETTINGS { … … 94 150 } PORTSETTINGS, *PPORTSETTINGS; 95 151 152 (At least version 1.04 of CUPS.PDR is required.) 96 153 97 154 98 Port setting structure for SMB.PDR: 155 SMB.PDR 156 ------- 99 157 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. */ 158 The Samba port driver (SMB.PDR) takes a single 256-byte buffer. This 159 buffer must take the following format: 110 160 111 typedef struct _PORTSETTINGS { 112 CHAR szPortData[ 256 ]; 113 } PORTSETTINGS, *PPORTSETTINGS; 161 host#printer#workgroup#userid#copies#password 162 163 All fields are required; those whose values are unspecified must be left 164 empty. (Replace each field name above with its corresponding value.) 165 The buffer is padded with 0 bytes to a length of 256 as needed. 166 167 The 'password' field is a hexadecimal string; all others are standard 168 character strings. 169 170 For 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 178 In 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.