summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorJoergAtGithub <JoergAtGithub@worldwartweb.com>2021-02-21 09:04:58 +0100
committerJoergAtGithub <JoergAtGithub@worldwartweb.com>2021-02-21 09:04:58 +0100
commit706ea80e7ab91af4e8728eb873564880430fbc2c (patch)
tree7201c9df9633453c3100e40e7be75c835f69e98e /src
parent79e139285282701aeb66431a92162f3e3bdb6d94 (diff)
Removed call of incomingData from getInputReport due to the risk of infinite loops in mapping scripts
Fixed some comments mentioned in review
Diffstat (limited to 'src')
-rw-r--r--src/controllers/hid/hidcontroller.cpp14
1 files changed, 6 insertions, 8 deletions
diff --git a/src/controllers/hid/hidcontroller.cpp b/src/controllers/hid/hidcontroller.cpp
index 23ebcf9579..9126db1bac 100644
--- a/src/controllers/hid/hidcontroller.cpp
+++ b/src/controllers/hid/hidcontroller.cpp
@@ -152,11 +152,14 @@ void HidController::processInputReport(int bytesRead) {
memcmp(pCurrentBuffer, pPreviousBuffer, bytesRead) == 0) {
return;
}
- // Cycle between buffers so the memcmp below does not require deep copying to another buffer.
+ // Cycle between buffers so the memcmp above does not require deep copying to another buffer.
m_pollingBufferIndex = (m_pollingBufferIndex + 1) % kNumBuffers;
m_lastPollSize = bytesRead;
auto incomingData = QByteArray::fromRawData(
reinterpret_cast<char*>(pCurrentBuffer), bytesRead);
+
+ // Execute callback function in JavaScript mapping
+ // and print to stdout in case of --controllerDebug
receive(incomingData, mixxx::Time::elapsed());
}
@@ -174,9 +177,9 @@ QList<int> HidController::getInputReport(unsigned int reportID) {
<< QString::number(static_cast<quint8>(reportID), 16)
.toUpper()
.rightJustified(2, QChar('0'))
- << ")")
+ << ")");
- if (bytesRead <= kReportIdSize) {
+ if (bytesRead <= kReportIdSize) {
// -1 is the only error value according to hidapi documentation.
// Otherwise minimum possible value is 1, because 1 byte is for the reportID,
// the smallest report with data is therefore 2 bytes.
@@ -191,11 +194,6 @@ QList<int> HidController::getInputReport(unsigned int reportID) {
for (int i = 0; i < bytesRead; i++) {
dataList.append(m_pPollData[m_pollingBufferIndex][i]);
}
-
- // Execute callback function in JavaScript mapping
- // and print to stdout in case of --controllerDebug
- processInputReport(bytesRead);
-
return dataList;
}