Skip to content

Commit 0cb16e6

Browse files
authored
Merge pull request #513 from deXol/develop
#486 Additional debug logs for writing to device on Win
2 parents 2b9fda5 + 6ce1d17 commit 0cb16e6

File tree

1 file changed

+13
-1
lines changed

1 file changed

+13
-1
lines changed

src/MPDevice_win.cpp

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818
******************************************************************************/
1919
#include "MPDevice_win.h"
2020
#include "HIDLoader.h"
21+
#include "AppDaemon.h"
2122

2223
// Windows GUID object
2324
static GUID IClassGuid = {0x4d1e55b2, 0xf16f, 0x11cf, {0x88, 0xcb, 0x00, 0x11, 0x11, 0x00, 0x00, 0x30} };
@@ -160,11 +161,14 @@ bool MPDevice_win::openPath()
160161

161162
void MPDevice_win::platformWrite(const QByteArray &data)
162163
{
163-
164164
if (m_writeQueue.isEmpty())
165165
{
166166
platformWriteToDevice(data);
167167
}
168+
else if (AppDaemon::isDebugDev())
169+
{
170+
qDebug() << "Write queue is not empty";
171+
}
168172
m_writeQueue.append(data);
169173
}
170174

@@ -202,6 +206,10 @@ void MPDevice_win::platformWriteToDevice(const QByteArray &data)
202206
qWarning() << "Failed to write data to device! " << err;
203207
qWarning() << getLastError(err);
204208
}
209+
if (AppDaemon::isDebugDev())
210+
{
211+
qDebug() << "Written to device: " << ba.toHex() << ", Error: " << err;
212+
}
205213
}
206214

207215
void MPDevice_win::platformRead()
@@ -392,6 +400,10 @@ void MPDevice_win::writeDataFinished()
392400
if (m_writeQueue.isEmpty())
393401
{
394402
// WriteQueue is empty, platformWrite was called directly
403+
if (AppDaemon::isDebugDev())
404+
{
405+
qWarning() << "writeDataFinished, but commandqueue was empty";
406+
}
395407
return;
396408
}
397409
m_writeQueue.dequeue();

0 commit comments

Comments
 (0)