Using RFC2217 for remote control of most CoBos and Evolution device server serial ports

How can I change the serial settings and control handshaking pins on the serial port of a Lantronix device server from my custom application?


The Lantronix CPR 4.x and higher uses RFC2217 IAC commands to control the handshaking pins on UDS1100s, EDS1100s and similar Lantronix device servers.

NOTE: The RFCs supply the values for the various IAC strings in decimal, but most applications tend to use hex values, so we'll use hex in this FAQ. You can use an application such as the Windows Calculator in Scientific (XP) or Programmer (Win 7) view to convert from decimal to hex and back.



As an example, you might write your application to send some standard telnet IACs to set up the connection:

FF FC 01 [WONT ECHO]
FF FE 01 [DONT ECHO]
FF FB 03 [WILL SUPPRESS-GO-AHEAD]
FF FD 2C [DO COM-PORT-OPTION]

The last IAC string, FF FD 2C, requests RFC2217 extensions on the connection.

If the device server is running CoBos v6.4 or higher it will respond with something like this:

FF FC 01 [WONT ECHO]
FF FD 03 [DO SUPPRESS-GO-AHEAD]
FF FB 2C [WILL COM-PORT-OPTION]
FF FA 2C 6C 6B 00 [FLOWCONTROL-SUSPEND NOTIFY-MODEMSTATE]
FF F0 [END SUBNEGOTIATION]

The last 3 IACs above agree to use RFC2217 IACs, turn off flow control and ask for the modem status of the device server's port.

Depending on the application, there may be some more back and forth negotiating telnet and RFC2217 options, then you can send IACs that are something like this:

FF FA 2C 0A FF FF F0 [SET LINESTATE MASK (all 1s)]
FF FA 2C 0B FF FF F0 [SET MODEMSTATE MASK (all 1s)]
FF FA 2C 01 00 00 25 80 FF F0 [SET BAUDRATE 9600]
FF FA 2C 02 08 FF F0 SET DATASIZE 8
FF FA 2C 03 01 FF F0 ...etc. These commands set up the serial port on the WiBox. See RFC2217 for more information on what they do.
FF FA 2C 04 01 FF F0
FF FA 2C 05 01 FF F0
FF FA 2C 02 08 FF F0
FF FA 2C 03 01 FF F0
FF FA 2C 04 01 FF F0
FF FA 2C 05 01 FF F0
FF FA 2C 01 00 00 25 80 FF FO

You can also change the status of the control line outputs and read the status of the control line intputs. E.g. to toggle RTS and DTR you would send:

FF FA 2C 05 01 FF F0 [FLOW CONTROL OFF]
FF FA 2C 05 0C FF F0 [RTS OFF]
FF FA 2C 05 0B FF F0 [RTS ON]
FF FA 2C 05 01 FF F0 [FLOW CONTROL OFF]
FF FA 2C 05 09 FF F0 [DTR OFF]
FF FA 2C 05 08 FF F0 [DTR ON]

Make sure flow control is disabled when manually changing the values of the flow control pins.

For basic information on Telnet IACs see RFC 854 at http://www.faqs.org/rfcs/rfc854.html
For information on using the telnet Com Port Option see RFC 2217 at http://www.faqs.org/rfcs/rfc2217.html

Also, Microsoft has an article on telnet and IACs at http://support.microsoft.com/kb/231866 and there is a lot of other information available on the web.


[Originally Published On: 08/31/2009 09:31 AM]