   def write(%Context{} = ctx, str, timeout)
   when is_binary(str) and is_number(timeout) do
     if available?(ctx) do
+      try do
+        fn() -> debug_log("write begin from: #{inspect Process.info(self())}") end.()
+      rescue
+        _ -> :ok
+      end
       GenServer.call(ctx.serial, {:write, str, timeout}, :infinity)
     else
       {:error, :unavailable}

  end

  defp configure_uart(nerves, active) do
    UART.configure(nerves,
      framing: {UART.Framing.Line, separator: "\r\n"},
      active: active,

  when is_binary(str) do
    handshake = generate_handshake()
    writeme =  "#{str} #{handshake}"

    :ok = configure_uart(state.nerves, false)

    debug_log "writing: #{writeme}"
    :ok = UART.write(state.nerves, writeme)

    echo_ok = recieve_echo(state.nerves, writeme, "")

    :ok = configure_uart(state.nerves, true)
    case echo_ok do
      :ok ->
        debug_log "timing this out in #{timeout} ms."
        timer = Process.send_after(self(), :timeout, timeout)
        current = %{
          status:   nil,
