title: Unable to open serial port in linux
body: <p>using fedora 11,</p>
  
  <p>In serial class:</p>
  
  <pre><code>/*
       \return 1 success 
  
  \return -1 device not found
  
  \return -2 error while opening the device
  
  \return -3 error while getting port parameters
  
   \return -4 Speed (Bauds) not recognized
  
  \return -5 error while writing port parameters
  
  \return -6 error while writing timeout parameters
  
  */
  `char serialib::Open(const char *Device,const unsigned int Bauds){`
  
      struct termios options; // Structure with the device's options
      // Open device
      fd = open(Device, O_RDWR | O_NOCTTY | O_NDELAY);            // Open port
      if (fd == -1) return -2;                        // If the device is not open, return -1
      fcntl(fd, F_SETFL, FNDELAY);                    // Open the device in nonblocking mode
  </code></pre>
  
  <p>......................</p>
  
  <pre>
  [termina]$ dmesg | grep tty
  
  console [tty0] enabled
  
  serial8250: ttyS0 at I/O 0x3f8 (irq = 4) is a 16550A
  
  serial8250: ttyS1 at I/O 0x2f8 (irq = 3) is a 16550A
  
  00:07: ttyS0 at I/O 0x3f8 (irq = 4) is a 16550A
  
  00:08: ttyS1 at I/O 0x2f8 (irq = 3) is a 16550A
  </pre>
  
  <p>.......................................................</p>
  
  <p>in my main program i do a Ret=LS.Open(DEVICE_PORT,4800);<br>
  and Ret value is -2 which means error while opening the device as stated above
  could it be a permission problem? how can i resolve this and open the port, thanks!</p>