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.
25 #include "mtp_config.h"
26 #include "mtp_datatype.h"
29 #define LOG_TAG "MTP-RESPONDER"
32 #include <media_content.h>
34 #define FIND_CMD_LEN 300
35 #define FIND_CMD "/usr/bin/find %s \\( -iname '*.jpg' -o -iname '*.gif' " \
36 "-o -iname '*.exif' -o -iname '*.png' " \
37 "-o -iname '*.mpeg' -o -iname '*.asf' " \
38 "-o -iname '*.wmv' -o -iname '*.avi' -o -iname '*.wma' " \
39 "-o -iname '*.mp3' \\) -mmin -%d >> %s"
41 #define DBG(format, args...) SLOGD(format, ##args)
42 #define ERR(format, args...) SLOGE(format, ##args)
43 #define DBG_SECURE(format, args...) SECURE_SLOGD(format, ##args)
44 #define ERR_SECURE(format, args...) SECURE_SLOGE(format, ##args)
46 #define ret_if(expr) \
54 #define retv_if(expr, val) \
62 #define retm_if(expr, fmt, arg...) \
70 #define retvm_if(expr, val, fmt, arg...) \
79 MTP_PHONE_USB_CONNECTED = 0,
80 MTP_PHONE_USB_DISCONNECTED,
81 MTP_PHONE_MMC_INSERTED,
83 MTP_PHONE_USB_MODE_OTHER,
89 phone_status_t mmc_state;
90 phone_status_t usb_state;
91 phone_status_t usb_mode_state;
92 phone_status_t lock_state;
104 MTP_STATE_STOPPED = 0, /* stopped working */
105 MTP_STATE_INITIALIZING, /* initializing device or enumerating*/
106 MTP_STATE_READY_SERVICE, /* ready to handle commands */
107 MTP_STATE_ONSERVICE, /* handling a command */
108 MTP_STATE_DATA_TRANSFER_DL, /* file downloading */
109 MTP_STATE_DATA_PROCESSING /* data processing */
113 * PTP Cancellation Request
114 * mtp_uint16 io_code : Identifier for cancellation.
115 * This must equal USB_PTPCANCELIO_ID.
116 * mtp_uint32 tid : Transaction to cancel.
125 * mtp_uint16 len : Total length of the status data.
126 * mtp_uint16 code : Response code
127 * mtp_uint32 params : Params depends on the status code.
132 mtp_uint32 params[1];
135 void _util_print_error();
136 mtp_int32 _util_get_battery_level(void);
137 mtp_bool _util_get_serial(mtp_char *serial, mtp_uint32 len);
138 void _util_get_model_name(mtp_char *model_name, mtp_uint32 len);
139 void _util_get_vendor_ext_desc(mtp_char *vendor_ext_desc, mtp_uint32 len);
140 void _util_get_device_version(mtp_char *device_version, mtp_uint32 len);
141 void _util_gen_alt_serial(mtp_char *serial, mtp_uint32 len);
142 void _util_get_usb_status(phone_status_t *val);
143 phone_status_t _util_get_local_usb_status(void);
144 void _util_set_local_usb_status(const phone_status_t val);
145 void _util_get_mmc_status(phone_status_t *val);
146 phone_status_t _util_get_local_mmc_status(void);
147 void _util_set_local_mmc_status(const phone_status_t val);
148 void _util_get_usbmode_status(phone_status_t *val);
149 phone_status_t _util_get_local_usbmode_status(void);
150 void _util_set_local_usbmode_status(const phone_status_t val);
151 void _util_get_lock_status(phone_status_t *val);
152 phone_status_t _util_get_local_lock_status(void);
153 void _util_set_local_lock_status(const phone_status_t val);
154 void _util_get_external_path(char *external_path);
155 void _util_get_internal_path(char *internal_path);
156 mtp_bool _util_media_content_connect();
157 void _util_media_content_disconnect();
163 #endif /* _MTP_UTIL_H_ */