title: Uncommon baud rate on serial port - Linux
body: <p>I'm currently trying to make a programm to read a serial port. On this port I receive data with a baud rate of 875000. It's really uncommon and I don't succeed to modified it. I've make a little C programm to do that but it didn't work with 875000... Here some part of the code with the programmation of the serial port : </p>
  
  <pre><code>    #include &lt;stdio.h&gt;
      #include &lt;stdlib.h&gt;
      #include &lt;asm/termios.h&gt;
      #include &lt;sys/fcntl.h&gt;
      #include &lt;unistd.h&gt;
      #include &lt;errno.h&gt;
      #include &lt;string.h&gt;
      #include "test.h"
  
      void read_Serial_Port(const char* DEVICE_PORT)
      {
          int file;
          struct ktermios options;
          unsigned int nCountMax = 60;
          bool b;
  
          file = open(DEVICE_PORT, O_RDONLY | O_NOCTTY | O_NDELAY);
  
          if(file == -1){perror("Unable to open the serial port\n");}
          //printf("Serial port open successful !\n");
          int speed = atoi("875000");
  
          ioctl(file, TCGETS2, &amp;options);     
  
  
          options.c_ispeed = speed;
          options.c_ospeed = speed;
  
          options.c_cflag |= (CLOCAL | CREAD);              
          options.c_cflag |= PARENB;                  
          options.c_cflag |= PARODD; 
          options.c_cflag &amp;= ~CBAUD;
  
          options.c_cflag |= BOTHER;                                          
          options.c_cflag &amp;= ~CSIZE;                      
          options.c_cflag |= CS8;     
  
          ioctl(file, TCSETS2, &amp;options); 
  
  
          //printf("Reading serial port ...\n\n"); 
          b = readMessage(file, nCountMax);
  
          if (b == 0){printf("Error while reading serial port\n");}
          //else printf("\nSerial port read successful\n");
  
          close(file);
          //printf("Serial port closed\n");
      };
  </code></pre>