Check Line Detectors

v = cpo:okr()

Returns the state of the line detectors.
The line detectors can sense if there are voltages applied to the COM port, and therefore know if something is connected.

Value Description
0 Nothing detected
1 DCE detected (RX 2 / TX 3)
2 DTE detected (RX 3 / TX 2)
3 Both detected - error state or Y-lead
Note

This does not work for TTL level serial devices that are idle (i.e. at 0V)
It will detect both negative (the usual idle voltage) and positive values.