blob: 9ded6e2e4085c54f581873515d689a967b02233e [file] [log] [blame]
Mike Lockwood56118b52010-05-11 17:16:59 -04001/*
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 */
16
17#include "MtpDebug.h"
18
Mike Lockwood8d3257a2010-05-14 10:10:36 -040019namespace android {
Mike Lockwood56118b52010-05-11 17:16:59 -040020
21struct OperationCodeEntry {
22 const char* name;
23 MtpOperationCode code;
24};
25
26static const OperationCodeEntry sOperationCodes[] = {
27 { "MTP_OPERATION_GET_DEVICE_INFO", 0x1001 },
28 { "MTP_OPERATION_OPEN_SESSION", 0x1002 },
29 { "MTP_OPERATION_CLOSE_SESSION", 0x1003 },
30 { "MTP_OPERATION_GET_STORAGE_IDS", 0x1004 },
31 { "MTP_OPERATION_GET_STORAGE_INFO", 0x1005 },
32 { "MTP_OPERATION_GET_NUM_OBJECTS", 0x1006 },
33 { "MTP_OPERATION_GET_OBJECT_HANDLES", 0x1007 },
34 { "MTP_OPERATION_GET_OBJECT_INFO", 0x1008 },
35 { "MTP_OPERATION_GET_OBJECT", 0x1009 },
36 { "MTP_OPERATION_GET_THUMB", 0x100A },
37 { "MTP_OPERATION_DELETE_OBJECT", 0x100B },
38 { "MTP_OPERATION_SEND_OBJECT_INFO", 0x100C },
39 { "MTP_OPERATION_SEND_OBJECT", 0x100D },
40 { "MTP_OPERATION_INITIATE_CAPTURE", 0x100E },
41 { "MTP_OPERATION_FORMAT_STORE", 0x100F },
42 { "MTP_OPERATION_RESET_DEVICE", 0x1010 },
43 { "MTP_OPERATION_SELF_TEST", 0x1011 },
44 { "MTP_OPERATION_SET_OBJECT_PROTECTION", 0x1012 },
45 { "MTP_OPERATION_POWER_DOWN", 0x1013 },
46 { "MTP_OPERATION_GET_DEVICE_PROP_DESC", 0x1014 },
47 { "MTP_OPERATION_GET_DEVICE_PROP_VALUE", 0x1015 },
48 { "MTP_OPERATION_SET_DEVICE_PROP_VALUE", 0x1016 },
49 { "MTP_OPERATION_RESET_DEVICE_PROP_VALUE", 0x1017 },
50 { "MTP_OPERATION_TERMINATE_OPEN_CAPTURE", 0x1018 },
51 { "MTP_OPERATION_MOVE_OBJECT", 0x1019 },
52 { "MTP_OPERATION_COPY_OBJECT", 0x101A },
53 { "MTP_OPERATION_GET_PARTIAL_OBJECT", 0x101B },
54 { "MTP_OPERATION_INITIATE_OPEN_CAPTURE", 0x101C },
55 { "MTP_OPERATION_GET_OBJECT_PROPS_SUPPORTED", 0x9801 },
56 { "MTP_OPERATION_GET_OBJECT_PROP_DESC", 0x9802 },
57 { "MTP_OPERATION_GET_OBJECT_PROP_VALUE", 0x9803 },
58 { "MTP_OPERATION_SET_OBJECT_PROP_VALUE", 0x9804 },
59 { "MTP_OPERATION_GET_OBJECT_REFERENCES", 0x9810 },
60 { "MTP_OPERATION_SET_OBJECT_REFERENCES", 0x9811 },
61 { "MTP_OPERATION_SKIP", 0x9820 },
62 { 0, 0 },
63};
64
65
66const char* MtpDebug::getOperationCodeName(MtpOperationCode code) {
67 const OperationCodeEntry* entry = sOperationCodes;
68 while (entry->name) {
69 if (entry->code == code)
70 return entry->name;
71 entry++;
72 }
73 return "*** UNKNOWN OPERATION ***";
74}
Mike Lockwood8d3257a2010-05-14 10:10:36 -040075
76} // namespace android