code: public function confBaudRate($rate)
      {
          if ($this->_dState !== SERIAL_DEVICE_SET) {
              trigger_error("Unable to set the baud rate : the device is " .
                            "either not set or opened", E_USER_WARNING);
  
              return false;
          }
  
          $validBauds = array (
              110    => 11,
              150    => 15,
              300    => 30,
              600    => 60,
              1200   => 12,
              2400   => 24,
              4800   => 48,
              9600   => 96,
              19200  => 19,
              38400  => 38400,
              57600  => 57600,
              115200 => 115200
          );
  
          if (isset($validBauds[$rate])) {
              if ($this->_os === "linux") {
                  $ret = $this->_exec(
                      "stty -F " . $this->_device . " " . (int) $rate,
                      $out
                  );
              } elseif ($this->_os === "osx") {
                  $ret = $this->_exec(
                      "stty -f " . $this->_device . " " . (int) $rate,
                      $out
                  );
              } elseif ($this->_os === "windows") {
                  $ret = $this->_exec(
                      "mode " . $this->_winDevice . " BAUD=" . $validBauds[$rate],
                      $out
                  );
              } else {
                  return false;
              }
  
              if ($ret !== 0) {
                  trigger_error(
                      "Unable to set baud rate: " . $out[1],
                      E_USER_WARNING
                  );
  
                  return false;
              }
  
              return true;
          } else {
              return false;
          }
      }
docs: Configure the Baud Rate
  Possible rates : 110, 150, 300, 600, 1200, 2400, 4800, 9600, 38400,
  57600 and 115200.
  
  @param  int  $rate the rate to set the port in
  @return bool