summaryrefslogtreecommitdiffstats
path: root/media/mtp/MtpDevice.cpp
diff options
context:
space:
mode:
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);