Commit e54305ff authored by Denis Shienkov's avatar Denis Shienkov
Browse files

Handle EINVAL, ENOIOCTLCMD, ENOTTY and EPERM errors


According to TTY_IOCTL(4), the ioctl on tty device can return these
errors, which we need to interpret to QSP::SerialPortError.

For example, a virtual devices which are created by SOCAT, returns the
EINVAL error when the ioctl does query of line states.

Change-Id: Iece3b773fdc8fe4b97951ccf7cff9d2670f24694
Reviewed-by: default avatarSergey Belyashov <Sergey.Belyashov@gmail.com>
Showing with 20 additions and 0 deletions
...@@ -928,6 +928,26 @@ QSerialPort::SerialPortError QSerialPortPrivate::decodeSystemError() const ...@@ -928,6 +928,26 @@ QSerialPort::SerialPortError QSerialPortPrivate::decodeSystemError() const
case ENXIO: case ENXIO:
error = QSerialPort::ResourceError; error = QSerialPort::ResourceError;
break; break;
#endif
#ifdef EINVAL
case EINVAL:
error = QSerialPort::UnsupportedOperationError;
break;
#endif
#ifdef ENOIOCTLCMD
case ENOIOCTLCMD:
error = QSerialPort::UnsupportedOperationError;
break;
#endif
#ifdef ENOTTY
case ENOTTY:
error = QSerialPort::ResourceError;
break;
#endif
#ifdef EPERM
case EPERM:
error = QSerialPort::PermissionError;
break;
#endif #endif
default: default:
error = QSerialPort::UnknownError; error = QSerialPort::UnknownError;
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment