I am new to C and Linux. I am trying to read some data from the serial port by using the
buffptr = cBuff;
while (( nbytes = read(fd, buffptr, cBuff + sizeof(cBuff) - buffptr - 1)) > 0)
if(nbytes < 0 )
perror("Serial Read Thread ERROR:");
else if(nbytes >= 0 )
Unplugging the serial cable has only the effect that no data cannot arrive any longer, but there is no real "connection" that wound be interrupted somehow.
Your serial port now only notices that no further "0" values arrive as the line now remains on "1" constantly.
Consequently, the driver just sees that there aren't any data, but not that there can't be any data as the plug is unplugged.