Examples of serial_struct


Examples of jtermios.linux.JTermiosImpl.Linux_C_lib.serial_struct

      if (m_BaudRates[i] == speed) {

        // found the baudrate from the table

        // just in case custom divisor was in use, try to turn it off first
        serial_struct ss = new serial_struct();

        r = ioctl(fd, TIOCGSERIAL, ss);
        if (r == 0) {
          ss.flags &= ~ASYNC_SPD_MASK;
          r = ioctl(fd, TIOCSSERIAL, ss);
        }

        // now set the speed with the constant from the table
        c = m_BaudRates[i + 1];
        if ((r = JTermios.cfsetispeed(termios, c)) != 0)
          return r;
        if ((r = JTermios.cfsetospeed(termios, c)) != 0)
          return r;
        if ((r = JTermios.tcsetattr(fd, TCSANOW, termios)) != 0)
          return r;

        return 0;
      }
    }

    // baudrate not defined in the table, try custom divisor approach

    // configure port to use custom speed instead of 38400
    serial_struct ss = new serial_struct();
    if ((r = ioctl(fd, TIOCGSERIAL, ss)) != 0)
      return r;
    ss.flags = (ss.flags & ~ASYNC_SPD_MASK) | ASYNC_SPD_CUST;

    if (speed == 0) {
View Full Code Here

Examples of jtermios.linux.JTermiosImpl.Linux_C_lib.serial_struct

      if (m_BaudRates[i] == speed) {

        // found the baudrate from the table

        // in case custom divisor was in use, turn it off first
        serial_struct ss = new serial_struct();

        r = ioctl(fd, TIOCGSERIAL, ss);
        if (r != 0) {
          // not every driver supports TIOCGSERIAL, so if it fails, just ignore it
            // (see also issues #12 and #16)
            if (errno() != EINVAL && errno() != ENOTSUP)
            return r;
        } else {
          ss.flags &= ~ASYNC_SPD_MASK;
          r = ioctl(fd, TIOCSSERIAL, ss);
          if (r != 0) {
            // not every driver supports TIOCSSERIAL, so if it fails, just ignore it
              // (see also issues #12 and #16)
              if (errno() != EINVAL && errno() != ENOTSUP)
              return r;
          }
        }

        // now set the speed with the constant from the table
        c = m_BaudRates[i + 1];
        if ((r = JTermios.cfsetispeed(termios, c)) != 0)
          return r;
        if ((r = JTermios.cfsetospeed(termios, c)) != 0)
          return r;
        if ((r = JTermios.tcsetattr(fd, TCSANOW, termios)) != 0)
          return r;

        return 0;
      }
    }

    // baudrate not defined in the table, try custom divisor approach

    // configure port to use custom speed instead of 38400
    serial_struct ss = new serial_struct();
    if ((r = ioctl(fd, TIOCGSERIAL, ss)) != 0)
      return r;
    ss.flags = (ss.flags & ~ASYNC_SPD_MASK) | ASYNC_SPD_CUST;

    if (speed == 0) {
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.