anchor.diff:    { We want raw comms }
     cfmakeraw(comsettings);
   
  +  { Yes, this code is awful! Junk. TODO: Make it sensible }
     { Set baudrate }
  -  cfsetospeed(comsettings, B38400);
  -  cfsetispeed(comsettings, B38400);
  +  if cmd <> 'loopbacktest' then begin
  +    cfsetospeed(comsettings, B38400);
  +    cfsetispeed(comsettings, B38400);
  +  end else begin
  +    if paramstr(3) = '9600' then begin
  +      cfsetospeed(comsettings, B9600);
  +      cfsetispeed(comsettings, B9600);
  +    end else if paramstr(3) = '38400' then begin
  +      cfsetospeed(comsettings, B38400);
  +      cfsetispeed(comsettings, B38400);
  +    end else if paramstr(3) = '115200' then begin
  +      cfsetospeed(comsettings, B115200);
  +      cfsetispeed(comsettings, B115200);
  +    end else begin
  +      writeln('Error: Bad baud rate');
  +      exit;
  +    end;
  +  end;
   
     { Ignore modem controls }
     comsettings.c_cflag := comsettings.c_cflag or (CLOCAL or CREAD);
  
positive.code:   end;
  
    devicefilename := paramstr(1);
    if not fileexists(devicefilename) then begin
      writeln('Error: The device ' + devicefilename + ' does not exist.');
      exit;
  
negative.code:   { Flush everything }
    tcflush(comhandle, TCIOFLUSH);
  
    if cmd <> 'loopbacktest' then begin
      { First send an empty command anyway incase the module has received some garbage }
      WriteLine(comhandle, 'AT');
      sleep(500);
      tcflush(comhandle, TCIFLUSH);
      writeln('OK');
      write('Checking if the module is responding... ');
      WriteLine(comhandle, 'AT');
      s := GetLine(comhandle);
      if s <> 'OK' then begin
        writeln('failed');
        writeln('Error: Unexpected response: ' + s);
        exit;
      end;
    end;
    writeln('OK');
  
    if cmd = 'info' then begin
      CommandInfo(comhandle);
    end else if cmd = 'reboot' then begin
  