Checking if the serialport is really connected?

Hi,

I am using NodeJs on Colibri i.MX6 with a Colibri Evaluation Board. I am connecting the /dev/ttymxc1 without any problem and interconnecting between board and the device that I am using. But even if no device attach to the ttymxc1, it says “its connected” too. So I cannot understand if the device is connected or not. But when I connect the device with usb, I can get disconnected event.

So how can I understand the device is disconnected when I connected it with /dev/ttymxc1 ?

Thanks

Hi

The RS232 hardware can not give you that information. Having the device disconnected or having it connected but not actively sending results in the same states at the UART lines.

Thus you either have to exchange messages with your device to detect its presence or you have to implement an out of band signal which you can check. (e.g. a GPIO pulled down when plugged in)

USB on the other hand has an elaborate scheme by which a device announces its presence and the master initiates some communication.