From 0c7c7c76a96a82ec728a2d5c091941c4057ffb25 Mon Sep 17 00:00:00 2001 From: Mike Lockwood Date: Tue, 7 Dec 2010 11:24:28 -0800 Subject: MTP: Improve MtpProperty logging support Change-Id: I46800b99763edcc5e994d912941f9f5e9b1c94d2 Signed-off-by: Mike Lockwood --- media/mtp/MtpDevice.cpp | 45 ++++++++++++++++++++++++++++++++++++++++----- 1 file changed, 40 insertions(+), 5 deletions(-) (limited to 'media/mtp/MtpDevice.cpp') diff --git a/media/mtp/MtpDevice.cpp b/media/mtp/MtpDevice.cpp index a4d29a7..8d682ce 100644 --- a/media/mtp/MtpDevice.cpp +++ b/media/mtp/MtpDevice.cpp @@ -63,17 +63,13 @@ void MtpDevice::initialize() { openSession(); mDeviceInfo = getDeviceInfo(); if (mDeviceInfo) { - mDeviceInfo->print(); - if (mDeviceInfo->mDeviceProperties) { int count = mDeviceInfo->mDeviceProperties->size(); for (int i = 0; i < count; i++) { MtpDeviceProperty propCode = (*mDeviceInfo->mDeviceProperties)[i]; MtpProperty* property = getDevicePropDesc(propCode); - if (property) { - property->print(); + if (property) mDeviceProperties.push(property); - } } } } @@ -87,6 +83,45 @@ void MtpDevice::close() { } } +void MtpDevice::print() { + if (mDeviceInfo) { + mDeviceInfo->print(); + + if (mDeviceInfo->mDeviceProperties) { + LOGI("***** DEVICE PROPERTIES *****\n"); + int count = mDeviceInfo->mDeviceProperties->size(); + for (int i = 0; i < count; i++) { + MtpDeviceProperty propCode = (*mDeviceInfo->mDeviceProperties)[i]; + MtpProperty* property = getDevicePropDesc(propCode); + if (property) { + property->print(); + } + } + } + } + + if (mDeviceInfo->mPlaybackFormats) { + LOGI("***** OBJECT PROPERTIES *****\n"); + int count = mDeviceInfo->mPlaybackFormats->size(); + for (int i = 0; i < count; i++) { + MtpObjectFormat format = (*mDeviceInfo->mPlaybackFormats)[i]; + LOGI("*** FORMAT: %s\n", MtpDebug::getFormatCodeName(format)); + MtpObjectPropertyList* props = getObjectPropsSupported(format); + if (props) { + for (int j = 0; j < props->size(); j++) { + MtpObjectProperty prop = (*props)[j]; + MtpProperty* property = getObjectPropDesc(prop); + if (property) + property->print(); + else + LOGE("could not fetch property: %s", + MtpDebug::getObjectPropCodeName(prop)); + } + } + } + } +} + const char* MtpDevice::getDeviceName() { if (mDevice) return usb_device_get_name(mDevice); -- cgit v1.1