Change sdcard path /opt to /usr
[platform/core/connectivity/mtp-responder.git] / include / mtp_config.h
1 /*
2  * Copyright (c) 2012, 2013 Samsung Electronics Co., Ltd.
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 #ifndef _MTP_CONFIG_H_
18 #define _MTP_CONFIG_H_
19
20 #include <stdbool.h>
21
22 /* Function Features */
23 #define MTP_USE_INFORMATION_REGISTRY            /* for get and set some information value */
24
25 /* Set write-protection for read-only files */
26 /*#define MTP_SUPPORT_SET_PROTECTION*/
27
28 /*MtpObject.c, for unknown metadata */
29 #define MTP_USE_FILL_EMPTYMETADATA_WITH_UNKNOWN
30
31 /*define MTP_USE_VARIABLE_PTP_STRING_MALLOC*/   /*allocPtpString in ptpstring.c*/
32 #define MTP_USE_RUNTIME_GETOBJECTPROPVALUE      /*use runtime get object property list*/
33
34 /*keywords has many space. not support*/
35 /*#define MTP_USE_OBJPROPERTY_KEYWORDS*/
36 /*#define MTP_USE_SELFMAKE_ABSTRACTION*/
37
38 /*after db loading(mass files), there are some duplicate open session packet*/
39 /*#define MTP_USE_SKIP_CONTINUOUS_OPENSESSION*/
40
41 /* Support Features */
42
43 /* cancel transactio, device reset, mainly used in mtpmain.c */
44 #define MTP_SUPPORT_CONTROL_REQUEST
45
46 #define MTP_SUPPORT_ALBUM_ART           /* album art image file */
47 /*#define MTP_SUPPORT_DELETE_MEDIA_ALBUM_FILE*/
48
49 /*support battery level using mtp_pal_phone_get_status(MTP_PAL_BATTLEVEL) */
50 #define MTP_SUPPORT_DEVICEPROP_BATTERYLEVEL
51
52 /*support get wmpinfo.xml from hidden file list */
53 /*#define MTP_SUPPORT_HIDE_WMPINFO_XML*/
54
55 /*support mtp command GetInterdependentPropDesc (0x9807) */
56 /*#define MTP_SUPPORT_INTERDEPENDENTPROP*/
57
58 /*mobile class. this should be set with ms os descriptor. see portable device installation consideration */
59 #define MTP_SUPPORT_DEVICE_CLASS
60
61 /*#define MTP_SUPPORT_WMV_ENCODINGPROFILE */            /* for WMV encoding profile */
62
63 /*Representive Sample Properties are not supported by either music player or libmm-fileinfo */
64 #ifdef MTP_SUPPORT_ALBUM_ART
65 /*#define MTP_SUPPORT_PROPERTY_SAMPLE*/
66 #endif/*MTP_SUPPORT_ALBUM_ART*/
67
68 /* external features */
69 #define MTP_SUPPORT_OBJECTADDDELETE_EVENT
70
71 /*For printing Commands sent by initiator
72  *This needs to be diabled later before commercial binary release
73  */
74 #define MTP_SUPPORT_PRINT_COMMAND
75
76 /*
77  * Transport related configuration
78  */
79 /* Internal Storage */
80 #define MTP_STORE_PATH_CHAR             "/home/owner/content"
81
82 /* External Storage */
83 #define MTP_EXTERNAL_PATH_CHAR          "/usr/storage/sdcard"
84 #define MTP_DEVICE_ICON                 "/usr/share/mtp/device_icon.ico"
85
86 /* File For WMP extesions */
87 #define MTP_FILES_MODIFIED_FILES        "/tmp/mtp_mod_files.log"
88
89 /* Base MTP USER Directory */
90 #define MTP_USER_DIRECTORY              "/opt/usr/media/user"
91
92 /* Hidden Root directory */
93 #define MTP_HIDDEN_PHONE                ".HiddenPhone"
94 #define MTP_HIDDEN_CARD                 ".HiddenCard"
95
96 /* Windows Media Player xml file */
97 #define MTP_FILE_NAME_WMPINFO_XML       "WMPInfo.xml"
98
99 /* MTP extension name */
100 #define MTP_EXT_NAME_REGISTRY           "ini"
101
102 /* special extension */
103 #define MTP_ALBUMFILE_EXTENSION         "alb"
104
105 /* Reference Key name */
106 #define MTP_REF_KEYNAME_CHAR            "Reference"
107
108 /*STORAGE*/
109 #define MTP_MAX_STORAGE                 (30*1024*1024)  /*30MB */
110 #define MTP_MAX_STORAGE_IN_OBJTS        0xFFFFFFFF
111 #define MTP_MAX_INT_OBJECT_NUM          10000000
112 #define MTP_MIN_EXT_OBJECT_NUM          5000000
113
114 #define MTP_BUF_SIZE_FOR_INT            11      /* 2^32 - 1 = 4294967295 (10 digits) */
115
116 /*To determine whether command is for Samsung mobile*/
117 #define MTP_SAMSUNG_MOBILE              0x1000
118 #define MTP_STORAGE_DESC_INT            "Phone"
119 #define MTP_STORAGE_DESC_EXT            "Card"
120
121 /*Devices Property*/
122 #define MTP_DEFAULT_MODEL_NAME                  "SAMSUNG Mobile"
123 #define MTP_DEFAULT_DEVICE_VERSION              ""
124 #define MTP_DEV_PROPERTY_SYNCPARTNER            "Longhorn Sync Engine"
125 #define MTP_DEV_PROPERTY_FRIENDLYNAME           "SAMSUNG Mobile"
126 #define MTP_DEV_PROPERTY_NULL_SYNCPARTNER       "{00000000-0000-0000-0000-000000000000}"
127
128 /*temporary file*/
129 #define MTP_TEMP_FILE                   ".mtptemp.tmp"
130 #define MTP_TEMP_FILE_DEFAULT           "/tmp/.mtptemp.tmp"
131
132 /*Unknown Metadata default name*/
133 #define MTP_UNKNOWN_METADATA            "Unknown"
134
135 /*2006.10.20 empty metadata folder problem*/
136 #define MTP_UNKNOWN_METADATAW           L"Unknown"
137
138 /* strlen(/opt/usr/share/crash/) + MTP path len limit */
139 #define MTP_MAX_PATHNAME_SIZE           (21 + 255)      /* except \0 */
140 #define MTP_MAX_FILENAME_SIZE           (254)   /* except \0 */
141
142 #define MTP_MAX_CMD_BLOCK_SIZE          36      /* Bytes */
143
144 #define MTP_MAX_PACKET_SIZE_SEND_HS     512     /* High speed */
145 #define MTP_MAX_PACKET_SIZE_SEND_FS     64      /* Full speed */
146 #define MTP_FILESIZE_4GB                4294967296L
147
148 /* approximately 3 times of media files. consider album*/
149 #define MTP_MAX_REFDB_ROWCNT            4500
150 #define MTP_MAX_EXTENSION_LENGTH        11
151 #define MTP_MAX_REG_STRING              128
152
153 #define MTP_SERIAL_LEN_MAX              32
154 #define MD5_HASH_LEN                    16
155 #define MTP_MODEL_NAME_LEN_MAX          32
156 #define MTP_DEVICE_NAME_LEN_MAX         64
157
158 /*
159  *  User defined Configureations
160  */
161 /*#define MTP_USE_DEPEND_DEFAULT_MEMORY*/
162 #define MTP_SUPPORT_OMADRM_EXTENSION
163
164 /* Image Height/Width */
165 #define MTP_MAX_IMG_WIDTH               32672
166 #define MTP_MAX_IMG_HEIGHT              32672
167
168 #define MTP_MAX_VIDEO_WIDTH             1920
169 #define MTP_MAX_VIDEO_HEIGHT            1080
170
171 #define MTP_MIN_VIDEO_WIDTH             0
172 #define MTP_MIN_VIDEO_HEIGHT            0
173
174 /* about 976kbytes for object property value like sample data*/
175 #define MTP_MAX_PROP_DATASIZE           1000000
176
177 #define MTP_MAX_METADATA                204800  /* 200KB */
178
179 #define MTP_VENDOR_EXTENSIONDESC_CHAR   \
180         "microsoft.com/WMDRMPD:10.1;microsoft.com/playready:1.10; "
181
182 #define MTP_MANUFACTURER_CHAR           "Tizen"
183 #define HAVE_OWN_WCHAR_CONVERSION
184
185 #define MTP_MMAP_THRESHOLD      524288
186 #define MTP_READ_USB_SIZE       4096
187 #define MTP_WRITE_USB_SIZE      4096
188 #define MTP_READ_FILE_SIZE      524288
189 #define MTP_WRITE_FILE_SIZE     524288
190 #define MTP_INIT_RX_IPC_SIZE    32768
191 #define MTP_INIT_TX_IPC_SIZE    262144
192 #define MTP_MAX_RX_IPC_SIZE     32768
193 #define MTP_MAX_TX_IPC_SIZE     262144
194 #define MTP_MAX_IO_BUF_SIZE     10485760        /* 10MB */
195 #define MTP_READ_FILE_DELAY     0               /* us */
196
197 #define MTP_SUPPORT_PTHREAD_SCHED       false
198 #define MTP_INHERITSCHED                'i'
199 #define MTP_SCHEDPOLICY                 'o'
200 #define MTP_FILE_SCHEDPARAM             0
201 #define MTP_USB_SCHEDPARAM              0
202
203 #define MTP_CONFIG_FILE_PATH            "/opt/var/lib/misc/mtp-responder.conf"
204
205 typedef struct {
206         /* Speed related config */
207         int mmap_threshold;     /* Max. 512KB. If requested memory is lesser than this, malloc is used. Otherwise, mmap is used */
208
209         int read_usb_size;      /* USB read request size */
210         int write_usb_size;     /* USB write request size */
211
212         int read_file_size;     /* File read request size */
213         int write_file_size;    /* File write request size */
214
215         int init_rx_ipc_size;   /* Init. Rx(PC -> Phone) IPC size between USB and File threads */
216         int init_tx_ipc_size;   /* Init. Tx(Phone -> PC) IPC size between USB and File threads */
217         int max_rx_ipc_size;    /* Max. Rx(PC -> Phone) IPC size between USB and File threads */
218         int max_tx_ipc_size;    /* Max. Tx(Phone -> PC) IPC size between USB and File threads */
219
220         int max_io_buf_size;    /* Max. Heap memory size for buffer between USB and File threads */
221
222         int read_file_delay;
223
224         /* Experimental */
225         bool support_pthread_sched;
226         char inheritsched;      /* i : Inherit, e : Explicit */
227         char schedpolicy;       /* f : FIFO, r : Round Robin, o : Other */
228         int file_schedparam;    /* File I/O thread's priority for scheduling */
229         int usb_schedparam;     /* USB I/O thread's priority for scheduling */
230
231         /* Experimental (End) */
232         /* Speed related config (End) */
233
234         /* MTP Features */
235         /* MTP Features (End) */
236
237         /* Vendor Features */
238         /* Features (End) */
239
240         bool is_init;
241 } mtp_config_t;
242
243 #endif  /* _MTP_CONFIG_H_ */