Fix kvm show disconnected if host successively changes resolution
Video::resize() will throw execption if any ioctl failed and it leads
to rfb server stopped. This is the root cause because
VIDIOC_QUERY_DV_TIMINGS always could return error for no signal.
If VIDIOC_QUERY_DV_TIMINGS failed, we can go restart() to avoid this
problem.
Tested: manually tested with the host which changes resolution quickly
and successively.
Signed-off-by: Jammy Huang <jammy_huang@aspeedtech.com>
Change-Id: Ie613f177122b7058e19511a451e4dad9cb1dffbf
diff --git a/ikvm_video.cpp b/ikvm_video.cpp
index 7bd4b4e..8303170 100644
--- a/ikvm_video.cpp
+++ b/ikvm_video.cpp
@@ -267,13 +267,10 @@
rc = ioctl(fd, VIDIOC_QUERY_DV_TIMINGS, &timings);
if (rc < 0)
{
- log<level::ERR>("Failed to query timings",
+ log<level::ERR>("Failed to query timings, restart",
entry("ERROR=%s", strerror(errno)));
- elog<ReadFailure>(
- xyz::openbmc_project::Common::Device::ReadFailure::
- CALLOUT_ERRNO(errno),
- xyz::openbmc_project::Common::Device::ReadFailure::
- CALLOUT_DEVICE_PATH(path.c_str()));
+ restart();
+ return;
}
rc = ioctl(fd, VIDIOC_S_DV_TIMINGS, &timings);