title: Sending binary data over Bluetooth/RFCOMM/SPP converts 0x0A to 0x0D 0x0A
body: <p>I have a Bluetooth RFCOMM service running on Linux via the commands:</p>
  
  <pre class="lang-bsh prettyprint-override"><code>sdptool add --channel 1 SP
  rfcomm watch hci0 1 "$COMMAND" {}
  # ^ here
  </code></pre>
  
  <p>The <code>$COMMAND</code> will write binary data to the file passed as a parameter. I have tested that it behaves correctly by doing:</p>
  
  <pre class="lang-bsh prettyprint-override"><code>FIFO=$(tempfile)
  mkfifo "$FIFO"
  "$COMMAND" "$FIFO" &amp;
  cat "$FIFO" | hexdump -C # &lt;- output is correct
  </code></pre>
  
  <p>However, when connecting to the service from a different device via SPP/RFCOMM discovery (UUID <code>00001101-0000-1000-8000-00805F9B34FB</code>), I see that every instance of <code>0x0A</code> (<code>LF</code>) is replaced by <code>0x0D</code> <code>0x0A</code> (<code>CR</code> <code>LF</code>) in the stream. The issue isn't on the receiving end, because I have tried connecting to a hardware serial device that also sends binary data, and there the conversion doesn't happen. It must be the command in the first snippet (above the <code># ^ here</code> line) that performs the replacement.</p>
  
  <p>Why does the <code>rfcomm</code> tool do this replacement and how can I disable it?</p>