2.1 COM Enumerator Detection
The COM Enumerator software shall do the following things visible on the COM port:
- Initialize the COM port, with DTR ON , RTS OFF, and TXD set to Mark Idle.
- Wait for DSR=1 to indicate presence of COM device.
- Stimulate the COM port control leads in a defined manner.
- Collect the ID information if available.
(Optional) Monitor the port when idle to detect device attach/detach.
The COM Enumerator will make two attempts to elicit a PnP ID:
- First, it will try a means with a DTR-RTS time signature, so that devices like modems (which have traditional uses for DTR and RTS) are not confused.
- If the first try does not generate a reponse, it will assume it is a device that will begin to respond within 200ms of being powered (e.g. COM port powered mice, non-modems).
The entire interval can be drawn as follows:
Figure 1 - Example COM Enumerator External Timing Diagram
interval---->|check|<---1st--->|<1st>|<2nd>|<2nd>|<--Idle----
| dev | Setup | Wait|Setup| Wait|
| | | | | | |
time | T1 | T2 | T3 | T4 | T2 | T4 |
______ ___________ _____________
DTR(108) XXX \_____/ \_____/
| | | | | | |
_____ _____
RTS(105) XXX__________________/ \_____/ \_________
| | | | |
reference |2.1.2| 2.1.3 |2.1.4|2.1.5|2.1.6|
T1: minimum interval to hold DTR high while waiting for DSR
T2: minimum interval for external device to power down or detect the port state
T3: DTR-RTS enumerator signature delay
T4: maximum interval to wait for DSR and/or first received character
T5: PNP COM ID per/character timeout (not shown)
T6: PNP COM ID EndPNP timeout (not shown)
T7: Disconnect Verification timout (not shown)
Note Figure 1 is drawn with characters to survive translation to plain ASCII.
2.1.1 COM port initialization, check for port availible
- Attempt to acquire the port via defined operating system services.
- If the port is busy (e.g. the modem or mouse is in use), don't enumerate this port.
If the port IRQ is in use by another device driver, don't enumerate this port.
2.1.2 COM port initialization, check for device enumerate
- leave TXD = mark idle.
- set DTR=1, set RTS=0, start T1 = 200 ms (+/- 35 ms tolerance).
- If T1 expires and DSR=0, go to Disconnect Idle.
- else, go to Com port Setup, 1st phase.
2.1.3 COM port Setup, 1st phase
- Set the serial port for 1200 bit/s, 7 data bits, no parity, one stop bit.
- set DTR=0, set RTS=0, start T2 = 200 ms (+/- 35 ms tolerance).
- When T2 expires, set DTR=1, start T3 = 200 ms (+/- 35 ms tolerance).
- When T3 expires go to Wait for response, 1st phase.
2.1.4 Wait for response, 1st phase
- set RTS=1, start T4 = 200 ms (+/- 35 ms tolerance).
- If any character received, go to Collect PnP COM device ID(s).
- If T4 expires and no character received, go to COM Port Setup, 2nd Phase.
2.1.5 COM port Setup, 2nd phase
- Set DTR=0, RTS=0, start T2 200ms (+/- 35 ms tolerance).
- When T2 expires go to Wait for response, 2nd phase
2.1.6 Wait for response, 2nd phase
- set DTR=1 and RTS=1, start T4 = 200 ms (+/- 35 ms tolerance).
- If any character received, go to Collect PnP COM device ID(s)
- If T4 expires and DSR=0, go to Verify Disconnect
- If T4 expires and DSR=1, go to Connect Idle
2.1.7 Collect PnP COM device ID(s)
- Set T5 = 200ms (-0ms/+40ms), for per-character timeout.
- Set T6= 2.2 seconds; (256 char x 10bits/char)/(1200 bit/s) = 2.13 seconds.
- Receive and buffer any characters (see section 3.3 and section 4). Each time a new character is received, reset T5=200ms.
- If bit errors or framing errors are detected after the first character go to Connect Idle.
- If T5 expires after the first character, check for valid PnP ID string. If valid notify appropriate operating system service of the new device. If invalid go to Connect Idle.
- If End ID character detected, check for valid PnP ID string. If valid notify appropriate operating system service of the new device. If invalid go to Connect Idle.
- If T4 expires without Begin ID character detection go to Connect Idle.
- If T6 expires without End ID character detection go to Connect Idle.
- If DSR=0, go to Verify Disconnect.
2.1.8 Verify Disconnect
This step verifies that the device has actually been removed. This accounts for modems and other devices that lower DSR briefly when DTR drops in order to reset, etc. The enumerator assumes the device is not present if DSR is low after a timeout.
- Set DTR=1; set RTS=0.
- Set T7 = 5 seconds.
- When T7 expires, if DSR=1 go to Disconnect Idle.
- IF T7 expires and DSR=0, go to Disconnect Idle.
2.1.9 Connect Idle
- Set DTR=1; set RTS=0.
- Set the serial port for 300 bit/s, 7 data bits, No parity, one stop bit.
- Wait (forever): If DSR=0, notify appropriate operating system service of device removal, go to Disconnect Idle.
- (Optional) Monitor port for events caused by miscellaneous non-Plug and Play devices, e.g. GIDEI input devices (not documented here).
Note GIDEI = General Input Device Emulating Interface. These devices are used to provide accessibility for some computer users with disabilities.
2.1.10 Disconnect Idle
This step is optional, if the enumerator software is going to monitor idle ports for dynamic device removal, or attempt to detect non-Plug and Play devices.
- Notify appropriate operating system service of device removal, if a device was previously present.
- Set DTR=1; set RTS=0.
- Set the serial port for 300 bit/s, 7 data bits, No parity, one stop bit.
- Wait (forever): If DSR=1, go to COM port Setup, first phase.
- (Optional) Monitor port for events caused by miscellaneous non-Plug and Play devices.