title: weird character substitution between pseudo-terminal and serial device
body: <p>I have an application where I open a serial device ( GSM Modem ) and I create a pseudo-terminal. I would like to read from the serial device, filter the data and send it throught the pseudo-terminal, so another process can read it, like as it would be a simple 'raw' serial line.<br>
  <code>ptFd</code> - pseudo terminal filedescriptor<br>
  <code>devFd</code> - serial device filedescriptor</p>
  
  <p>I'm using <code>posix_openpt( O_RDWR | O_NOCTTY )</code>, <code>grantpt(ptFd)</code>, <code>unlockpt(ptFd)</code> for pseudo-terminal and lots of custom setting for the serial line. For first try I wouldn't post it here, but I will do if it would help anyone to solve this problem.
  My problem is the following:</p>
  
  <p>Read devFd:<br>
  056405c0020001009e59<br>
  Read ptFd:<br>
  5e45645e45c05e425e405e415e409e59<br>
  Read devFd:<br>
  056405c0020001009e59<br>
  Read ptFd:<br>
  5e45645e45c05e425e405e415e409e59  </p>
  
  <p>I'm writing the bytes i got from device on the pseudo-terminal and:<br>
  05 changes to 5e45<br>
  00 changes to 5e40<br>
  01 changes to 5e41<br>
  02 changes to 5e42<br>
  But all bytes not starting with 0 in hex ( >=16 decimal ) are transferred just fine.</p>
  
  <p>And first of all... when I'm writing on a pseudo terminal and reading from it in the same process it shouldn't reflect those bytes I just wrote on it, right?<br>
  I'm not familiar with these terminal, but I imagine as I open a terminal, getting the slave's name with ptsname function. From another process I can open that name ( like /dev/pts/3 ) and from that point it works as a 'stream'.</p>
  
  <p>Most probably I'm wrong, but can you please give me a brief clarification? Thanks in advance.</p>