summaryrefslogtreecommitdiffstats
path: root/tools
diff options
context:
space:
mode:
authorShane Kearns <shane.kearns@accenture.com>2010-05-11 12:34:37 (GMT)
committerShane Kearns <shane.kearns@accenture.com>2010-05-11 12:37:01 (GMT)
commitfffb09adfd07eef5d2f296374b507032eec06cad (patch)
treefda6192ad0556c9e282919807a9ba6000237ad44 /tools
parent05399347ed467693d45009c6ba659746ea492231 (diff)
downloadQt-fffb09adfd07eef5d2f296374b507032eec06cad.zip
Qt-fffb09adfd07eef5d2f296374b507032eec06cad.tar.gz
Qt-fffb09adfd07eef5d2f296374b507032eec06cad.tar.bz2
Symbian/trk: Fix debugging output for the N8.
1. Fix hanging behaviour when we receive a message on the wrong mux in framed mode 2. Treat messages on the trace mux (0102) as debug output 3. Separate timestamp from text in trace messages Reviewed-by: Friedemann Kleint
Diffstat (limited to 'tools')
-rw-r--r--tools/runonphone/symbianutils/launcher.cpp18
-rw-r--r--tools/runonphone/symbianutils/trkutils.cpp22
-rw-r--r--tools/runonphone/symbianutils/trkutils.h8
3 files changed, 41 insertions, 7 deletions
diff --git a/tools/runonphone/symbianutils/launcher.cpp b/tools/runonphone/symbianutils/launcher.cpp
index fa509e7..ecb067e 100644
--- a/tools/runonphone/symbianutils/launcher.cpp
+++ b/tools/runonphone/symbianutils/launcher.cpp
@@ -365,8 +365,22 @@ void Launcher::handleResult(const TrkResult &result)
QByteArray prefix = "READ BUF: ";
QByteArray str = result.toString().toUtf8();
if (result.isDebugOutput) { // handle application output
- logMessage("APPLICATION OUTPUT: " + result.data);
- emit applicationOutputReceived(result.data);
+ QString msg;
+ if (result.multiplex == MuxTextTrace) {
+ if (result.data.length() > 8) {
+ quint64 timestamp = extractInt64(result.data) & 0x0FFFFFFFFFFFFFFFULL;
+ quint64 secs = timestamp / 1000000000;
+ quint64 ns = timestamp % 1000000000;
+ msg = QString("[%1.%2] %3").arg(secs).arg(ns).arg(QString(result.data.mid(8)));
+ logMessage("TEXT TRACE: " + msg);
+ }
+ } else {
+ logMessage("APPLICATION OUTPUT: " + result.data);
+ msg = result.data;
+ }
+ msg.replace("\r\n", "\n");
+ if(!msg.endsWith('\n')) msg.append('\n');
+ emit applicationOutputReceived(msg);
return;
}
switch (result.code) {
diff --git a/tools/runonphone/symbianutils/trkutils.cpp b/tools/runonphone/symbianutils/trkutils.cpp
index 9b43c96..60e391e 100644
--- a/tools/runonphone/symbianutils/trkutils.cpp
+++ b/tools/runonphone/symbianutils/trkutils.cpp
@@ -276,14 +276,13 @@ QByteArray frameMessage(byte command, byte token, const QByteArray &data, bool s
/* returns 0 if array doesn't represent a result,
otherwise returns the length of the result data */
-ushort isValidTrkResult(const QByteArray &buffer, bool serialFrame)
+ushort isValidTrkResult(const QByteArray &buffer, bool serialFrame, ushort& mux)
{
if (serialFrame) {
// Serial protocol with length info
if (buffer.length() < 4)
return 0;
- if (buffer.at(0) != 0x01 || byte(buffer.at(1)) != 0x90)
- return 0;
+ mux = extractShort(buffer.data());
const ushort len = extractShort(buffer.data() + 2);
return (buffer.size() >= len + 4) ? len : ushort(0);
}
@@ -292,6 +291,7 @@ ushort isValidTrkResult(const QByteArray &buffer, bool serialFrame)
const int firstDelimiterPos = buffer.indexOf(delimiter);
// Regular message delimited by 0x7e..0x7e
if (firstDelimiterPos == 0) {
+ mux = MuxTrk;
const int endPos = buffer.indexOf(delimiter, firstDelimiterPos + 1);
return endPos != -1 ? endPos + 1 - firstDelimiterPos : 0;
}
@@ -304,7 +304,7 @@ bool extractResult(QByteArray *buffer, bool serialFrame, TrkResult *result, QByt
result->clear();
if(rawData)
rawData->clear();
- const ushort len = isValidTrkResult(*buffer, serialFrame);
+ const ushort len = isValidTrkResult(*buffer, serialFrame, result->multiplex);
if (!len)
return false;
// handle receiving application output, which is not a regular command
@@ -312,7 +312,6 @@ bool extractResult(QByteArray *buffer, bool serialFrame, TrkResult *result, QByt
if (buffer->at(delimiterPos) != 0x7e) {
result->isDebugOutput = true;
result->data = buffer->mid(delimiterPos, len);
- result->data.replace("\r\n", "\n");
*buffer->remove(0, delimiterPos + len);
return true;
}
@@ -353,6 +352,19 @@ SYMBIANUTILS_EXPORT uint extractInt(const char *data)
return res;
}
+SYMBIANUTILS_EXPORT quint64 extractInt64(const char *data)
+{
+ quint64 res = byte(data[0]);
+ res <<= 8; res += byte(data[1]);
+ res <<= 8; res += byte(data[2]);
+ res <<= 8; res += byte(data[3]);
+ res <<= 8; res += byte(data[4]);
+ res <<= 8; res += byte(data[5]);
+ res <<= 8; res += byte(data[6]);
+ res <<= 8; res += byte(data[7]);
+ return res;
+}
+
SYMBIANUTILS_EXPORT QString quoteUnprintableLatin1(const QByteArray &ba)
{
QString res;
diff --git a/tools/runonphone/symbianutils/trkutils.h b/tools/runonphone/symbianutils/trkutils.h
index 553fc7d..e571028 100644
--- a/tools/runonphone/symbianutils/trkutils.h
+++ b/tools/runonphone/symbianutils/trkutils.h
@@ -135,9 +135,16 @@ enum Command {
TrkDSPositionFile = 0xd4
};
+enum SerialMultiplexor {
+ MuxRaw = 0,
+ MuxTextTrace = 0x0102,
+ MuxTrk = 0x0190
+};
+
inline byte extractByte(const char *data) { return *data; }
SYMBIANUTILS_EXPORT ushort extractShort(const char *data);
SYMBIANUTILS_EXPORT uint extractInt(const char *data);
+SYMBIANUTILS_EXPORT quint64 extractInt64(const char *data);
SYMBIANUTILS_EXPORT QString quoteUnprintableLatin1(const QByteArray &ba);
@@ -217,6 +224,7 @@ struct SYMBIANUTILS_EXPORT TrkResult
int errorCode() const;
QString errorString() const;
+ ushort multiplex;
byte code;
byte token;
QByteArray data;