summaryrefslogtreecommitdiffstats
path: root/media/mtp/MtpDevice.cpp
diff options
context:
space:
mode:
authorMike Lockwood <lockwood@android.com>2010-12-07 11:24:28 -0800
committerMike Lockwood <lockwood@android.com>2010-12-07 17:13:12 -0800
commit0c7c7c76a96a82ec728a2d5c091941c4057ffb25 (patch)
tree19fc13f9b1d585ee08afe816939c27e5373cb091 /media/mtp/MtpDevice.cpp
parent98693f674125484de8873d969c209276a6dd604b (diff)
downloadframeworks_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/MtpDevice.cpp')
-rw-r--r--media/mtp/MtpDevice.cpp45
1 files changed, 40 insertions, 5 deletions
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);