diff options
author | Mike Lockwood <lockwood@android.com> | 2010-12-07 11:24:28 -0800 |
---|---|---|
committer | Mike Lockwood <lockwood@android.com> | 2010-12-07 17:13:12 -0800 |
commit | 0c7c7c76a96a82ec728a2d5c091941c4057ffb25 (patch) | |
tree | 19fc13f9b1d585ee08afe816939c27e5373cb091 /media/mtp/MtpProperty.cpp | |
parent | 98693f674125484de8873d969c209276a6dd604b (diff) | |
download | frameworks_av-0c7c7c76a96a82ec728a2d5c091941c4057ffb25.zip frameworks_av-0c7c7c76a96a82ec728a2d5c091941c4057ffb25.tar.gz frameworks_av-0c7c7c76a96a82ec728a2d5c091941c4057ffb25.tar.bz2 |
MTP: Improve MtpProperty logging support
Change-Id: I46800b99763edcc5e994d912941f9f5e9b1c94d2
Signed-off-by: Mike Lockwood <lockwood@android.com>
Diffstat (limited to 'media/mtp/MtpProperty.cpp')
-rw-r--r-- | media/mtp/MtpProperty.cpp | 91 |
1 files changed, 88 insertions, 3 deletions
diff --git a/media/mtp/MtpProperty.cpp b/media/mtp/MtpProperty.cpp index 4356a6f..3b38720 100644 --- a/media/mtp/MtpProperty.cpp +++ b/media/mtp/MtpProperty.cpp @@ -17,6 +17,7 @@ #define LOG_TAG "MtpProperty" #include "MtpDataPacket.h" +#include "MtpDebug.h" #include "MtpProperty.h" #include "MtpStringBuffer.h" #include "MtpUtils.h" @@ -317,9 +318,93 @@ void MtpProperty::setFormDateTime() { } void MtpProperty::print() { - LOGV("MtpProperty %04X\n", mCode); - LOGV(" type %04X\n", mType); - LOGV(" writeable %s\n", (mWriteable ? "true" : "false")); + MtpString buffer; + bool deviceProp = isDeviceProperty(); + if (deviceProp) + LOGI(" %s (%04X)", MtpDebug::getDevicePropCodeName(mCode), mCode); + else + LOGI(" %s (%04X)", MtpDebug::getObjectPropCodeName(mCode), mCode); + LOGI(" type %04X", mType); + LOGI(" writeable %s", (mWriteable ? "true" : "false")); + buffer = " default value: "; + print(mDefaultValue, buffer); + LOGI("%s", (const char *)buffer); + if (deviceProp) { + buffer = " current value: "; + print(mCurrentValue, buffer); + LOGI("%s", (const char *)buffer); + } + switch (mFormFlag) { + case kFormNone: + break; + case kFormRange: + buffer = " Range ("; + print(mMinimumValue, buffer); + buffer += ", "; + print(mMaximumValue, buffer); + buffer += ", "; + print(mStepSize, buffer); + LOGI("%s", (const char *)buffer); + break; + case kFormEnum: + buffer = " Enum { "; + for (int i = 0; i < mEnumLength; i++) { + print(mEnumValues[i], buffer); + buffer += " "; + } + buffer += "}"; + LOGI("%s", (const char *)buffer); + break; + case kFormDateTime: + LOGI(" DateTime\n"); + break; + default: + LOGI(" form %d\n", mFormFlag); + break; + } +} + +void MtpProperty::print(MtpPropertyValue& value, MtpString& buffer) { + switch (mType) { + case MTP_TYPE_INT8: + buffer.appendFormat("%d", value.u.i8); + break; + case MTP_TYPE_UINT8: + buffer.appendFormat("%d", value.u.u8); + break; + case MTP_TYPE_INT16: + buffer.appendFormat("%d", value.u.i16); + break; + case MTP_TYPE_UINT16: + buffer.appendFormat("%d", value.u.u16); + break; + case MTP_TYPE_INT32: + buffer.appendFormat("%d", value.u.i32); + break; + case MTP_TYPE_UINT32: + buffer.appendFormat("%d", value.u.u32); + break; + case MTP_TYPE_INT64: + buffer.appendFormat("%lld", value.u.i64); + break; + case MTP_TYPE_UINT64: + buffer.appendFormat("%lld", value.u.u64); + break; + case MTP_TYPE_INT128: + buffer.appendFormat("%08X%08X%08X%08X", value.u.i128[0], value.u.i128[1], + value.u.i128[2], value.u.i128[3]); + break; + case MTP_TYPE_UINT128: + buffer.appendFormat("%08X%08X%08X%08X", value.u.u128[0], value.u.u128[1], + value.u.u128[2], value.u.u128[3]); + break; + case MTP_TYPE_STR: + buffer.appendFormat("%s", value.str); + break; + default: + LOGE("unsupported type for MtpProperty::print\n"); + break; + } } void MtpProperty::readValue(MtpDataPacket& packet, MtpPropertyValue& value) { |