I’m working on an embedded system in which the serial port of the CME9210 must be configurable as either DTE or DCE. In the easy way (DTE), the device asserts DTR when the port is opened, letting the other end know it’s ready. No problem there.
The other way (DCE) is not so easy. I need to read DTR and do something when it gets asserted. I can use ioctl() to read the DTR pin, sure enough, but the value is whatever I last set it to be. In short, this pin is an output, but I need to float this pin so I can use it as an input, to be set by whatever the serial port gets plugged into. This seems to be a surprisingly uncommon thing to want to do.