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: Denis Shienkov <denis.shienkov@gmail.com>