2 * Copyright (c) 2012, 2013 Samsung Electronics Co., Ltd.
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
8 * http://www.apache.org/licenses/LICENSE-2.0
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.
21 #include "mtp_config.h"
22 #include "mtp_datatype.h"
25 #define LOG_TAG "MTP-RESPONDER"
29 #define FIND_CMD_LEN 300
30 #define FIND_CMD "/usr/bin/find %s \\( -iname '*.jpg' -o -iname '*.gif' " \
31 "-o -iname '*.exif' -o -iname '*.png' " \
32 "-o -iname '*.mpeg' -o -iname '*.asf' " \
33 "-o -iname '*.wmv' -o -iname '*.avi' -o -iname '*.wma' " \
34 "-o -iname '*.mp3' \\) -mmin -%d >> %s"
36 #define DBG(format, args...) SLOGD(format, ##args)
37 #define ERR(format, args...) SLOGE(format, ##args)
38 #define DBG_SECURE(format, args...) SECURE_SLOGD(format, ##args)
39 #define ERR_SECURE(format, args...) SECURE_SLOGE(format, ##args)
41 #define ret_if(expr) \
49 #define retv_if(expr, val) \
57 #define retm_if(expr, fmt, arg...) \
65 #define retvm_if(expr, val, fmt, arg...) \
74 MTP_PHONE_USB_CONNECTED = 0,
75 MTP_PHONE_USB_DISCONNECTED,
76 MTP_PHONE_MMC_INSERTED,
78 MTP_PHONE_USB_MODE_OTHER,
84 phone_status_t mmc_state;
85 phone_status_t usb_state;
86 phone_status_t usb_mode_state;
87 phone_status_t lock_state;
99 MTP_STATE_STOPPED = 0, /* stopped working */
100 MTP_STATE_INITIALIZING, /* initializing device or enumerating*/
101 MTP_STATE_READY_SERVICE, /* ready to handle commands */
102 MTP_STATE_ONSERVICE, /* handling a command */
103 MTP_STATE_DATA_TRANSFER_DL, /* file downloading */
104 MTP_STATE_DATA_PROCESSING /* data processing */
108 * PTP Cancellation Request
109 * mtp_uint16 io_code : Identifier for cancellation.
110 * This must equal USB_PTPCANCELIO_ID.
111 * mtp_uint32 tid : Transaction to cancel.
120 * mtp_uint16 len : Total length of the status data.
121 * mtp_uint16 code : Response code
122 * mtp_uint32 params : Params depends on the status code.
127 mtp_uint32 params[1];
130 void _util_print_error();
131 mtp_int32 _util_get_battery_level(void);
132 mtp_bool _util_get_serial(mtp_char *serial, mtp_uint32 len);
133 void _util_get_model_name(mtp_char *model_name, mtp_uint32 len);
134 void _util_get_vendor_ext_desc(mtp_char *vendor_ext_desc, mtp_uint32 len);
135 void _util_get_device_version(mtp_char *device_version, mtp_uint32 len);
136 void _util_gen_alt_serial(mtp_char *serial, mtp_uint32 len);
137 void _util_get_usb_status(phone_status_t *val);
138 phone_status_t _util_get_local_usb_status(void);
139 void _util_set_local_usb_status(const phone_status_t val);
140 void _util_get_mmc_status(phone_status_t *val);
141 phone_status_t _util_get_local_mmc_status(void);
142 void _util_set_local_mmc_status(const phone_status_t val);
143 void _util_get_usbmode_status(phone_status_t *val);
144 phone_status_t _util_get_local_usbmode_status(void);
145 void _util_set_local_usbmode_status(const phone_status_t val);
146 void _util_get_lock_status(phone_status_t *val);
147 phone_status_t _util_get_local_lock_status(void);
148 void _util_set_local_lock_status(const phone_status_t val);
149 void _util_get_external_path(char *external_path);
150 void _util_get_internal_path(char *internal_path);
151 #endif /* _MTP_UTIL_H_ */