title: Changing USB Baud Rate from 9600 to 115200 on Android
body: <p>I have an Arduino which sends data serially in 115200 baud rate. </p>
  
  <p>There is an application that receives data from Arduino in 9600 baud rate. The code is </p>
  
  <pre><code>    // Arduino USB serial converter setup
      // Set control line state
      mUsbConnection.controlTransfer(0x21, 0x22, 0, 0, null, 0, 0);
      // Set line encoding.
      mUsbConnection.controlTransfer(0x21, 0x20, 0, 0, getLineEncoding(9600), 7, 0);
      //mUsbConnection.controlTransfer(0x21, 0x20, 0x001A, 0, getLineEncoding(9600), 7, 0);
  </code></pre>
  
  <p>Then in the <strong>getLineEncoding()</strong> function </p>
  
  <pre><code>private byte[] getLineEncoding(int baudRate) {
      final byte[] lineEncodingRequest = { (byte) 0x80, 0x25, 0x00, 0x00, 0x00, 0x00, 0x08 };
      switch (baudRate) {
      case 14400:
          lineEncodingRequest[0] = 0x40;
          lineEncodingRequest[1] = 0x38;
          break;
  
      case 19200:
          lineEncodingRequest[0] = 0x00;
          lineEncodingRequest[1] = 0x4B;
          break;
      }
  
      return lineEncodingRequest;
  }
  </code></pre>
  
  <p>There is a switch case stracture for setting the baud rate as 9600, 14400 or 19200. But I want it to be <strong>115200</strong> Can anyone tell me how I can do that?</p>