bigbiff bigbiff | c7eee6f | 2014-09-02 18:59:01 -0400 | [diff] [blame] | 1 | /* |
| 2 | * Copyright (C) 2010 The Android Open Source Project |
| 3 | * |
| 4 | * Licensed under the Apache License, Version 2.0 (the "License"); |
| 5 | * you may not use this file except in compliance with the License. |
| 6 | * You may obtain a copy of the License at |
| 7 | * |
| 8 | * http://www.apache.org/licenses/LICENSE-2.0 |
| 9 | * |
| 10 | * Unless required by applicable law or agreed to in writing, software |
| 11 | * distributed under the License is distributed on an "AS IS" BASIS, |
| 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 13 | * See the License for the specific language governing permissions and |
| 14 | * limitations under the License. |
| 15 | * Copyright (C) 2014 TeamWin - bigbiff and Dees_Troy mtp database conversion to C++ |
| 16 | * |
| 17 | */ |
| 18 | |
| 19 | #include "MtpDebug.h" |
| 20 | #include <stdarg.h> |
| 21 | #include <stdio.h> |
| 22 | |
| 23 | #define MTP_DEBUG_BUFFER_SIZE 2048 |
Ethan Yonker | 6d154c4 | 2014-09-03 14:19:43 -0500 | [diff] [blame] | 24 | static int debug_enabled = 0; |
bigbiff bigbiff | c7eee6f | 2014-09-02 18:59:01 -0400 | [diff] [blame] | 25 | |
| 26 | extern "C" void mtpdebug(const char *fmt, ...) |
| 27 | { |
Ethan Yonker | 6d154c4 | 2014-09-03 14:19:43 -0500 | [diff] [blame] | 28 | if (debug_enabled) { |
| 29 | char buf[MTP_DEBUG_BUFFER_SIZE]; // We're going to limit a single request to 512 bytes |
bigbiff bigbiff | c7eee6f | 2014-09-02 18:59:01 -0400 | [diff] [blame] | 30 | |
Ethan Yonker | 6d154c4 | 2014-09-03 14:19:43 -0500 | [diff] [blame] | 31 | va_list ap; |
| 32 | va_start(ap, fmt); |
| 33 | vsnprintf(buf, MTP_DEBUG_BUFFER_SIZE, fmt, ap); |
| 34 | va_end(ap); |
bigbiff bigbiff | c7eee6f | 2014-09-02 18:59:01 -0400 | [diff] [blame] | 35 | |
Ethan Yonker | 6d154c4 | 2014-09-03 14:19:43 -0500 | [diff] [blame] | 36 | fputs(buf, stdout); |
| 37 | } |
bigbiff bigbiff | c7eee6f | 2014-09-02 18:59:01 -0400 | [diff] [blame] | 38 | } |
| 39 | |
| 40 | struct CodeEntry { |
| 41 | const char* name; |
| 42 | uint16_t code; |
| 43 | }; |
| 44 | |
| 45 | static const CodeEntry sOperationCodes[] = { |
| 46 | { "MTP_OPERATION_GET_DEVICE_INFO", 0x1001 }, |
| 47 | { "MTP_OPERATION_OPEN_SESSION", 0x1002 }, |
| 48 | { "MTP_OPERATION_CLOSE_SESSION", 0x1003 }, |
| 49 | { "MTP_OPERATION_GET_STORAGE_IDS", 0x1004 }, |
| 50 | { "MTP_OPERATION_GET_STORAGE_INFO", 0x1005 }, |
| 51 | { "MTP_OPERATION_GET_NUM_OBJECTS", 0x1006 }, |
| 52 | { "MTP_OPERATION_GET_OBJECT_HANDLES", 0x1007 }, |
| 53 | { "MTP_OPERATION_GET_OBJECT_INFO", 0x1008 }, |
| 54 | { "MTP_OPERATION_GET_OBJECT", 0x1009 }, |
| 55 | { "MTP_OPERATION_GET_THUMB", 0x100A }, |
| 56 | { "MTP_OPERATION_DELETE_OBJECT", 0x100B }, |
| 57 | { "MTP_OPERATION_SEND_OBJECT_INFO", 0x100C }, |
| 58 | { "MTP_OPERATION_SEND_OBJECT", 0x100D }, |
| 59 | { "MTP_OPERATION_INITIATE_CAPTURE", 0x100E }, |
| 60 | { "MTP_OPERATION_FORMAT_STORE", 0x100F }, |
| 61 | { "MTP_OPERATION_RESET_DEVICE", 0x1010 }, |
| 62 | { "MTP_OPERATION_SELF_TEST", 0x1011 }, |
| 63 | { "MTP_OPERATION_SET_OBJECT_PROTECTION", 0x1012 }, |
| 64 | { "MTP_OPERATION_POWER_DOWN", 0x1013 }, |
| 65 | { "MTP_OPERATION_GET_DEVICE_PROP_DESC", 0x1014 }, |
| 66 | { "MTP_OPERATION_GET_DEVICE_PROP_VALUE", 0x1015 }, |
| 67 | { "MTP_OPERATION_SET_DEVICE_PROP_VALUE", 0x1016 }, |
| 68 | { "MTP_OPERATION_RESET_DEVICE_PROP_VALUE", 0x1017 }, |
| 69 | { "MTP_OPERATION_TERMINATE_OPEN_CAPTURE", 0x1018 }, |
| 70 | { "MTP_OPERATION_MOVE_OBJECT", 0x1019 }, |
| 71 | { "MTP_OPERATION_COPY_OBJECT", 0x101A }, |
| 72 | { "MTP_OPERATION_GET_PARTIAL_OBJECT", 0x101B }, |
| 73 | { "MTP_OPERATION_INITIATE_OPEN_CAPTURE", 0x101C }, |
| 74 | { "MTP_OPERATION_GET_OBJECT_PROPS_SUPPORTED", 0x9801 }, |
| 75 | { "MTP_OPERATION_GET_OBJECT_PROP_DESC", 0x9802 }, |
| 76 | { "MTP_OPERATION_GET_OBJECT_PROP_VALUE", 0x9803 }, |
| 77 | { "MTP_OPERATION_SET_OBJECT_PROP_VALUE", 0x9804 }, |
| 78 | { "MTP_OPERATION_GET_OBJECT_PROP_LIST", 0x9805 }, |
| 79 | { "MTP_OPERATION_SET_OBJECT_PROP_LIST", 0x9806 }, |
| 80 | { "MTP_OPERATION_GET_INTERDEPENDENT_PROP_DESC", 0x9807 }, |
| 81 | { "MTP_OPERATION_SEND_OBJECT_PROP_LIST", 0x9808 }, |
| 82 | { "MTP_OPERATION_GET_OBJECT_REFERENCES", 0x9810 }, |
| 83 | { "MTP_OPERATION_SET_OBJECT_REFERENCES", 0x9811 }, |
| 84 | { "MTP_OPERATION_SKIP", 0x9820 }, |
| 85 | // android extensions |
| 86 | { "MTP_OPERATION_GET_PARTIAL_OBJECT_64", 0x95C1 }, |
| 87 | { "MTP_OPERATION_SEND_PARTIAL_OBJECT", 0x95C2 }, |
| 88 | { "MTP_OPERATION_TRUNCATE_OBJECT", 0x95C3 }, |
| 89 | { "MTP_OPERATION_BEGIN_EDIT_OBJECT", 0x95C4 }, |
| 90 | { "MTP_OPERATION_END_EDIT_OBJECT", 0x95C5 }, |
| 91 | { 0, 0 }, |
| 92 | }; |
| 93 | |
| 94 | static const CodeEntry sFormatCodes[] = { |
| 95 | { "MTP_FORMAT_UNDEFINED", 0x3000 }, |
| 96 | { "MTP_FORMAT_ASSOCIATION", 0x3001 }, |
| 97 | { "MTP_FORMAT_SCRIPT", 0x3002 }, |
| 98 | { "MTP_FORMAT_EXECUTABLE", 0x3003 }, |
| 99 | { "MTP_FORMAT_TEXT", 0x3004 }, |
| 100 | { "MTP_FORMAT_HTML", 0x3005 }, |
| 101 | { "MTP_FORMAT_DPOF", 0x3006 }, |
| 102 | { "MTP_FORMAT_AIFF", 0x3007 }, |
| 103 | { "MTP_FORMAT_WAV", 0x3008 }, |
| 104 | { "MTP_FORMAT_MP3", 0x3009 }, |
| 105 | { "MTP_FORMAT_AVI", 0x300A }, |
| 106 | { "MTP_FORMAT_MPEG", 0x300B }, |
| 107 | { "MTP_FORMAT_ASF", 0x300C }, |
| 108 | { "MTP_FORMAT_DEFINED", 0x3800 }, |
| 109 | { "MTP_FORMAT_EXIF_JPEG", 0x3801 }, |
| 110 | { "MTP_FORMAT_TIFF_EP", 0x3802 }, |
| 111 | { "MTP_FORMAT_FLASHPIX", 0x3803 }, |
| 112 | { "MTP_FORMAT_BMP", 0x3804 }, |
| 113 | { "MTP_FORMAT_CIFF", 0x3805 }, |
| 114 | { "MTP_FORMAT_GIF", 0x3807 }, |
| 115 | { "MTP_FORMAT_JFIF", 0x3808 }, |
| 116 | { "MTP_FORMAT_CD", 0x3809 }, |
| 117 | { "MTP_FORMAT_PICT", 0x380A }, |
| 118 | { "MTP_FORMAT_PNG", 0x380B }, |
| 119 | { "MTP_FORMAT_TIFF", 0x380D }, |
| 120 | { "MTP_FORMAT_TIFF_IT", 0x380E }, |
| 121 | { "MTP_FORMAT_JP2", 0x380F }, |
| 122 | { "MTP_FORMAT_JPX", 0x3810 }, |
| 123 | { "MTP_FORMAT_UNDEFINED_FIRMWARE", 0xB802 }, |
| 124 | { "MTP_FORMAT_WINDOWS_IMAGE_FORMAT", 0xB881 }, |
| 125 | { "MTP_FORMAT_UNDEFINED_AUDIO", 0xB900 }, |
| 126 | { "MTP_FORMAT_WMA", 0xB901 }, |
| 127 | { "MTP_FORMAT_OGG", 0xB902 }, |
| 128 | { "MTP_FORMAT_AAC", 0xB903 }, |
| 129 | { "MTP_FORMAT_AUDIBLE", 0xB904 }, |
| 130 | { "MTP_FORMAT_FLAC", 0xB906 }, |
| 131 | { "MTP_FORMAT_UNDEFINED_VIDEO", 0xB980 }, |
| 132 | { "MTP_FORMAT_WMV", 0xB981 }, |
| 133 | { "MTP_FORMAT_MP4_CONTAINER", 0xB982 }, |
| 134 | { "MTP_FORMAT_MP2", 0xB983 }, |
| 135 | { "MTP_FORMAT_3GP_CONTAINER", 0xB984 }, |
| 136 | { "MTP_FORMAT_UNDEFINED_COLLECTION", 0xBA00 }, |
| 137 | { "MTP_FORMAT_ABSTRACT_MULTIMEDIA_ALBUM", 0xBA01 }, |
| 138 | { "MTP_FORMAT_ABSTRACT_IMAGE_ALBUM", 0xBA02 }, |
| 139 | { "MTP_FORMAT_ABSTRACT_AUDIO_ALBUM", 0xBA03 }, |
| 140 | { "MTP_FORMAT_ABSTRACT_VIDEO_ALBUM", 0xBA04 }, |
| 141 | { "MTP_FORMAT_ABSTRACT_AV_PLAYLIST", 0xBA05 }, |
| 142 | { "MTP_FORMAT_ABSTRACT_CONTACT_GROUP", 0xBA06 }, |
| 143 | { "MTP_FORMAT_ABSTRACT_MESSAGE_FOLDER", 0xBA07 }, |
| 144 | { "MTP_FORMAT_ABSTRACT_CHAPTERED_PRODUCTION", 0xBA08 }, |
| 145 | { "MTP_FORMAT_ABSTRACT_AUDIO_PLAYLIST", 0xBA09 }, |
| 146 | { "MTP_FORMAT_ABSTRACT_VIDEO_PLAYLIST", 0xBA0A }, |
| 147 | { "MTP_FORMAT_ABSTRACT_MEDIACAST", 0xBA0B }, |
| 148 | { "MTP_FORMAT_WPL_PLAYLIST", 0xBA10 }, |
| 149 | { "MTP_FORMAT_M3U_PLAYLIST", 0xBA11 }, |
| 150 | { "MTP_FORMAT_MPL_PLAYLIST", 0xBA12 }, |
| 151 | { "MTP_FORMAT_ASX_PLAYLIST", 0xBA13 }, |
| 152 | { "MTP_FORMAT_PLS_PLAYLIST", 0xBA14 }, |
| 153 | { "MTP_FORMAT_UNDEFINED_DOCUMENT", 0xBA80 }, |
| 154 | { "MTP_FORMAT_ABSTRACT_DOCUMENT", 0xBA81 }, |
| 155 | { "MTP_FORMAT_XML_DOCUMENT", 0xBA82 }, |
| 156 | { "MTP_FORMAT_MS_WORD_DOCUMENT", 0xBA83 }, |
| 157 | { "MTP_FORMAT_MHT_COMPILED_HTML_DOCUMENT", 0xBA84 }, |
| 158 | { "MTP_FORMAT_MS_EXCEL_SPREADSHEET", 0xBA85 }, |
| 159 | { "MTP_FORMAT_MS_POWERPOINT_PRESENTATION", 0xBA86 }, |
| 160 | { "MTP_FORMAT_UNDEFINED_MESSAGE", 0xBB00 }, |
| 161 | { "MTP_FORMAT_ABSTRACT_MESSSAGE", 0xBB01 }, |
| 162 | { "MTP_FORMAT_UNDEFINED_CONTACT", 0xBB80 }, |
| 163 | { "MTP_FORMAT_ABSTRACT_CONTACT", 0xBB81 }, |
| 164 | { "MTP_FORMAT_VCARD_2", 0xBB82 }, |
| 165 | { 0, 0 }, |
| 166 | }; |
| 167 | |
| 168 | static const CodeEntry sObjectPropCodes[] = { |
| 169 | { "MTP_PROPERTY_STORAGE_ID", 0xDC01 }, |
| 170 | { "MTP_PROPERTY_OBJECT_FORMAT", 0xDC02 }, |
| 171 | { "MTP_PROPERTY_PROTECTION_STATUS", 0xDC03 }, |
| 172 | { "MTP_PROPERTY_OBJECT_SIZE", 0xDC04 }, |
| 173 | { "MTP_PROPERTY_ASSOCIATION_TYPE", 0xDC05 }, |
| 174 | { "MTP_PROPERTY_ASSOCIATION_DESC", 0xDC06 }, |
| 175 | { "MTP_PROPERTY_OBJECT_FILE_NAME", 0xDC07 }, |
| 176 | { "MTP_PROPERTY_DATE_CREATED", 0xDC08 }, |
| 177 | { "MTP_PROPERTY_DATE_MODIFIED", 0xDC09 }, |
| 178 | { "MTP_PROPERTY_KEYWORDS", 0xDC0A }, |
| 179 | { "MTP_PROPERTY_PARENT_OBJECT", 0xDC0B }, |
| 180 | { "MTP_PROPERTY_ALLOWED_FOLDER_CONTENTS", 0xDC0C }, |
| 181 | { "MTP_PROPERTY_HIDDEN", 0xDC0D }, |
| 182 | { "MTP_PROPERTY_SYSTEM_OBJECT", 0xDC0E }, |
| 183 | { "MTP_PROPERTY_PERSISTENT_UID", 0xDC41 }, |
| 184 | { "MTP_PROPERTY_SYNC_ID", 0xDC42 }, |
| 185 | { "MTP_PROPERTY_PROPERTY_BAG", 0xDC43 }, |
| 186 | { "MTP_PROPERTY_NAME", 0xDC44 }, |
| 187 | { "MTP_PROPERTY_CREATED_BY", 0xDC45 }, |
| 188 | { "MTP_PROPERTY_ARTIST", 0xDC46 }, |
| 189 | { "MTP_PROPERTY_DATE_AUTHORED", 0xDC47 }, |
| 190 | { "MTP_PROPERTY_DESCRIPTION", 0xDC48 }, |
| 191 | { "MTP_PROPERTY_URL_REFERENCE", 0xDC49 }, |
| 192 | { "MTP_PROPERTY_LANGUAGE_LOCALE", 0xDC4A }, |
| 193 | { "MTP_PROPERTY_COPYRIGHT_INFORMATION", 0xDC4B }, |
| 194 | { "MTP_PROPERTY_SOURCE", 0xDC4C }, |
| 195 | { "MTP_PROPERTY_ORIGIN_LOCATION", 0xDC4D }, |
| 196 | { "MTP_PROPERTY_DATE_ADDED", 0xDC4E }, |
| 197 | { "MTP_PROPERTY_NON_CONSUMABLE", 0xDC4F }, |
| 198 | { "MTP_PROPERTY_CORRUPT_UNPLAYABLE", 0xDC50 }, |
| 199 | { "MTP_PROPERTY_PRODUCER_SERIAL_NUMBER", 0xDC51 }, |
| 200 | { "MTP_PROPERTY_REPRESENTATIVE_SAMPLE_FORMAT", 0xDC81 }, |
| 201 | { "MTP_PROPERTY_REPRESENTATIVE_SAMPLE_SIZE", 0xDC82 }, |
| 202 | { "MTP_PROPERTY_REPRESENTATIVE_SAMPLE_HEIGHT", 0xDC83 }, |
| 203 | { "MTP_PROPERTY_REPRESENTATIVE_SAMPLE_WIDTH", 0xDC84 }, |
| 204 | { "MTP_PROPERTY_REPRESENTATIVE_SAMPLE_DURATION", 0xDC85 }, |
| 205 | { "MTP_PROPERTY_REPRESENTATIVE_SAMPLE_DATA", 0xDC86 }, |
| 206 | { "MTP_PROPERTY_WIDTH", 0xDC87 }, |
| 207 | { "MTP_PROPERTY_HEIGHT", 0xDC88 }, |
| 208 | { "MTP_PROPERTY_DURATION", 0xDC89 }, |
| 209 | { "MTP_PROPERTY_RATING", 0xDC8A }, |
| 210 | { "MTP_PROPERTY_TRACK", 0xDC8B }, |
| 211 | { "MTP_PROPERTY_GENRE", 0xDC8C }, |
| 212 | { "MTP_PROPERTY_CREDITS", 0xDC8D }, |
| 213 | { "MTP_PROPERTY_LYRICS", 0xDC8E }, |
| 214 | { "MTP_PROPERTY_SUBSCRIPTION_CONTENT_ID", 0xDC8F }, |
| 215 | { "MTP_PROPERTY_PRODUCED_BY", 0xDC90 }, |
| 216 | { "MTP_PROPERTY_USE_COUNT", 0xDC91 }, |
| 217 | { "MTP_PROPERTY_SKIP_COUNT", 0xDC92 }, |
| 218 | { "MTP_PROPERTY_LAST_ACCESSED", 0xDC93 }, |
| 219 | { "MTP_PROPERTY_PARENTAL_RATING", 0xDC94 }, |
| 220 | { "MTP_PROPERTY_META_GENRE", 0xDC95 }, |
| 221 | { "MTP_PROPERTY_COMPOSER", 0xDC96 }, |
| 222 | { "MTP_PROPERTY_EFFECTIVE_RATING", 0xDC97 }, |
| 223 | { "MTP_PROPERTY_SUBTITLE", 0xDC98 }, |
| 224 | { "MTP_PROPERTY_ORIGINAL_RELEASE_DATE", 0xDC99 }, |
| 225 | { "MTP_PROPERTY_ALBUM_NAME", 0xDC9A }, |
| 226 | { "MTP_PROPERTY_ALBUM_ARTIST", 0xDC9B }, |
| 227 | { "MTP_PROPERTY_MOOD", 0xDC9C }, |
| 228 | { "MTP_PROPERTY_DRM_STATUS", 0xDC9D }, |
| 229 | { "MTP_PROPERTY_SUB_DESCRIPTION", 0xDC9E }, |
| 230 | { "MTP_PROPERTY_IS_CROPPED", 0xDCD1 }, |
| 231 | { "MTP_PROPERTY_IS_COLOUR_CORRECTED", 0xDCD2 }, |
| 232 | { "MTP_PROPERTY_IMAGE_BIT_DEPTH", 0xDCD3 }, |
| 233 | { "MTP_PROPERTY_F_NUMBER", 0xDCD4 }, |
| 234 | { "MTP_PROPERTY_EXPOSURE_TIME", 0xDCD5 }, |
| 235 | { "MTP_PROPERTY_EXPOSURE_INDEX", 0xDCD6 }, |
| 236 | { "MTP_PROPERTY_TOTAL_BITRATE", 0xDE91 }, |
| 237 | { "MTP_PROPERTY_BITRATE_TYPE", 0xDE92 }, |
| 238 | { "MTP_PROPERTY_SAMPLE_RATE", 0xDE93 }, |
| 239 | { "MTP_PROPERTY_NUMBER_OF_CHANNELS", 0xDE94 }, |
| 240 | { "MTP_PROPERTY_AUDIO_BIT_DEPTH", 0xDE95 }, |
| 241 | { "MTP_PROPERTY_SCAN_TYPE", 0xDE97 }, |
| 242 | { "MTP_PROPERTY_AUDIO_WAVE_CODEC", 0xDE99 }, |
| 243 | { "MTP_PROPERTY_AUDIO_BITRATE", 0xDE9A }, |
| 244 | { "MTP_PROPERTY_VIDEO_FOURCC_CODEC", 0xDE9B }, |
| 245 | { "MTP_PROPERTY_VIDEO_BITRATE", 0xDE9C }, |
| 246 | { "MTP_PROPERTY_FRAMES_PER_THOUSAND_SECONDS", 0xDE9D }, |
| 247 | { "MTP_PROPERTY_KEYFRAME_DISTANCE", 0xDE9E }, |
| 248 | { "MTP_PROPERTY_BUFFER_SIZE", 0xDE9F }, |
| 249 | { "MTP_PROPERTY_ENCODING_QUALITY", 0xDEA0 }, |
| 250 | { "MTP_PROPERTY_ENCODING_PROFILE", 0xDEA1 }, |
| 251 | { "MTP_PROPERTY_DISPLAY_NAME", 0xDCE0 }, |
| 252 | { "MTP_PROPERTY_BODY_TEXT", 0xDCE1 }, |
| 253 | { "MTP_PROPERTY_SUBJECT", 0xDCE2 }, |
| 254 | { "MTP_PROPERTY_PRIORITY", 0xDCE3 }, |
| 255 | { "MTP_PROPERTY_GIVEN_NAME", 0xDD00 }, |
| 256 | { "MTP_PROPERTY_MIDDLE_NAMES", 0xDD01 }, |
| 257 | { "MTP_PROPERTY_FAMILY_NAME", 0xDD02 }, |
| 258 | { "MTP_PROPERTY_PREFIX", 0xDD03 }, |
| 259 | { "MTP_PROPERTY_SUFFIX", 0xDD04 }, |
| 260 | { "MTP_PROPERTY_PHONETIC_GIVEN_NAME", 0xDD05 }, |
| 261 | { "MTP_PROPERTY_PHONETIC_FAMILY_NAME", 0xDD06 }, |
| 262 | { "MTP_PROPERTY_EMAIL_PRIMARY", 0xDD07 }, |
| 263 | { "MTP_PROPERTY_EMAIL_PERSONAL_1", 0xDD08 }, |
| 264 | { "MTP_PROPERTY_EMAIL_PERSONAL_2", 0xDD09 }, |
| 265 | { "MTP_PROPERTY_EMAIL_BUSINESS_1", 0xDD0A }, |
| 266 | { "MTP_PROPERTY_EMAIL_BUSINESS_2", 0xDD0B }, |
| 267 | { "MTP_PROPERTY_EMAIL_OTHERS", 0xDD0C }, |
| 268 | { "MTP_PROPERTY_PHONE_NUMBER_PRIMARY", 0xDD0D }, |
| 269 | { "MTP_PROPERTY_PHONE_NUMBER_PERSONAL", 0xDD0E }, |
| 270 | { "MTP_PROPERTY_PHONE_NUMBER_PERSONAL_2", 0xDD0F }, |
| 271 | { "MTP_PROPERTY_PHONE_NUMBER_BUSINESS", 0xDD10 }, |
| 272 | { "MTP_PROPERTY_PHONE_NUMBER_BUSINESS_2", 0xDD11 }, |
| 273 | { "MTP_PROPERTY_PHONE_NUMBER_MOBILE", 0xDD12 }, |
| 274 | { "MTP_PROPERTY_PHONE_NUMBER_MOBILE_2", 0xDD13 }, |
| 275 | { "MTP_PROPERTY_FAX_NUMBER_PRIMARY", 0xDD14 }, |
| 276 | { "MTP_PROPERTY_FAX_NUMBER_PERSONAL", 0xDD15 }, |
| 277 | { "MTP_PROPERTY_FAX_NUMBER_BUSINESS", 0xDD16 }, |
| 278 | { "MTP_PROPERTY_PAGER_NUMBER", 0xDD17 }, |
| 279 | { "MTP_PROPERTY_PHONE_NUMBER_OTHERS", 0xDD18 }, |
| 280 | { "MTP_PROPERTY_PRIMARY_WEB_ADDRESS", 0xDD19 }, |
| 281 | { "MTP_PROPERTY_PERSONAL_WEB_ADDRESS", 0xDD1A }, |
| 282 | { "MTP_PROPERTY_BUSINESS_WEB_ADDRESS", 0xDD1B }, |
| 283 | { "MTP_PROPERTY_INSTANT_MESSANGER_ADDRESS", 0xDD1C }, |
| 284 | { "MTP_PROPERTY_INSTANT_MESSANGER_ADDRESS_2", 0xDD1D }, |
| 285 | { "MTP_PROPERTY_INSTANT_MESSANGER_ADDRESS_3", 0xDD1E }, |
| 286 | { "MTP_PROPERTY_POSTAL_ADDRESS_PERSONAL_FULL", 0xDD1F }, |
| 287 | { "MTP_PROPERTY_POSTAL_ADDRESS_PERSONAL_LINE_1", 0xDD20 }, |
| 288 | { "MTP_PROPERTY_POSTAL_ADDRESS_PERSONAL_LINE_2", 0xDD21 }, |
| 289 | { "MTP_PROPERTY_POSTAL_ADDRESS_PERSONAL_CITY", 0xDD22 }, |
| 290 | { "MTP_PROPERTY_POSTAL_ADDRESS_PERSONAL_REGION", 0xDD23 }, |
| 291 | { "MTP_PROPERTY_POSTAL_ADDRESS_PERSONAL_POSTAL_CODE", 0xDD24 }, |
| 292 | { "MTP_PROPERTY_POSTAL_ADDRESS_PERSONAL_COUNTRY", 0xDD25 }, |
| 293 | { "MTP_PROPERTY_POSTAL_ADDRESS_BUSINESS_FULL", 0xDD26 }, |
| 294 | { "MTP_PROPERTY_POSTAL_ADDRESS_BUSINESS_LINE_1", 0xDD27 }, |
| 295 | { "MTP_PROPERTY_POSTAL_ADDRESS_BUSINESS_LINE_2", 0xDD28 }, |
| 296 | { "MTP_PROPERTY_POSTAL_ADDRESS_BUSINESS_CITY", 0xDD29 }, |
| 297 | { "MTP_PROPERTY_POSTAL_ADDRESS_BUSINESS_REGION", 0xDD2A }, |
| 298 | { "MTP_PROPERTY_POSTAL_ADDRESS_BUSINESS_POSTAL_CODE", 0xDD2B }, |
| 299 | { "MTP_PROPERTY_POSTAL_ADDRESS_BUSINESS_COUNTRY", 0xDD2C }, |
| 300 | { "MTP_PROPERTY_POSTAL_ADDRESS_OTHER_FULL", 0xDD2D }, |
| 301 | { "MTP_PROPERTY_POSTAL_ADDRESS_OTHER_LINE_1", 0xDD2E }, |
| 302 | { "MTP_PROPERTY_POSTAL_ADDRESS_OTHER_LINE_2", 0xDD2F }, |
| 303 | { "MTP_PROPERTY_POSTAL_ADDRESS_OTHER_CITY", 0xDD30 }, |
| 304 | { "MTP_PROPERTY_POSTAL_ADDRESS_OTHER_REGION", 0xDD31 }, |
| 305 | { "MTP_PROPERTY_POSTAL_ADDRESS_OTHER_POSTAL_CODE", 0xDD32 }, |
| 306 | { "MTP_PROPERTY_POSTAL_ADDRESS_OTHER_COUNTRY", 0xDD33 }, |
| 307 | { "MTP_PROPERTY_ORGANIZATION_NAME", 0xDD34 }, |
| 308 | { "MTP_PROPERTY_PHONETIC_ORGANIZATION_NAME", 0xDD35 }, |
| 309 | { "MTP_PROPERTY_ROLE", 0xDD36 }, |
| 310 | { "MTP_PROPERTY_BIRTHDATE", 0xDD37 }, |
| 311 | { "MTP_PROPERTY_MESSAGE_TO", 0xDD40 }, |
| 312 | { "MTP_PROPERTY_MESSAGE_CC", 0xDD41 }, |
| 313 | { "MTP_PROPERTY_MESSAGE_BCC", 0xDD42 }, |
| 314 | { "MTP_PROPERTY_MESSAGE_READ", 0xDD43 }, |
| 315 | { "MTP_PROPERTY_MESSAGE_RECEIVED_TIME", 0xDD44 }, |
| 316 | { "MTP_PROPERTY_MESSAGE_SENDER", 0xDD45 }, |
| 317 | { "MTP_PROPERTY_ACTIVITY_BEGIN_TIME", 0xDD50 }, |
| 318 | { "MTP_PROPERTY_ACTIVITY_END_TIME", 0xDD51 }, |
| 319 | { "MTP_PROPERTY_ACTIVITY_LOCATION", 0xDD52 }, |
| 320 | { "MTP_PROPERTY_ACTIVITY_REQUIRED_ATTENDEES", 0xDD54 }, |
| 321 | { "MTP_PROPERTY_ACTIVITY_OPTIONAL_ATTENDEES", 0xDD55 }, |
| 322 | { "MTP_PROPERTY_ACTIVITY_RESOURCES", 0xDD56 }, |
| 323 | { "MTP_PROPERTY_ACTIVITY_ACCEPTED", 0xDD57 }, |
| 324 | { "MTP_PROPERTY_ACTIVITY_TENTATIVE", 0xDD58 }, |
| 325 | { "MTP_PROPERTY_ACTIVITY_DECLINED", 0xDD59 }, |
| 326 | { "MTP_PROPERTY_ACTIVITY_REMAINDER_TIME", 0xDD5A }, |
| 327 | { "MTP_PROPERTY_ACTIVITY_OWNER", 0xDD5B }, |
| 328 | { "MTP_PROPERTY_ACTIVITY_STATUS", 0xDD5C }, |
| 329 | { "MTP_PROPERTY_OWNER", 0xDD5D }, |
| 330 | { "MTP_PROPERTY_EDITOR", 0xDD5E }, |
| 331 | { "MTP_PROPERTY_WEBMASTER", 0xDD5F }, |
| 332 | { "MTP_PROPERTY_URL_SOURCE", 0xDD60 }, |
| 333 | { "MTP_PROPERTY_URL_DESTINATION", 0xDD61 }, |
| 334 | { "MTP_PROPERTY_TIME_BOOKMARK", 0xDD62 }, |
| 335 | { "MTP_PROPERTY_OBJECT_BOOKMARK", 0xDD63 }, |
| 336 | { "MTP_PROPERTY_BYTE_BOOKMARK", 0xDD64 }, |
| 337 | { "MTP_PROPERTY_LAST_BUILD_DATE", 0xDD70 }, |
| 338 | { "MTP_PROPERTY_TIME_TO_LIVE", 0xDD71 }, |
| 339 | { "MTP_PROPERTY_MEDIA_GUID", 0xDD72 }, |
| 340 | { 0, 0 }, |
| 341 | }; |
| 342 | |
| 343 | static const CodeEntry sDevicePropCodes[] = { |
| 344 | { "MTP_DEVICE_PROPERTY_UNDEFINED", 0x5000 }, |
| 345 | { "MTP_DEVICE_PROPERTY_BATTERY_LEVEL", 0x5001 }, |
| 346 | { "MTP_DEVICE_PROPERTY_FUNCTIONAL_MODE", 0x5002 }, |
| 347 | { "MTP_DEVICE_PROPERTY_IMAGE_SIZE", 0x5003 }, |
| 348 | { "MTP_DEVICE_PROPERTY_COMPRESSION_SETTING", 0x5004 }, |
| 349 | { "MTP_DEVICE_PROPERTY_WHITE_BALANCE", 0x5005 }, |
| 350 | { "MTP_DEVICE_PROPERTY_RGB_GAIN", 0x5006 }, |
| 351 | { "MTP_DEVICE_PROPERTY_F_NUMBER", 0x5007 }, |
| 352 | { "MTP_DEVICE_PROPERTY_FOCAL_LENGTH", 0x5008 }, |
| 353 | { "MTP_DEVICE_PROPERTY_FOCUS_DISTANCE", 0x5009 }, |
| 354 | { "MTP_DEVICE_PROPERTY_FOCUS_MODE", 0x500A }, |
| 355 | { "MTP_DEVICE_PROPERTY_EXPOSURE_METERING_MODE", 0x500B }, |
| 356 | { "MTP_DEVICE_PROPERTY_FLASH_MODE", 0x500C }, |
| 357 | { "MTP_DEVICE_PROPERTY_EXPOSURE_TIME", 0x500D }, |
| 358 | { "MTP_DEVICE_PROPERTY_EXPOSURE_PROGRAM_MODE", 0x500E }, |
| 359 | { "MTP_DEVICE_PROPERTY_EXPOSURE_INDEX", 0x500F }, |
| 360 | { "MTP_DEVICE_PROPERTY_EXPOSURE_BIAS_COMPENSATION", 0x5010 }, |
| 361 | { "MTP_DEVICE_PROPERTY_DATETIME", 0x5011 }, |
| 362 | { "MTP_DEVICE_PROPERTY_CAPTURE_DELAY", 0x5012 }, |
| 363 | { "MTP_DEVICE_PROPERTY_STILL_CAPTURE_MODE", 0x5013 }, |
| 364 | { "MTP_DEVICE_PROPERTY_CONTRAST", 0x5014 }, |
| 365 | { "MTP_DEVICE_PROPERTY_SHARPNESS", 0x5015 }, |
| 366 | { "MTP_DEVICE_PROPERTY_DIGITAL_ZOOM", 0x5016 }, |
| 367 | { "MTP_DEVICE_PROPERTY_EFFECT_MODE", 0x5017 }, |
| 368 | { "MTP_DEVICE_PROPERTY_BURST_NUMBER", 0x5018 }, |
| 369 | { "MTP_DEVICE_PROPERTY_BURST_INTERVAL", 0x5019 }, |
| 370 | { "MTP_DEVICE_PROPERTY_TIMELAPSE_NUMBER", 0x501A }, |
| 371 | { "MTP_DEVICE_PROPERTY_TIMELAPSE_INTERVAL", 0x501B }, |
| 372 | { "MTP_DEVICE_PROPERTY_FOCUS_METERING_MODE", 0x501C }, |
| 373 | { "MTP_DEVICE_PROPERTY_UPLOAD_URL", 0x501D }, |
| 374 | { "MTP_DEVICE_PROPERTY_ARTIST", 0x501E }, |
| 375 | { "MTP_DEVICE_PROPERTY_COPYRIGHT_INFO", 0x501F }, |
| 376 | { "MTP_DEVICE_PROPERTY_SYNCHRONIZATION_PARTNER", 0xD401 }, |
| 377 | { "MTP_DEVICE_PROPERTY_DEVICE_FRIENDLY_NAME", 0xD402 }, |
| 378 | { "MTP_DEVICE_PROPERTY_VOLUME", 0xD403 }, |
| 379 | { "MTP_DEVICE_PROPERTY_SUPPORTED_FORMATS_ORDERED", 0xD404 }, |
| 380 | { "MTP_DEVICE_PROPERTY_DEVICE_ICON", 0xD405 }, |
| 381 | { "MTP_DEVICE_PROPERTY_PLAYBACK_RATE", 0xD410 }, |
| 382 | { "MTP_DEVICE_PROPERTY_PLAYBACK_OBJECT", 0xD411 }, |
| 383 | { "MTP_DEVICE_PROPERTY_PLAYBACK_CONTAINER_INDEX", 0xD412 }, |
| 384 | { "MTP_DEVICE_PROPERTY_SESSION_INITIATOR_VERSION_INFO", 0xD406 }, |
| 385 | { "MTP_DEVICE_PROPERTY_PERCEIVED_DEVICE_TYPE", 0xD407 }, |
| 386 | { 0, 0 }, |
| 387 | }; |
| 388 | |
| 389 | static const char* getCodeName(uint16_t code, const CodeEntry* table) { |
| 390 | const CodeEntry* entry = table; |
| 391 | while (entry->name) { |
| 392 | if (entry->code == code) |
| 393 | return entry->name; |
| 394 | entry++; |
| 395 | } |
| 396 | return "UNKNOWN"; |
| 397 | } |
| 398 | |
| 399 | const char* MtpDebug::getOperationCodeName(MtpOperationCode code) { |
| 400 | return getCodeName(code, sOperationCodes); |
| 401 | } |
| 402 | |
| 403 | const char* MtpDebug::getFormatCodeName(MtpObjectFormat code) { |
| 404 | if (code == 0) |
| 405 | return "NONE"; |
| 406 | return getCodeName(code, sFormatCodes); |
| 407 | } |
| 408 | |
| 409 | const char* MtpDebug::getObjectPropCodeName(MtpPropertyCode code) { |
| 410 | if (code == 0) |
| 411 | return "NONE"; |
| 412 | return getCodeName(code, sObjectPropCodes); |
| 413 | } |
| 414 | |
| 415 | const char* MtpDebug::getDevicePropCodeName(MtpPropertyCode code) { |
| 416 | if (code == 0) |
| 417 | return "NONE"; |
| 418 | return getCodeName(code, sDevicePropCodes); |
| 419 | } |
Ethan Yonker | 6d154c4 | 2014-09-03 14:19:43 -0500 | [diff] [blame] | 420 | |
| 421 | void MtpDebug::enableDebug(void) { |
| 422 | debug_enabled = 1; |
| 423 | MTPD("MTP debug logging enabled\n"); |
| 424 | } |