Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Reduce log noise with HID device #13010

Merged
merged 1 commit into from
Mar 27, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 19 additions & 9 deletions src/controllers/hid/hidiooutputreport.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

#include <hidapi.h>

#include "util/cmdlineargs.h"
#include "util/compatibility/qbytearray.h"
#include "util/runtimeloggingcategory.h"
#include "util/string.h"
Expand Down Expand Up @@ -34,7 +35,9 @@ void HidIoOutputReport::updateCachedData(const QByteArray& data,
m_lastCachedDataSize = data.size();

} else {
if (m_possiblyUnsentDataCached && !useNonSkippingFIFO) {
if (CmdlineArgs::Instance()
.getControllerDebug() &&
m_possiblyUnsentDataCached && !useNonSkippingFIFO) {
qCDebug(logOutput) << "t:" << mixxx::Time::elapsed().formatMillisWithUnit()
<< "skipped superseded OutputReport data for ReportID"
<< m_reportId;
Expand Down Expand Up @@ -95,9 +98,13 @@ bool HidIoOutputReport::sendCachedData(QMutex* pHidDeviceAndPollMutex,

cacheLock.unlock();

qCDebug(logOutput) << "t:" << startOfHidWrite.formatMillisWithUnit()
<< "Skipped sending identical OutputReport data from cache for ReportID"
<< m_reportId;
if (CmdlineArgs::Instance()
.getControllerDebug()) {
qCDebug(logOutput) << "t:" << startOfHidWrite.formatMillisWithUnit()
<< "Skipped sending identical OutputReport data "
"from cache for ReportID"
<< m_reportId;
}

// Return with false, to signal the caller, that no time consuming IO operation was necessary
return false;
Expand Down Expand Up @@ -144,11 +151,14 @@ bool HidIoOutputReport::sendCachedData(QMutex* pHidDeviceAndPollMutex,
return true;
}

qCDebug(logOutput) << "t:" << startOfHidWrite.formatMillisWithUnit() << " "
<< result << "bytes ( including ReportID of"
<< static_cast<quint8>(m_reportId)
<< ") sent from skipping cache - Needed:"
<< (mixxx::Time::elapsed() - startOfHidWrite).formatMicrosWithUnit();
if (CmdlineArgs::Instance()
.getControllerDebug()) {
qCDebug(logOutput) << "t:" << startOfHidWrite.formatMillisWithUnit() << " "
<< result << "bytes ( including ReportID of"
<< static_cast<quint8>(m_reportId)
<< ") sent from skipping cache - Needed:"
<< (mixxx::Time::elapsed() - startOfHidWrite).formatMicrosWithUnit();
}

// Return with true, to signal the caller, that the time consuming hid_write operation was executed
return true;
Expand Down