eliminate excessive journal errors
When the USB gadget is shut down, the application needs to avoid writes
to it in order to avoid lots of errors in the kernel log. Close the file
handle and re-open it when timings are detected again. Also, prevent
logging the failed timings query more than once.
Change-Id: Ic126828fe26ef44ebb0a5cb65cc47b23bb84f7f3
Signed-off-by: Eddie James <eajames@linux.ibm.com>
diff --git a/ikvm_video.cpp b/ikvm_video.cpp
index 39947c6..6a5aa6c 100644
--- a/ikvm_video.cpp
+++ b/ikvm_video.cpp
@@ -31,8 +31,8 @@
using namespace sdbusplus::xyz::openbmc_project::Common::Device::Error;
Video::Video(const std::string& p, Input& input, int fr) :
- resizeAfterOpen(false), fd(-1), frameRate(fr), lastFrameIndex(-1),
- height(600), width(800), input(input), path(p)
+ resizeAfterOpen(false), timingsError(false), fd(-1), frameRate(fr),
+ lastFrameIndex(-1), height(600), width(800), input(input), path(p)
{
}
@@ -153,11 +153,21 @@
rc = ioctl(fd, VIDIOC_QUERY_DV_TIMINGS, &timings);
if (rc < 0)
{
- log<level::ERR>("Failed to query timings",
- entry("ERROR=%s", strerror(errno)));
+ if (!timingsError)
+ {
+ log<level::ERR>("Failed to query timings",
+ entry("ERROR=%s", strerror(errno)));
+ timingsError = true;
+ }
+
restart();
return false;
}
+ else if (timingsError)
+ {
+ timingsError = false;
+ input.restart();
+ }
if (timings.bt.width != width || timings.bt.height != height)
{