libmtp  0.1.4
ptp.h
1 /* ptp.h
2  *
3  * Copyright (C) 2001 Mariusz Woloszyn <emsi@ipartners.pl>
4  *
5  * This library is free software; you can redistribute it and/or
6  * modify it under the terms of the GNU Lesser General Public
7  * License as published by the Free Software Foundation; either
8  * version 2 of the License, or (at your option) any later version.
9  *
10  * This library is distributed in the hope that it will be useful,
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13  * Lesser General Public License for more details.
14  *
15  * You should have received a copy of the GNU Lesser General Public
16  * License along with this library; if not, write to the
17  * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
18  * Boston, MA 02111-1307, USA.
19  */
20 
21 #ifndef __PTP_H__
22 #define __PTP_H__
23 
24 #include <stdarg.h>
25 #include <time.h>
26 #include <iconv.h>
27 #include "gphoto2-endian.h"
28 
29 /* PTP datalayer byteorder */
30 
31 #define PTP_DL_BE 0xF0
32 #define PTP_DL_LE 0x0F
33 
34 /* PTP request/response/event general PTP container (transport independent) */
35 
36 struct _PTPContainer {
37  uint16_t Code;
38  uint32_t SessionID;
39  uint32_t Transaction_ID;
40  /* params may be of any type of size less or equal to uint32_t */
41  uint32_t Param1;
42  uint32_t Param2;
43  uint32_t Param3;
44  /* events can only have three parameters */
45  uint32_t Param4;
46  uint32_t Param5;
47  /* the number of meaningfull parameters */
48  uint8_t Nparam;
49 };
50 typedef struct _PTPContainer PTPContainer;
51 
52 /* PTP USB Bulk-Pipe container */
53 /* USB bulk max packet length for high speed endpoints */
54 /* The max packet is set to 512 bytes. The spec says
55  * "end of data transfers are signaled by short packets or NULL
56  * packets". It never says anything about 512, but current
57  * implementations seem to have chosen this value, which also
58  * happens to be the size of an USB 2.0 HS endpoint, even though
59  * this is not necessary.
60  *
61  * Previously we had this as 4096 for MTP devices. We have found
62  * and fixed the bugs that made this necessary and it can be 512 again.
63  */
64 #define PTP_USB_BULK_HS_MAX_PACKET_LEN_WRITE 512
65 #define PTP_USB_BULK_HS_MAX_PACKET_LEN_READ 512
66 #define PTP_USB_BULK_HDR_LEN (2*sizeof(uint32_t)+2*sizeof(uint16_t))
67 #define PTP_USB_BULK_PAYLOAD_LEN_WRITE (PTP_USB_BULK_HS_MAX_PACKET_LEN_WRITE-PTP_USB_BULK_HDR_LEN)
68 #define PTP_USB_BULK_PAYLOAD_LEN_READ (PTP_USB_BULK_HS_MAX_PACKET_LEN_READ-PTP_USB_BULK_HDR_LEN)
69 #define PTP_USB_BULK_REQ_LEN (PTP_USB_BULK_HDR_LEN+5*sizeof(uint32_t))
70 
72  uint32_t length;
73  uint16_t type;
74  uint16_t code;
75  uint32_t trans_id;
76  union {
77  struct {
78  uint32_t param1;
79  uint32_t param2;
80  uint32_t param3;
81  uint32_t param4;
82  uint32_t param5;
83  } params;
84  /* this must be set to the maximum of PTP_USB_BULK_PAYLOAD_LEN_WRITE
85  * and PTP_USB_BULK_PAYLOAD_LEN_READ */
86  unsigned char data[PTP_USB_BULK_PAYLOAD_LEN_READ];
87  } payload;
88 };
90 
91 /* PTP USB Asynchronous Event Interrupt Data Format */
93  uint32_t length;
94  uint16_t type;
95  uint16_t code;
96  uint32_t trans_id;
97  uint32_t param1;
98  uint32_t param2;
99  uint32_t param3;
100 };
102 
104  uint32_t oid;
105  char *str;
106 };
108 
109 /* USB container types */
110 
111 #define PTP_USB_CONTAINER_UNDEFINED 0x0000
112 #define PTP_USB_CONTAINER_COMMAND 0x0001
113 #define PTP_USB_CONTAINER_DATA 0x0002
114 #define PTP_USB_CONTAINER_RESPONSE 0x0003
115 #define PTP_USB_CONTAINER_EVENT 0x0004
116 
117 /* PTP/IP definitions */
118 #define PTPIP_INIT_COMMAND_REQUEST 1
119 #define PTPIP_INIT_COMMAND_ACK 2
120 #define PTPIP_INIT_EVENT_REQUEST 3
121 #define PTPIP_INIT_EVENT_ACK 4
122 #define PTPIP_INIT_FAIL 5
123 #define PTPIP_CMD_REQUEST 6
124 #define PTPIP_CMD_RESPONSE 7
125 #define PTPIP_EVENT 8
126 #define PTPIP_START_DATA_PACKET 9
127 #define PTPIP_DATA_PACKET 10
128 #define PTPIP_CANCEL_TRANSACTION 11
129 #define PTPIP_END_DATA_PACKET 12
130 #define PTPIP_PING 13
131 #define PTPIP_PONG 14
132 
133 struct _PTPIPHeader {
134  uint32_t length;
135  uint32_t type;
136 };
137 typedef struct _PTPIPHeader PTPIPHeader;
138 
139 /* Vendor IDs */
140 #define PTP_VENDOR_EASTMAN_KODAK 0x00000001
141 #define PTP_VENDOR_SEIKO_EPSON 0x00000002
142 #define PTP_VENDOR_AGILENT 0x00000003
143 #define PTP_VENDOR_POLAROID 0x00000004
144 #define PTP_VENDOR_AGFA_GEVAERT 0x00000005
145 #define PTP_VENDOR_MICROSOFT 0x00000006
146 #define PTP_VENDOR_EQUINOX 0x00000007
147 #define PTP_VENDOR_VIEWQUEST 0x00000008
148 #define PTP_VENDOR_STMICROELECTRONICS 0x00000009
149 #define PTP_VENDOR_NIKON 0x0000000A
150 #define PTP_VENDOR_CANON 0x0000000B
151 
152 /* Operation Codes */
153 
154 #define PTP_OC_Undefined 0x1000
155 #define PTP_OC_GetDeviceInfo 0x1001
156 #define PTP_OC_OpenSession 0x1002
157 #define PTP_OC_CloseSession 0x1003
158 #define PTP_OC_GetStorageIDs 0x1004
159 #define PTP_OC_GetStorageInfo 0x1005
160 #define PTP_OC_GetNumObjects 0x1006
161 #define PTP_OC_GetObjectHandles 0x1007
162 #define PTP_OC_GetObjectInfo 0x1008
163 #define PTP_OC_GetObject 0x1009
164 #define PTP_OC_GetThumb 0x100A
165 #define PTP_OC_DeleteObject 0x100B
166 #define PTP_OC_SendObjectInfo 0x100C
167 #define PTP_OC_SendObject 0x100D
168 #define PTP_OC_InitiateCapture 0x100E
169 #define PTP_OC_FormatStore 0x100F
170 #define PTP_OC_ResetDevice 0x1010
171 #define PTP_OC_SelfTest 0x1011
172 #define PTP_OC_SetObjectProtection 0x1012
173 #define PTP_OC_PowerDown 0x1013
174 #define PTP_OC_GetDevicePropDesc 0x1014
175 #define PTP_OC_GetDevicePropValue 0x1015
176 #define PTP_OC_SetDevicePropValue 0x1016
177 #define PTP_OC_ResetDevicePropValue 0x1017
178 #define PTP_OC_TerminateOpenCapture 0x1018
179 #define PTP_OC_MoveObject 0x1019
180 #define PTP_OC_CopyObject 0x101A
181 #define PTP_OC_GetPartialObject 0x101B
182 #define PTP_OC_InitiateOpenCapture 0x101C
183 
184 /* Eastman Kodak extension Operation Codes */
185 #define PTP_OC_EK_GetSerial 0x9003
186 #define PTP_OC_EK_SetSerial 0x9004
187 #define PTP_OC_EK_SendFileObjectInfo 0x9005
188 #define PTP_OC_EK_SendFileObject 0x9006
189 #define PTP_OC_EK_SetText 0x9008
190 
191 /* Canon extension Operation Codes */
192 #define PTP_OC_CANON_GetPartialObjectInfo 0x9001
193 #define PTP_OC_CANON_SetObjectArchive 0x9002
194 /* 9002 - sends 2 uint32, nothing back */
195 #define PTP_OC_CANON_9003 0x9003
196 /* 9003 - sends nothing, nothing back */
197 /* no 9004 observed yet */
198 /* no 9005 observed yet */
199 #define PTP_OC_CANON_GetObjectHandleByName 0x9006
200 /* no 9007 observed yet */
201 #define PTP_OC_CANON_StartShootingMode 0x9008
202 #define PTP_OC_CANON_EndShootingMode 0x9009
203 /* 900a - sends nothing, nothing back */
204 #define PTP_OC_CANON_900a 0x900A
205 #define PTP_OC_CANON_ViewfinderOn 0x900B
206 #define PTP_OC_CANON_ViewfinderOff 0x900C
207 #define PTP_OC_CANON_DoAeAfAwb 0x900D
208 
209 /* 900e - send nothing, gets 5 uint16t in 32bit entities back in 20byte datablob */
210 #define PTP_OC_CANON_GetCustomizeSpec 0x900E
211 #define PTP_OC_CANON_GetCustomizeItemInfo 0x900F
212 #define PTP_OC_CANON_GetCustomizeData 0x9010
213 #define PTP_OC_CANON_SetCustomizeData 0x9011
214 
215 /* initiate movie capture:
216  9010 startmoviecapture?
217  9003 stopmoviecapture?
218 */
219 
220 #define PTP_OC_CANON_CheckEvent 0x9013
221 #define PTP_OC_CANON_FocusLock 0x9014
222 #define PTP_OC_CANON_FocusUnlock 0x9015
223 #define PTP_OC_CANON_InitiateCaptureInMemory 0x901A
224 #define PTP_OC_CANON_GetPartialObjectEx 0x901B
225 #define PTP_OC_CANON_SetObjectTime 0x901C
226 #define PTP_OC_CANON_GetViewfinderImage 0x901D
227 #define PTP_OC_CANON_ChangeUSBProtocol 0x901F
228 #define PTP_OC_CANON_GetChanges 0x9020
229 #define PTP_OC_CANON_GetObjectInfoEx 0x9021
230 
231 #define PTP_OC_CANON_TerminateDirectTransfer 0x9023
232 
233 #define PTP_OC_CANON_InitiateDirectTransferEx2 0x9028
234 #define PTP_OC_CANON_GetTargetHandles 0x9029
235 #define PTP_OC_CANON_NotifyProgress 0x902A
236 #define PTP_OC_CANON_NotifyCancelAccepted 0x902B
237 /* 902c: no parms, read 3 uint32 in data, no response parms */
238 #define PTP_OC_CANON_902C 0x902C
239 #define PTP_OC_CANON_GetDirectory 0x902D
240 
241 #define PTP_OC_CANON_SetPairingInfo 0x9030
242 #define PTP_OC_CANON_GetPairingInfo 0x9031
243 #define PTP_OC_CANON_DeletePairingInfo 0x9032
244 #define PTP_OC_CANON_GetMACAddress 0x9033
245 /* 9034: 1 param, no parms returned */
246 #define PTP_OC_CANON_SetDisplayMonitor 0x9034
247 #define PTP_OC_CANON_PairingComplete 0x9035
248 #define PTP_OC_CANON_GetWirelessMAXChannel 0x9036
249 
250 /* Nikon extension Operation Codes */
251 #define PTP_OC_NIKON_GetProfileAllData 0x9006
252 #define PTP_OC_NIKON_SendProfileData 0x9007
253 #define PTP_OC_NIKON_DeleteProfile 0x9008
254 #define PTP_OC_NIKON_SetProfileData 0x9009
255 #define PTP_OC_NIKON_AdvancedTransfer 0x9010
256 #define PTP_OC_NIKON_GetFileInfoInBlock 0x9011
257 #define PTP_OC_NIKON_Capture 0x90C0
258 #define PTP_OC_NIKON_SetControlMode 0x90C2
259 #define PTP_OC_NIKON_CurveDownload 0x90C5
260 #define PTP_OC_NIKON_CurveUpload 0x90C6
261 #define PTP_OC_NIKON_CheckEvent 0x90C7
262 #define PTP_OC_NIKON_DeviceReady 0x90C8
263 #define PTP_OC_NIKON_GetDevicePTPIPInfo 0x90E0
264 
265 /* Microsoft / MTP extension codes */
266 
267 #define PTP_OC_MTP_GetObjectPropsSupported 0x9801
268 #define PTP_OC_MTP_GetObjectPropDesc 0x9802
269 #define PTP_OC_MTP_GetObjectPropValue 0x9803
270 #define PTP_OC_MTP_SetObjectPropValue 0x9804
271 #define PTP_OC_MTP_GetObjPropList 0x9805
272 #define PTP_OC_MTP_SetObjPropList 0x9806
273 #define PTP_OC_MTP_GetInterdependendPropdesc 0x9807
274 #define PTP_OC_MTP_SendObjectPropList 0x9808
275 #define PTP_OC_MTP_GetObjectReferences 0x9810
276 #define PTP_OC_MTP_SetObjectReferences 0x9811
277 #define PTP_OC_MTP_UpdateDeviceFirmware 0x9812
278 #define PTP_OC_MTP_Skip 0x9820
279 
280 /*
281  * Windows Media Digital Rights Management for Portable Devices
282  * Extension Codes (microsoft.com/WMDRMPD: 10.1)
283  */
284 #define PTP_OC_MTP_WMDRMPD_GetSecureTimeChallenge 0x9101
285 #define PTP_OC_MTP_WMDRMPD_GetSecureTimeResponse 0x9102
286 #define PTP_OC_MTP_WMDRMPD_SetLicenseResponse 0x9103
287 #define PTP_OC_MTP_WMDRMPD_GetSyncList 0x9104
288 #define PTP_OC_MTP_WMDRMPD_SendMeterChallengeQuery 0x9105
289 #define PTP_OC_MTP_WMDRMPD_GetMeterChallenge 0x9106
290 #define PTP_OC_MTP_WMDRMPD_SetMeterResponse 0x9107
291 #define PTP_OC_MTP_WMDRMPD_CleanDataStore 0x9108
292 #define PTP_OC_MTP_WMDRMPD_GetLicenseState 0x9109
293 #define PTP_OC_MTP_WMDRMPD_SendWMDRMPDCommand 0x910A
294 #define PTP_OC_MTP_WMDRMPD_SendWMDRMPDRequest 0x910B
295 
296 /*
297  * Windows Media Digital Rights Management for Portable Devices
298  * Extension Codes (microsoft.com/WMDRMPD: 10.1)
299  * Below are operations that have no public documented identifier
300  * associated with them "Vendor-defined Command Code"
301  */
302 #define PTP_OC_MTP_WMDRMPD_SendWMDRMPDAppRequest 0x9212
303 #define PTP_OC_MTP_WMDRMPD_GetWMDRMPDAppResponse 0x9213
304 #define PTP_OC_MTP_WMDRMPD_EnableTrustedFilesOperations 0x9214
305 #define PTP_OC_MTP_WMDRMPD_DisableTrustedFilesOperations 0x9215
306 #define PTP_OC_MTP_WMDRMPD_EndTrustedAppSession 0x9216
307 /* ^^^ guess ^^^ */
308 
309 /*
310  * Microsoft Advanced Audio/Video Transfer
311  * Extensions (microsoft.com/AAVT: 1.0)
312  */
313 #define PTP_OC_MTP_AAVT_OpenMediaSession 0x9170
314 #define PTP_OC_MTP_AAVT_CloseMediaSession 0x9171
315 #define PTP_OC_MTP_AAVT_GetNextDataBlock 0x9172
316 #define PTP_OC_MTP_AAVT_SetCurrentTimePosition 0x9173
317 
318 /*
319  * Windows Media Digital Rights Management for Network Devices
320  * Extensions (microsoft.com/WMDRMND: 1.0) MTP/IP?
321  */
322 #define PTP_OC_MTP_WMDRMND_SendRegistrationRequest 0x9180
323 #define PTP_OC_MTP_WMDRMND_GetRegistrationResponse 0x9181
324 #define PTP_OC_MTP_WMDRMND_GetProximityChallenge 0x9182
325 #define PTP_OC_MTP_WMDRMND_SendProximityResponse 0x9183
326 #define PTP_OC_MTP_WMDRMND_SendWMDRMNDLicenseRequest 0x9184
327 #define PTP_OC_MTP_WMDRMND_GetWMDRMNDLicenseResponse 0x9185
328 
329 /*
330  * Windows Media Player Portiable Devices
331  * Extension Codes (microsoft.com/WMPPD: 11.1)
332  */
333 #define PTP_OC_MTP_WMPPD_ReportAddedDeletedItems 0x9201
334 #define PTP_OC_MTP_WMPPD_ReportAcquiredItems 0x9202
335 #define PTP_OC_MTP_WMPPD_PlaylistObjectPref 0x9203
336 
337 /*
338  * Undocumented Zune Operation Codes
339  * maybe related to WMPPD extension set?
340  */
341 #define PTP_OC_MTP_ZUNE_GETUNDEFINED001 0x9204
342 
343 /* WiFi Provisioning MTP Extension Codes (microsoft.com/WPDWCN: 1.0) */
344 #define PTP_OC_MTP_WPDWCN_ProcessWFCObject 0x9122
345 
346 /* Proprietary vendor extension operations mask */
347 #define PTP_OC_EXTENSION_MASK 0xF000
348 #define PTP_OC_EXTENSION 0x9000
349 
350 /* Response Codes */
351 
352 #define PTP_RC_Undefined 0x2000
353 #define PTP_RC_OK 0x2001
354 #define PTP_RC_GeneralError 0x2002
355 #define PTP_RC_SessionNotOpen 0x2003
356 #define PTP_RC_InvalidTransactionID 0x2004
357 #define PTP_RC_OperationNotSupported 0x2005
358 #define PTP_RC_ParameterNotSupported 0x2006
359 #define PTP_RC_IncompleteTransfer 0x2007
360 #define PTP_RC_InvalidStorageId 0x2008
361 #define PTP_RC_InvalidObjectHandle 0x2009
362 #define PTP_RC_DevicePropNotSupported 0x200A
363 #define PTP_RC_InvalidObjectFormatCode 0x200B
364 #define PTP_RC_StoreFull 0x200C
365 #define PTP_RC_ObjectWriteProtected 0x200D
366 #define PTP_RC_StoreReadOnly 0x200E
367 #define PTP_RC_AccessDenied 0x200F
368 #define PTP_RC_NoThumbnailPresent 0x2010
369 #define PTP_RC_SelfTestFailed 0x2011
370 #define PTP_RC_PartialDeletion 0x2012
371 #define PTP_RC_StoreNotAvailable 0x2013
372 #define PTP_RC_SpecificationByFormatUnsupported 0x2014
373 #define PTP_RC_NoValidObjectInfo 0x2015
374 #define PTP_RC_InvalidCodeFormat 0x2016
375 #define PTP_RC_UnknownVendorCode 0x2017
376 #define PTP_RC_CaptureAlreadyTerminated 0x2018
377 #define PTP_RC_DeviceBusy 0x2019
378 #define PTP_RC_InvalidParentObject 0x201A
379 #define PTP_RC_InvalidDevicePropFormat 0x201B
380 #define PTP_RC_InvalidDevicePropValue 0x201C
381 #define PTP_RC_InvalidParameter 0x201D
382 #define PTP_RC_SessionAlreadyOpened 0x201E
383 #define PTP_RC_TransactionCanceled 0x201F
384 #define PTP_RC_SpecificationOfDestinationUnsupported 0x2020
385 
386 /* Eastman Kodak extension Response Codes */
387 #define PTP_RC_EK_FilenameRequired 0xA001
388 #define PTP_RC_EK_FilenameConflicts 0xA002
389 #define PTP_RC_EK_FilenameInvalid 0xA003
390 
391 /* Nikon specific response codes */
392 #define PTP_RC_NIKON_AdvancedTransferCancel 0xA022
393 
394 /* Microsoft/MTP specific codes */
395 #define PTP_RC_MTP_Undefined 0xA800
396 #define PTP_RC_MTP_Invalid_ObjectPropCode 0xA801
397 #define PTP_RC_MTP_Invalid_ObjectProp_Format 0xA802
398 #define PTP_RC_MTP_Invalid_ObjectProp_Value 0xA803
399 #define PTP_RC_MTP_Invalid_ObjectReference 0xA804
400 #define PTP_RC_MTP_Invalid_Dataset 0xA806
401 #define PTP_RC_MTP_Specification_By_Group_Unsupported 0xA808
402 #define PTP_RC_MTP_Object_Too_Large 0xA809
403 
404 /* Microsoft Advanced Audio/Video Transfer response codes
405 (microsoft.com/AAVT 1.0) */
406 #define PTP_RC_MTP_Invalid_Media_Session_ID 0xA170
407 #define PTP_RC_MTP_Media_Session_Limit_Reached 0xA171
408 #define PTP_RC_MTP_No_More_Data 0xA172
409 
410 /* WiFi Provisioning MTP Extension Error Codes (microsoft.com/WPDWCN: 1.0) */
411 #define PTP_RC_MTP_Invalid_WFC_Syntax 0xA121
412 #define PTP_RC_MTP_WFC_Version_Not_Supported 0xA122
413 
414 /* libptp2 extended ERROR codes */
415 #define PTP_ERROR_IO 0x02FF
416 #define PTP_ERROR_DATA_EXPECTED 0x02FE
417 #define PTP_ERROR_RESP_EXPECTED 0x02FD
418 #define PTP_ERROR_BADPARAM 0x02FC
419 
420 /* PTP Event Codes */
421 
422 #define PTP_EC_Undefined 0x4000
423 #define PTP_EC_CancelTransaction 0x4001
424 #define PTP_EC_ObjectAdded 0x4002
425 #define PTP_EC_ObjectRemoved 0x4003
426 #define PTP_EC_StoreAdded 0x4004
427 #define PTP_EC_StoreRemoved 0x4005
428 #define PTP_EC_DevicePropChanged 0x4006
429 #define PTP_EC_ObjectInfoChanged 0x4007
430 #define PTP_EC_DeviceInfoChanged 0x4008
431 #define PTP_EC_RequestObjectTransfer 0x4009
432 #define PTP_EC_StoreFull 0x400A
433 #define PTP_EC_DeviceReset 0x400B
434 #define PTP_EC_StorageInfoChanged 0x400C
435 #define PTP_EC_CaptureComplete 0x400D
436 #define PTP_EC_UnreportedStatus 0x400E
437 
438 /* Canon extension Event Codes */
439 #define PTP_EC_CANON_ExtendedErrorcode 0xC005 /* ? */
440 #define PTP_EC_CANON_ObjectInfoChanged 0xC008
441 #define PTP_EC_CANON_RequestObjectTransfer 0xC009
442 #define PTP_EC_CANON_CameraModeChanged 0xC00C
443 
444 #define PTP_EC_CANON_StartDirectTransfer 0xC011
445 #define PTP_EC_CANON_StopDirectTransfer 0xC013
446 
447 /* Nikon extension Event Codes */
448 #define PTP_EC_Nikon_ObjectAddedInSDRAM 0xC101
449 #define PTP_EC_Nikon_CaptureOverflow 0xC102
450 /* Gets 1 parameter, objectid pointing to DPOF object */
451 #define PTP_EC_Nikon_AdvancedTransfer 0xC103
452 
453 /* constants for GetObjectHandles */
454 #define PTP_GOH_ALL_STORAGE 0xffffffff
455 #define PTP_GOH_ALL_FORMATS 0x00000000
456 #define PTP_GOH_ALL_ASSOCS 0x00000000
457 
458 /* PTP device info structure (returned by GetDevInfo) */
459 
461  uint16_t StandardVersion;
462  uint32_t VendorExtensionID;
463  uint16_t VendorExtensionVersion;
464  char *VendorExtensionDesc;
465  uint16_t FunctionalMode;
466  uint32_t OperationsSupported_len;
467  uint16_t *OperationsSupported;
468  uint32_t EventsSupported_len;
469  uint16_t *EventsSupported;
470  uint32_t DevicePropertiesSupported_len;
471  uint16_t *DevicePropertiesSupported;
472  uint32_t CaptureFormats_len;
473  uint16_t *CaptureFormats;
474  uint32_t ImageFormats_len;
475  uint16_t *ImageFormats;
476  char *Manufacturer;
477  char *Model;
478  char *DeviceVersion;
479  char *SerialNumber;
480 };
481 typedef struct _PTPDeviceInfo PTPDeviceInfo;
482 
483 /* PTP storageIDs structute (returned by GetStorageIDs) */
484 
486  uint32_t n;
487  uint32_t *Storage;
488 };
489 typedef struct _PTPStorageIDs PTPStorageIDs;
490 
491 /* PTP StorageInfo structure (returned by GetStorageInfo) */
493  uint16_t StorageType;
494  uint16_t FilesystemType;
495  uint16_t AccessCapability;
496  uint64_t MaxCapability;
497  uint64_t FreeSpaceInBytes;
498  uint32_t FreeSpaceInImages;
499  char *StorageDescription;
500  char *VolumeLabel;
501 };
502 typedef struct _PTPStorageInfo PTPStorageInfo;
503 
504 /* PTP objecthandles structure (returned by GetObjectHandles) */
505 
507  uint32_t n;
508  uint32_t *Handler;
509 };
510 typedef struct _PTPObjectHandles PTPObjectHandles;
511 
512 #define PTP_HANDLER_SPECIAL 0xffffffff
513 #define PTP_HANDLER_ROOT 0x00000000
514 
515 
516 /* PTP objectinfo structure (returned by GetObjectInfo) */
517 
519  uint32_t StorageID;
520  uint16_t ObjectFormat;
521  uint16_t ProtectionStatus;
522  uint32_t ObjectCompressedSize;
523  uint16_t ThumbFormat;
524  uint32_t ThumbCompressedSize;
525  uint32_t ThumbPixWidth;
526  uint32_t ThumbPixHeight;
527  uint32_t ImagePixWidth;
528  uint32_t ImagePixHeight;
529  uint32_t ImageBitDepth;
530  uint32_t ParentObject;
531  uint16_t AssociationType;
532  uint32_t AssociationDesc;
533  uint32_t SequenceNumber;
534  char *Filename;
535  time_t CaptureDate;
536  time_t ModificationDate;
537  char *Keywords;
538 };
539 typedef struct _PTPObjectInfo PTPObjectInfo;
540 
541 /* max ptp string length INCLUDING terminating null character */
542 
543 #define PTP_MAXSTRLEN 255
544 
545 /* PTP Object Format Codes */
546 
547 /* ancillary formats */
548 #define PTP_OFC_Undefined 0x3000
549 #define PTP_OFC_Defined 0x3800
550 #define PTP_OFC_Association 0x3001
551 #define PTP_OFC_Script 0x3002
552 #define PTP_OFC_Executable 0x3003
553 #define PTP_OFC_Text 0x3004
554 #define PTP_OFC_HTML 0x3005
555 #define PTP_OFC_DPOF 0x3006
556 #define PTP_OFC_AIFF 0x3007
557 #define PTP_OFC_WAV 0x3008
558 #define PTP_OFC_MP3 0x3009
559 #define PTP_OFC_AVI 0x300A
560 #define PTP_OFC_MPEG 0x300B
561 #define PTP_OFC_ASF 0x300C
562 #define PTP_OFC_QT 0x300D /* guessing */
563 /* image formats */
564 #define PTP_OFC_EXIF_JPEG 0x3801
565 #define PTP_OFC_TIFF_EP 0x3802
566 #define PTP_OFC_FlashPix 0x3803
567 #define PTP_OFC_BMP 0x3804
568 #define PTP_OFC_CIFF 0x3805
569 #define PTP_OFC_Undefined_0x3806 0x3806
570 #define PTP_OFC_GIF 0x3807
571 #define PTP_OFC_JFIF 0x3808
572 #define PTP_OFC_PCD 0x3809
573 #define PTP_OFC_PICT 0x380A
574 #define PTP_OFC_PNG 0x380B
575 #define PTP_OFC_Undefined_0x380C 0x380C
576 #define PTP_OFC_TIFF 0x380D
577 #define PTP_OFC_TIFF_IT 0x380E
578 #define PTP_OFC_JP2 0x380F
579 #define PTP_OFC_JPX 0x3810
580 /* Eastman Kodak extension ancillary format */
581 #define PTP_OFC_EK_M3U 0xb002
582 /* MTP extensions */
583 #define PTP_OFC_MTP_MediaCard 0xb211
584 #define PTP_OFC_MTP_MediaCardGroup 0xb212
585 #define PTP_OFC_MTP_Encounter 0xb213
586 #define PTP_OFC_MTP_EncounterBox 0xb214
587 #define PTP_OFC_MTP_M4A 0xb215
588 #define PTP_OFC_MTP_ZUNEUNDEFINED 0xb217 /* Unknown file type */
589 #define PTP_OFC_MTP_Firmware 0xb802
590 #define PTP_OFC_MTP_WindowsImageFormat 0xb881
591 #define PTP_OFC_MTP_UndefinedAudio 0xb900
592 #define PTP_OFC_MTP_WMA 0xb901
593 #define PTP_OFC_MTP_OGG 0xb902
594 #define PTP_OFC_MTP_AAC 0xb903
595 #define PTP_OFC_MTP_AudibleCodec 0xb904
596 #define PTP_OFC_MTP_FLAC 0xb906
597 #define PTP_OFC_MTP_UndefinedVideo 0xb980
598 #define PTP_OFC_MTP_WMV 0xb981
599 #define PTP_OFC_MTP_MP4 0xb982
600 #define PTP_OFC_MTP_MP2 0xb983
601 #define PTP_OFC_MTP_3GP 0xb984
602 #define PTP_OFC_MTP_UndefinedCollection 0xba00
603 #define PTP_OFC_MTP_AbstractMultimediaAlbum 0xba01
604 #define PTP_OFC_MTP_AbstractImageAlbum 0xba02
605 #define PTP_OFC_MTP_AbstractAudioAlbum 0xba03
606 #define PTP_OFC_MTP_AbstractVideoAlbum 0xba04
607 #define PTP_OFC_MTP_AbstractAudioVideoPlaylist 0xba05
608 #define PTP_OFC_MTP_AbstractContactGroup 0xba06
609 #define PTP_OFC_MTP_AbstractMessageFolder 0xba07
610 #define PTP_OFC_MTP_AbstractChapteredProduction 0xba08
611 #define PTP_OFC_MTP_AbstractAudioPlaylist 0xba09
612 #define PTP_OFC_MTP_AbstractVideoPlaylist 0xba0a
613 #define PTP_OFC_MTP_AbstractMediacast 0xba0b
614 #define PTP_OFC_MTP_WPLPlaylist 0xba10
615 #define PTP_OFC_MTP_M3UPlaylist 0xba11
616 #define PTP_OFC_MTP_MPLPlaylist 0xba12
617 #define PTP_OFC_MTP_ASXPlaylist 0xba13
618 #define PTP_OFC_MTP_PLSPlaylist 0xba14
619 #define PTP_OFC_MTP_UndefinedDocument 0xba80
620 #define PTP_OFC_MTP_AbstractDocument 0xba81
621 #define PTP_OFC_MTP_XMLDocument 0xba82
622 #define PTP_OFC_MTP_MSWordDocument 0xba83
623 #define PTP_OFC_MTP_MHTCompiledHTMLDocument 0xba84
624 #define PTP_OFC_MTP_MSExcelSpreadsheetXLS 0xba85
625 #define PTP_OFC_MTP_MSPowerpointPresentationPPT 0xba86
626 #define PTP_OFC_MTP_UndefinedMessage 0xbb00
627 #define PTP_OFC_MTP_AbstractMessage 0xbb01
628 #define PTP_OFC_MTP_UndefinedContact 0xbb80
629 #define PTP_OFC_MTP_AbstractContact 0xbb81
630 #define PTP_OFC_MTP_vCard2 0xbb82
631 #define PTP_OFC_MTP_vCard3 0xbb83
632 #define PTP_OFC_MTP_UndefinedCalendarItem 0xbe00
633 #define PTP_OFC_MTP_AbstractCalendarItem 0xbe01
634 #define PTP_OFC_MTP_vCalendar1 0xbe02
635 #define PTP_OFC_MTP_vCalendar2 0xbe03
636 #define PTP_OFC_MTP_UndefinedWindowsExecutable 0xbe80
637 
638 
639 /* PTP Association Types */
640 #define PTP_AT_Undefined 0x0000
641 #define PTP_AT_GenericFolder 0x0001
642 #define PTP_AT_Album 0x0002
643 #define PTP_AT_TimeSequence 0x0003
644 #define PTP_AT_HorizontalPanoramic 0x0004
645 #define PTP_AT_VerticalPanoramic 0x0005
646 #define PTP_AT_2DPanoramic 0x0006
647 #define PTP_AT_AncillaryData 0x0007
648 
649 /* PTP Protection Status */
650 
651 #define PTP_PS_NoProtection 0x0000
652 #define PTP_PS_ReadOnly 0x0001
653 
654 /* PTP Storage Types */
655 
656 #define PTP_ST_Undefined 0x0000
657 #define PTP_ST_FixedROM 0x0001
658 #define PTP_ST_RemovableROM 0x0002
659 #define PTP_ST_FixedRAM 0x0003
660 #define PTP_ST_RemovableRAM 0x0004
661 
662 /* PTP FilesystemType Values */
663 
664 #define PTP_FST_Undefined 0x0000
665 #define PTP_FST_GenericFlat 0x0001
666 #define PTP_FST_GenericHierarchical 0x0002
667 #define PTP_FST_DCF 0x0003
668 
669 /* PTP StorageInfo AccessCapability Values */
670 
671 #define PTP_AC_ReadWrite 0x0000
672 #define PTP_AC_ReadOnly 0x0001
673 #define PTP_AC_ReadOnly_with_Object_Deletion 0x0002
674 
675 /* Property Describing Dataset, Range Form */
676 
678  char *str; /* common string, malloced */
679  uint8_t u8;
680  int8_t i8;
681  uint16_t u16;
682  int16_t i16;
683  uint32_t u32;
684  int32_t i32;
685  /* XXXX: 64bit and 128 bit signed and unsigned missing */
686  struct array {
687  uint32_t count;
688  union _PTPPropertyValue *v; /* malloced, count elements */
689  } a;
690 };
691 
692 typedef union _PTPPropertyValue PTPPropertyValue;
693 
694 /* Metadata lists for MTP operations */
695 struct _MTPPropList {
696  uint16_t property;
697  uint16_t datatype;
698  uint32_t ObjectHandle;
699  PTPPropertyValue propval;
700  struct _MTPPropList *next;
701 };
702 typedef struct _MTPPropList MTPPropList;
703 
705  PTPPropertyValue MinimumValue;
706  PTPPropertyValue MaximumValue;
707  PTPPropertyValue StepSize;
708 };
710 
711 /* Property Describing Dataset, Enum Form */
712 
714  uint16_t NumberOfValues;
715  PTPPropertyValue *SupportedValue; /* malloced */
716 };
718 
719 /* Device Property Describing Dataset (DevicePropDesc) */
720 
722  uint16_t DevicePropertyCode;
723  uint16_t DataType;
724  uint8_t GetSet;
725  PTPPropertyValue FactoryDefaultValue;
726  PTPPropertyValue CurrentValue;
727  uint8_t FormFlag;
728  union {
729  PTPPropDescEnumForm Enum;
730  PTPPropDescRangeForm Range;
731  } FORM;
732 };
734 
735 /* Object Property Describing Dataset (DevicePropDesc) */
736 
738  uint16_t ObjectPropertyCode;
739  uint16_t DataType;
740  uint8_t GetSet;
741  PTPPropertyValue FactoryDefaultValue;
742  uint32_t GroupCode;
743  uint8_t FormFlag;
744  union {
745  PTPPropDescEnumForm Enum;
746  PTPPropDescRangeForm Range;
747  } FORM;
748 };
750 
751 /* Canon filesystem's folder entry Dataset */
752 
753 #define PTP_CANON_FilenameBufferLen 13
754 #define PTP_CANON_FolderEntryLen 28
755 
757  uint32_t ObjectHandle;
758  uint16_t ObjectFormatCode;
759  uint8_t Flags;
760  uint32_t ObjectSize;
761  time_t Time;
762  char Filename[PTP_CANON_FilenameBufferLen];
763 };
765 
766 /* Nikon Tone Curve Data */
767 
768 #define PTP_NIKON_MaxCurvePoints 19
769 
771  uint8_t X;
772  uint8_t Y;
773 };
774 
776 
778  uint8_t X;
779  uint8_t Y;
780 };
781 
783 
785  char static_preamble[6];
786  uint8_t XAxisStartPoint;
787  uint8_t XAxisEndPoint;
788  uint8_t YAxisStartPoint;
789  uint8_t YAxisEndPoint;
790  uint8_t MidPointIntegerPart;
791  uint8_t MidPointDecimalPart;
792  uint8_t NCoordinates;
793  PTPNIKONCoordinatePair CurveCoordinates[PTP_NIKON_MaxCurvePoints];
794 };
795 
797 
799  char *title;
800  char *line[5];
801 };
802 typedef struct _PTPEKTextParams PTPEKTextParams;
803 
804 /* Nikon Wifi profiles */
805 
807  /* Values valid both when reading and writing profiles */
808  char profile_name[17];
809  uint8_t device_type;
810  uint8_t icon_type;
811  char essid[33];
812 
813  /* Values only valid when reading. Some of these are in the write packet,
814  * but are set automatically, like id, display_order and creation_date. */
815  uint8_t id;
816  uint8_t valid;
817  uint8_t display_order;
818  char creation_date[16];
819  char lastusage_date[16];
820 
821  /* Values only valid when writing */
822  uint32_t ip_address;
823  uint8_t subnet_mask; /* first zero bit position, e.g. 24 for 255.255.255.0 */
824  uint32_t gateway_address;
825  uint8_t address_mode; /* 0 - Manual, 2-3 - DHCP ad-hoc/managed*/
826  uint8_t access_mode; /* 0 - Managed, 1 - Adhoc */
827  uint8_t wifi_channel; /* 1-11 */
828  uint8_t authentification; /* 0 - Open, 1 - Shared, 2 - WPA-PSK */
829  uint8_t encryption; /* 0 - None, 1 - WEP 64bit, 2 - WEP 128bit (not supported: 3 - TKIP) */
830  uint8_t key[64];
831  uint8_t key_nr;
832 // char guid[16];
833 };
834 
836 
837 /* DataType Codes */
838 
839 #define PTP_DTC_UNDEF 0x0000
840 #define PTP_DTC_INT8 0x0001
841 #define PTP_DTC_UINT8 0x0002
842 #define PTP_DTC_INT16 0x0003
843 #define PTP_DTC_UINT16 0x0004
844 #define PTP_DTC_INT32 0x0005
845 #define PTP_DTC_UINT32 0x0006
846 #define PTP_DTC_INT64 0x0007
847 #define PTP_DTC_UINT64 0x0008
848 #define PTP_DTC_INT128 0x0009
849 #define PTP_DTC_UINT128 0x000A
850 
851 #define PTP_DTC_ARRAY_MASK 0x4000
852 
853 #define PTP_DTC_AINT8 (PTP_DTC_ARRAY_MASK | PTP_DTC_INT8)
854 #define PTP_DTC_AUINT8 (PTP_DTC_ARRAY_MASK | PTP_DTC_UINT8)
855 #define PTP_DTC_AINT16 (PTP_DTC_ARRAY_MASK | PTP_DTC_INT16)
856 #define PTP_DTC_AUINT16 (PTP_DTC_ARRAY_MASK | PTP_DTC_UINT16)
857 #define PTP_DTC_AINT32 (PTP_DTC_ARRAY_MASK | PTP_DTC_INT32)
858 #define PTP_DTC_AUINT32 (PTP_DTC_ARRAY_MASK | PTP_DTC_UINT32)
859 #define PTP_DTC_AINT64 (PTP_DTC_ARRAY_MASK | PTP_DTC_INT64)
860 #define PTP_DTC_AUINT64 (PTP_DTC_ARRAY_MASK | PTP_DTC_UINT64)
861 #define PTP_DTC_AINT128 (PTP_DTC_ARRAY_MASK | PTP_DTC_INT128)
862 #define PTP_DTC_AUINT128 (PTP_DTC_ARRAY_MASK | PTP_DTC_UINT128)
863 
864 #define PTP_DTC_STR 0xFFFF
865 
866 /* Device Properties Codes */
867 
868 #define PTP_DPC_Undefined 0x5000
869 #define PTP_DPC_BatteryLevel 0x5001
870 #define PTP_DPC_FunctionalMode 0x5002
871 #define PTP_DPC_ImageSize 0x5003
872 #define PTP_DPC_CompressionSetting 0x5004
873 #define PTP_DPC_WhiteBalance 0x5005
874 #define PTP_DPC_RGBGain 0x5006
875 #define PTP_DPC_FNumber 0x5007
876 #define PTP_DPC_FocalLength 0x5008
877 #define PTP_DPC_FocusDistance 0x5009
878 #define PTP_DPC_FocusMode 0x500A
879 #define PTP_DPC_ExposureMeteringMode 0x500B
880 #define PTP_DPC_FlashMode 0x500C
881 #define PTP_DPC_ExposureTime 0x500D
882 #define PTP_DPC_ExposureProgramMode 0x500E
883 #define PTP_DPC_ExposureIndex 0x500F
884 #define PTP_DPC_ExposureBiasCompensation 0x5010
885 #define PTP_DPC_DateTime 0x5011
886 #define PTP_DPC_CaptureDelay 0x5012
887 #define PTP_DPC_StillCaptureMode 0x5013
888 #define PTP_DPC_Contrast 0x5014
889 #define PTP_DPC_Sharpness 0x5015
890 #define PTP_DPC_DigitalZoom 0x5016
891 #define PTP_DPC_EffectMode 0x5017
892 #define PTP_DPC_BurstNumber 0x5018
893 #define PTP_DPC_BurstInterval 0x5019
894 #define PTP_DPC_TimelapseNumber 0x501A
895 #define PTP_DPC_TimelapseInterval 0x501B
896 #define PTP_DPC_FocusMeteringMode 0x501C
897 #define PTP_DPC_UploadURL 0x501D
898 #define PTP_DPC_Artist 0x501E
899 #define PTP_DPC_CopyrightInfo 0x501F
900 
901 /* Proprietary vendor extension device property mask */
902 #define PTP_DPC_EXTENSION_MASK 0xF000
903 #define PTP_DPC_EXTENSION 0xD000
904 
905 /* Zune extension device property codes */
906 #define PTP_DPC_MTP_ZUNE_UNKNOWN1 0xD181
907 #define PTP_DPC_MTP_ZUNE_UNKNOWN2 0xD132
908 #define PTP_DPC_MTP_ZUNE_UNKNOWN3 0xD215
909 #define PTP_DPC_MTP_ZUNE_UNKNOWN4 0xD216
910 
911 /* Eastman Kodak extension device property codes */
912 #define PTP_DPC_EK_ColorTemperature 0xD001
913 #define PTP_DPC_EK_DateTimeStampFormat 0xD002
914 #define PTP_DPC_EK_BeepMode 0xD003
915 #define PTP_DPC_EK_VideoOut 0xD004
916 #define PTP_DPC_EK_PowerSaving 0xD005
917 #define PTP_DPC_EK_UI_Language 0xD006
918 /* Canon extension device property codes */
919 #define PTP_DPC_CANON_BeepMode 0xD001
920 #define PTP_DPC_CANON_ViewfinderMode 0xD003
921 #define PTP_DPC_CANON_ImageQuality 0xD006
922 #define PTP_DPC_CANON_D007 0xD007
923 #define PTP_DPC_CANON_ImageSize 0xD008
924 #define PTP_DPC_CANON_FlashMode 0xD00A
925 #define PTP_DPC_CANON_ShootingMode 0xD00C
926 #define PTP_DPC_CANON_DriveMode 0xD00E
927 #define PTP_DPC_CANON_MeteringMode 0xD010
928 #define PTP_DPC_CANON_AFDistance 0xD011
929 #define PTP_DPC_CANON_FocusingPoint 0xD012
930 #define PTP_DPC_CANON_WhiteBalance 0xD013
931 #define PTP_DPC_CANON_ISOSpeed 0xD01C
932 #define PTP_DPC_CANON_Aperture 0xD01D
933 #define PTP_DPC_CANON_ShutterSpeed 0xD01E
934 #define PTP_DPC_CANON_ExpCompensation 0xD01F
935 
936  /* capture data type (?) */
937 #define PTP_DPC_CANON_D029 0xD029
938 #define PTP_DPC_CANON_Zoom 0xD02A
939 #define PTP_DPC_CANON_SizeQualityMode 0xD02C
940 #define PTP_DPC_CANON_FirmwareVersion 0xD031
941 #define PTP_DPC_CANON_CameraModel 0xD032
942 #define PTP_DPC_CANON_CameraOwner 0xD033
943 #define PTP_DPC_CANON_UnixTime 0xD034
944 #define PTP_DPC_CANON_DZoomMagnification 0xD039
945 #define PTP_DPC_CANON_PhotoEffect 0xD040
946 #define PTP_DPC_CANON_AssistLight 0xD041
947 #define PTP_DPC_CANON_D045 0xD045
948 #define PTP_DPC_CANON_AverageFilesizes 0xD048
949 
950 /* Nikon extension device property codes */
951 #define PTP_DPC_NIKON_ShootingBank 0xD010
952 #define PTP_DPC_NIKON_ShootingBankNameA 0xD011
953 #define PTP_DPC_NIKON_ShootingBankNameB 0xD012
954 #define PTP_DPC_NIKON_ShootingBankNameC 0xD013
955 #define PTP_DPC_NIKON_ShootingBankNameD 0xD014
956 #define PTP_DPC_NIKON_RawCompression 0xD016
957 #define PTP_DPC_NIKON_WhiteBalanceAutoBias 0xD017
958 #define PTP_DPC_NIKON_WhiteBalanceTungstenBias 0xD018
959 #define PTP_DPC_NIKON_WhiteBalanceFluorescentBias 0xD019
960 #define PTP_DPC_NIKON_WhiteBalanceDaylightBias 0xD01A
961 #define PTP_DPC_NIKON_WhiteBalanceFlashBias 0xD01B
962 #define PTP_DPC_NIKON_WhiteBalanceCloudyBias 0xD01C
963 #define PTP_DPC_NIKON_WhiteBalanceShadeBias 0xD01D
964 #define PTP_DPC_NIKON_WhiteBalanceColorTemperature 0xD01E
965 #define PTP_DPC_NIKON_ImageSharpening 0xD02A
966 #define PTP_DPC_NIKON_ToneCompensation 0xD02B
967 #define PTP_DPC_NIKON_ColorModel 0xD02C
968 #define PTP_DPC_NIKON_HueAdjustment 0xD02D
969 #define PTP_DPC_NIKON_NonCPULensDataFocalLength 0xD02E
970 #define PTP_DPC_NIKON_NonCPULensDataMaximumAperture 0xD02F
971 #define PTP_DPC_NIKON_CSMMenuBankSelect 0xD040
972 #define PTP_DPC_NIKON_MenuBankNameA 0xD041
973 #define PTP_DPC_NIKON_MenuBankNameB 0xD042
974 #define PTP_DPC_NIKON_MenuBankNameC 0xD043
975 #define PTP_DPC_NIKON_MenuBankNameD 0xD044
976 #define PTP_DPC_NIKON_A1AFCModePriority 0xD048
977 #define PTP_DPC_NIKON_A2AFSModePriority 0xD049
978 #define PTP_DPC_NIKON_A3GroupDynamicAF 0xD04A
979 #define PTP_DPC_NIKON_A4AFActivation 0xD04B
980 #define PTP_DPC_NIKON_A5FocusAreaIllumManualFocus 0xD04C
981 #define PTP_DPC_NIKON_FocusAreaIllumContinuous 0xD04D
982 #define PTP_DPC_NIKON_FocusAreaIllumWhenSelected 0xD04E
983 #define PTP_DPC_NIKON_FocusAreaWrap 0xD04F
984 #define PTP_DPC_NIKON_A7VerticalAFON 0xD050
985 #define PTP_DPC_NIKON_ISOAuto 0xD054
986 #define PTP_DPC_NIKON_B2ISOStep 0xD055
987 #define PTP_DPC_NIKON_EVStep 0xD056
988 #define PTP_DPC_NIKON_B4ExposureCompEv 0xD057
989 #define PTP_DPC_NIKON_ExposureCompensation 0xD058
990 #define PTP_DPC_NIKON_CenterWeightArea 0xD059
991 #define PTP_DPC_NIKON_AELockMode 0xD05E
992 #define PTP_DPC_NIKON_AELAFLMode 0xD05F
993 #define PTP_DPC_NIKON_MeterOff 0xD062
994 #define PTP_DPC_NIKON_SelfTimer 0xD063
995 #define PTP_DPC_NIKON_MonitorOff 0xD064
996 #define PTP_DPC_NIKON_D1ShootingSpeed 0xD068
997 #define PTP_DPC_NIKON_D2MaximumShots 0xD069
998 #define PTP_DPC_NIKON_D3ExpDelayMode 0xD06A
999 #define PTP_DPC_NIKON_LongExposureNoiseReduction 0xD06B
1000 #define PTP_DPC_NIKON_FileNumberSequence 0xD06C
1001 #define PTP_DPC_NIKON_D6ControlPanelFinderRearControl 0xD06D
1002 #define PTP_DPC_NIKON_ControlPanelFinderViewfinder 0xD06E
1003 #define PTP_DPC_NIKON_D7Illumination 0xD06F
1004 #define PTP_DPC_NIKON_E1FlashSyncSpeed 0xD074
1005 #define PTP_DPC_NIKON_FlashShutterSpeed 0xD075
1006 #define PTP_DPC_NIKON_E3AAFlashMode 0xD076
1007 #define PTP_DPC_NIKON_E4ModelingFlash 0xD077
1008 #define PTP_DPC_NIKON_BracketSet 0xD078
1009 #define PTP_DPC_NIKON_E6ManualModeBracketing 0xD079
1010 #define PTP_DPC_NIKON_BracketOrder 0xD07A
1011 #define PTP_DPC_NIKON_E8AutoBracketSelection 0xD07B
1012 #define PTP_DPC_NIKON_BracketingSet 0xD07C
1013 #define PTP_DPC_NIKON_F1CenterButtonShootingMode 0xD080
1014 #define PTP_DPC_NIKON_CenterButtonPlaybackMode 0xD081
1015 #define PTP_DPC_NIKON_F2Multiselector 0xD082
1016 #define PTP_DPC_NIKON_F3PhotoInfoPlayback 0xD083
1017 #define PTP_DPC_NIKON_F4AssignFuncButton 0xD084
1018 #define PTP_DPC_NIKON_F5CustomizeCommDials 0xD085
1019 #define PTP_DPC_NIKON_ReverseCommandDial 0xD086
1020 #define PTP_DPC_NIKON_ApertureSetting 0xD087
1021 #define PTP_DPC_NIKON_MenusAndPlayback 0xD088
1022 #define PTP_DPC_NIKON_F6ButtonsAndDials 0xD089
1023 #define PTP_DPC_NIKON_NoCFCard 0xD08A
1024 #define PTP_DPC_NIKON_ImageCommentString 0xD090
1025 #define PTP_DPC_NIKON_ImageCommentAttach 0xD091
1026 #define PTP_DPC_NIKON_ImageRotation 0xD092
1027 #define PTP_DPC_NIKON_Bracketing 0xD0C0
1028 #define PTP_DPC_NIKON_ExposureBracketingIntervalDist 0xD0C1
1029 #define PTP_DPC_NIKON_BracketingProgram 0xD0C2
1030 #define PTP_DPC_NIKON_WhiteBalanceBracketStep 0xD0C4
1031 #define PTP_DPC_NIKON_LensID 0xD0E0
1032 #define PTP_DPC_NIKON_FocalLengthMin 0xD0E3
1033 #define PTP_DPC_NIKON_FocalLengthMax 0xD0E4
1034 #define PTP_DPC_NIKON_MaxApAtMinFocalLength 0xD0E5
1035 #define PTP_DPC_NIKON_MaxApAtMaxFocalLength 0xD0E6
1036 #define PTP_DPC_NIKON_ExposureTime 0xD100
1037 #define PTP_DPC_NIKON_ACPower 0xD101
1038 #define PTP_DPC_NIKON_MaximumShots 0xD103
1039 #define PTP_DPC_NIKON_AFLLock 0xD104
1040 #define PTP_DPC_NIKON_AutoExposureLock 0xD105
1041 #define PTP_DPC_NIKON_AutoFocusLock 0xD106
1042 #define PTP_DPC_NIKON_AutofocusLCDTopMode2 0xD107
1043 #define PTP_DPC_NIKON_AutofocusArea 0xD108
1044 #define PTP_DPC_NIKON_LightMeter 0xD10A
1045 #define PTP_DPC_NIKON_CameraOrientation 0xD10E
1046 #define PTP_DPC_NIKON_ExposureApertureLock 0xD111
1047 #define PTP_DPC_NIKON_FlashExposureCompensation 0xD126
1048 #define PTP_DPC_NIKON_OptimizeImage 0xD140
1049 #define PTP_DPC_NIKON_Saturation 0xD142
1050 #define PTP_DPC_NIKON_BeepOff 0xD160
1051 #define PTP_DPC_NIKON_AutofocusMode 0xD161
1052 #define PTP_DPC_NIKON_AFAssist 0xD163
1053 #define PTP_DPC_NIKON_PADVPMode 0xD164
1054 #define PTP_DPC_NIKON_ImageReview 0xD165
1055 #define PTP_DPC_NIKON_AFAreaIllumination 0xD166
1056 #define PTP_DPC_NIKON_FlashMode 0xD167
1057 #define PTP_DPC_NIKON_FlashCommanderMode 0xD168
1058 #define PTP_DPC_NIKON_FlashSign 0xD169
1059 #define PTP_DPC_NIKON_RemoteTimeout 0xD16B
1060 #define PTP_DPC_NIKON_GridDisplay 0xD16C
1061 #define PTP_DPC_NIKON_FlashModeManualPower 0xD16D
1062 #define PTP_DPC_NIKON_FlashModeCommanderPower 0xD16E
1063 #define PTP_DPC_NIKON_CSMMenu 0xD180
1064 #define PTP_DPC_NIKON_BracketingFramesAndSteps 0xD190
1065 #define PTP_DPC_NIKON_LowLight 0xD1B0
1066 #define PTP_DPC_NIKON_FlashOpen 0xD1C0
1067 #define PTP_DPC_NIKON_FlashCharged 0xD1C1
1068 
1069 /* Microsoft/MTP specific */
1070 #define PTP_DPC_MTP_SecureTime 0xD101
1071 #define PTP_DPC_MTP_DeviceCertificate 0xD102
1072 #define PTP_DPC_MTP_RevocationInfo 0xD103
1073 #define PTP_DPC_MTP_SynchronizationPartner 0xD401
1074 #define PTP_DPC_MTP_DeviceFriendlyName 0xD402
1075 #define PTP_DPC_MTP_VolumeLevel 0xD403
1076 #define PTP_DPC_MTP_DeviceIcon 0xD405
1077 #define PTP_DPC_MTP_PlaybackRate 0xD410
1078 #define PTP_DPC_MTP_PlaybackObject 0xD411
1079 #define PTP_DPC_MTP_PlaybackContainerIndex 0xD412
1080 #define PTP_DPC_MTP_PlaybackPosition 0xD413
1081 #define PTP_DPC_MTP_PlaysForSureID 0xD131
1082 
1083 /* Zune specific property codes */
1084 #define PTP_DPC_MTP_Zune_UnknownVersion 0xD181
1085 
1086 /* MTP specific Object Properties */
1087 #define PTP_OPC_StorageID 0xDC01
1088 #define PTP_OPC_ObjectFormat 0xDC02
1089 #define PTP_OPC_ProtectionStatus 0xDC03
1090 #define PTP_OPC_ObjectSize 0xDC04
1091 #define PTP_OPC_AssociationType 0xDC05
1092 #define PTP_OPC_AssociationDesc 0xDC06
1093 #define PTP_OPC_ObjectFileName 0xDC07
1094 #define PTP_OPC_DateCreated 0xDC08
1095 #define PTP_OPC_DateModified 0xDC09
1096 #define PTP_OPC_Keywords 0xDC0A
1097 #define PTP_OPC_ParentObject 0xDC0B
1098 #define PTP_OPC_AllowedFolderContents 0xDC0C
1099 #define PTP_OPC_Hidden 0xDC0D
1100 #define PTP_OPC_SystemObject 0xDC0E
1101 #define PTP_OPC_PersistantUniqueObjectIdentifier 0xDC41
1102 #define PTP_OPC_SyncID 0xDC42
1103 #define PTP_OPC_PropertyBag 0xDC43
1104 #define PTP_OPC_Name 0xDC44
1105 #define PTP_OPC_CreatedBy 0xDC45
1106 #define PTP_OPC_Artist 0xDC46
1107 #define PTP_OPC_DateAuthored 0xDC47
1108 #define PTP_OPC_Description 0xDC48
1109 #define PTP_OPC_URLReference 0xDC49
1110 #define PTP_OPC_LanguageLocale 0xDC4A
1111 #define PTP_OPC_CopyrightInformation 0xDC4B
1112 #define PTP_OPC_Source 0xDC4C
1113 #define PTP_OPC_OriginLocation 0xDC4D
1114 #define PTP_OPC_DateAdded 0xDC4E
1115 #define PTP_OPC_NonConsumable 0xDC4F
1116 #define PTP_OPC_CorruptOrUnplayable 0xDC50
1117 #define PTP_OPC_ProducerSerialNumber 0xDC51
1118 #define PTP_OPC_RepresentativeSampleFormat 0xDC81
1119 #define PTP_OPC_RepresentativeSampleSize 0xDC82
1120 #define PTP_OPC_RepresentativeSampleHeight 0xDC83
1121 #define PTP_OPC_RepresentativeSampleWidth 0xDC84
1122 #define PTP_OPC_RepresentativeSampleDuration 0xDC85
1123 #define PTP_OPC_RepresentativeSampleData 0xDC86
1124 #define PTP_OPC_Width 0xDC87
1125 #define PTP_OPC_Height 0xDC88
1126 #define PTP_OPC_Duration 0xDC89
1127 #define PTP_OPC_Rating 0xDC8A
1128 #define PTP_OPC_Track 0xDC8B
1129 #define PTP_OPC_Genre 0xDC8C
1130 #define PTP_OPC_Credits 0xDC8D
1131 #define PTP_OPC_Lyrics 0xDC8E
1132 #define PTP_OPC_SubscriptionContentID 0xDC8F
1133 #define PTP_OPC_ProducedBy 0xDC90
1134 #define PTP_OPC_UseCount 0xDC91
1135 #define PTP_OPC_SkipCount 0xDC92
1136 #define PTP_OPC_LastAccessed 0xDC93
1137 #define PTP_OPC_ParentalRating 0xDC94
1138 #define PTP_OPC_MetaGenre 0xDC95
1139 #define PTP_OPC_Composer 0xDC96
1140 #define PTP_OPC_EffectiveRating 0xDC97
1141 #define PTP_OPC_Subtitle 0xDC98
1142 #define PTP_OPC_OriginalReleaseDate 0xDC99
1143 #define PTP_OPC_AlbumName 0xDC9A
1144 #define PTP_OPC_AlbumArtist 0xDC9B
1145 #define PTP_OPC_Mood 0xDC9C
1146 #define PTP_OPC_DRMStatus 0xDC9D
1147 #define PTP_OPC_SubDescription 0xDC9E
1148 #define PTP_OPC_IsCropped 0xDCD1
1149 #define PTP_OPC_IsColorCorrected 0xDCD2
1150 #define PTP_OPC_ImageBitDepth 0xDCD3
1151 #define PTP_OPC_Fnumber 0xDCD4
1152 #define PTP_OPC_ExposureTime 0xDCD5
1153 #define PTP_OPC_ExposureIndex 0xDCD6
1154 #define PTP_OPC_DisplayName 0xDCE0
1155 #define PTP_OPC_BodyText 0xDCE1
1156 #define PTP_OPC_Subject 0xDCE2
1157 #define PTP_OPC_Prority 0xDCE3
1158 #define PTP_OPC_GivenName 0xDD00
1159 #define PTP_OPC_MiddleNames 0xDD01
1160 #define PTP_OPC_FamilyName 0xDD02
1161 #define PTP_OPC_Prefix 0xDD03
1162 #define PTP_OPC_Suffix 0xDD04
1163 #define PTP_OPC_PhoneticGivenName 0xDD05
1164 #define PTP_OPC_PhoneticFamilyName 0xDD06
1165 #define PTP_OPC_EmailPrimary 0xDD07
1166 #define PTP_OPC_EmailPersonal1 0xDD08
1167 #define PTP_OPC_EmailPersonal2 0xDD09
1168 #define PTP_OPC_EmailBusiness1 0xDD0A
1169 #define PTP_OPC_EmailBusiness2 0xDD0B
1170 #define PTP_OPC_EmailOthers 0xDD0C
1171 #define PTP_OPC_PhoneNumberPrimary 0xDD0D
1172 #define PTP_OPC_PhoneNumberPersonal 0xDD0E
1173 #define PTP_OPC_PhoneNumberPersonal2 0xDD0F
1174 #define PTP_OPC_PhoneNumberBusiness 0xDD10
1175 #define PTP_OPC_PhoneNumberBusiness2 0xDD11
1176 #define PTP_OPC_PhoneNumberMobile 0xDD12
1177 #define PTP_OPC_PhoneNumberMobile2 0xDD13
1178 #define PTP_OPC_FaxNumberPrimary 0xDD14
1179 #define PTP_OPC_FaxNumberPersonal 0xDD15
1180 #define PTP_OPC_FaxNumberBusiness 0xDD16
1181 #define PTP_OPC_PagerNumber 0xDD17
1182 #define PTP_OPC_PhoneNumberOthers 0xDD18
1183 #define PTP_OPC_PrimaryWebAddress 0xDD19
1184 #define PTP_OPC_PersonalWebAddress 0xDD1A
1185 #define PTP_OPC_BusinessWebAddress 0xDD1B
1186 #define PTP_OPC_InstantMessengerAddress 0xDD1C
1187 #define PTP_OPC_InstantMessengerAddress2 0xDD1D
1188 #define PTP_OPC_InstantMessengerAddress3 0xDD1E
1189 #define PTP_OPC_PostalAddressPersonalFull 0xDD1F
1190 #define PTP_OPC_PostalAddressPersonalFullLine1 0xDD20
1191 #define PTP_OPC_PostalAddressPersonalFullLine2 0xDD21
1192 #define PTP_OPC_PostalAddressPersonalFullCity 0xDD22
1193 #define PTP_OPC_PostalAddressPersonalFullRegion 0xDD23
1194 #define PTP_OPC_PostalAddressPersonalFullPostalCode 0xDD24
1195 #define PTP_OPC_PostalAddressPersonalFullCountry 0xDD25
1196 #define PTP_OPC_PostalAddressBusinessFull 0xDD26
1197 #define PTP_OPC_PostalAddressBusinessLine1 0xDD27
1198 #define PTP_OPC_PostalAddressBusinessLine2 0xDD28
1199 #define PTP_OPC_PostalAddressBusinessCity 0xDD29
1200 #define PTP_OPC_PostalAddressBusinessRegion 0xDD2A
1201 #define PTP_OPC_PostalAddressBusinessPostalCode 0xDD2B
1202 #define PTP_OPC_PostalAddressBusinessCountry 0xDD2C
1203 #define PTP_OPC_PostalAddressOtherFull 0xDD2D
1204 #define PTP_OPC_PostalAddressOtherLine1 0xDD2E
1205 #define PTP_OPC_PostalAddressOtherLine2 0xDD2F
1206 #define PTP_OPC_PostalAddressOtherCity 0xDD30
1207 #define PTP_OPC_PostalAddressOtherRegion 0xDD31
1208 #define PTP_OPC_PostalAddressOtherPostalCode 0xDD32
1209 #define PTP_OPC_PostalAddressOtherCountry 0xDD33
1210 #define PTP_OPC_OrganizationName 0xDD34
1211 #define PTP_OPC_PhoneticOrganizationName 0xDD35
1212 #define PTP_OPC_Role 0xDD36
1213 #define PTP_OPC_Birthdate 0xDD37
1214 #define PTP_OPC_MessageTo 0xDD40
1215 #define PTP_OPC_MessageCC 0xDD41
1216 #define PTP_OPC_MessageBCC 0xDD42
1217 #define PTP_OPC_MessageRead 0xDD43
1218 #define PTP_OPC_MessageReceivedTime 0xDD44
1219 #define PTP_OPC_MessageSender 0xDD45
1220 #define PTP_OPC_ActivityBeginTime 0xDD50
1221 #define PTP_OPC_ActivityEndTime 0xDD51
1222 #define PTP_OPC_ActivityLocation 0xDD52
1223 #define PTP_OPC_ActivityRequiredAttendees 0xDD54
1224 #define PTP_OPC_ActivityOptionalAttendees 0xDD55
1225 #define PTP_OPC_ActivityResources 0xDD56
1226 #define PTP_OPC_ActivityAccepted 0xDD57
1227 #define PTP_OPC_Owner 0xDD5D
1228 #define PTP_OPC_Editor 0xDD5E
1229 #define PTP_OPC_Webmaster 0xDD5F
1230 #define PTP_OPC_URLSource 0xDD60
1231 #define PTP_OPC_URLDestination 0xDD61
1232 #define PTP_OPC_TimeBookmark 0xDD62
1233 #define PTP_OPC_ObjectBookmark 0xDD63
1234 #define PTP_OPC_ByteBookmark 0xDD64
1235 #define PTP_OPC_LastBuildDate 0xDD70
1236 #define PTP_OPC_TimetoLive 0xDD71
1237 #define PTP_OPC_MediaGUID 0xDD72
1238 #define PTP_OPC_TotalBitRate 0xDE91
1239 #define PTP_OPC_BitRateType 0xDE92
1240 #define PTP_OPC_SampleRate 0xDE93
1241 #define PTP_OPC_NumberOfChannels 0xDE94
1242 #define PTP_OPC_AudioBitDepth 0xDE95
1243 #define PTP_OPC_ScanDepth 0xDE97
1244 #define PTP_OPC_AudioWAVECodec 0xDE99
1245 #define PTP_OPC_AudioBitRate 0xDE9A
1246 #define PTP_OPC_VideoFourCCCodec 0xDE9B
1247 #define PTP_OPC_VideoBitRate 0xDE9C
1248 #define PTP_OPC_FramesPerThousandSeconds 0xDE9D
1249 #define PTP_OPC_KeyFrameDistance 0xDE9E
1250 #define PTP_OPC_BufferSize 0xDE9F
1251 #define PTP_OPC_EncodingQuality 0xDEA0
1252 #define PTP_OPC_EncodingProfile 0xDEA1
1253 #define PTP_OPC_BuyFlag 0xD901
1254 
1255 /* WiFi Provisioning MTP Extension property codes */
1256 #define PTP_OPC_WirelessConfigurationFile 0xB104
1257 
1258 /* Device Property Form Flag */
1259 
1260 #define PTP_DPFF_None 0x00
1261 #define PTP_DPFF_Range 0x01
1262 #define PTP_DPFF_Enumeration 0x02
1263 
1264 /* Object Property Codes used by MTP (first 3 are same as DPFF codes) */
1265 #define PTP_OPFF_None 0x00
1266 #define PTP_OPFF_Range 0x01
1267 #define PTP_OPFF_Enumeration 0x02
1268 #define PTP_OPFF_DateTime 0x03
1269 #define PTP_OPFF_FixedLengthArray 0x04
1270 #define PTP_OPFF_RegularExpression 0x05
1271 #define PTP_OPFF_ByteArray 0x06
1272 #define PTP_OPFF_LongString 0xFF
1273 
1274 /* Device Property GetSet type */
1275 #define PTP_DPGS_Get 0x00
1276 #define PTP_DPGS_GetSet 0x01
1277 
1278 /* Glue stuff starts here */
1279 
1280 typedef struct _PTPParams PTPParams;
1281 
1282 
1283 typedef uint16_t (* PTPDataGetFunc) (PTPParams* params, void* private,
1284  unsigned long wantlen,
1285  unsigned char *data, unsigned long *gotlen);
1286 
1287 typedef uint16_t (* PTPDataPutFunc) (PTPParams* params, void* private,
1288  unsigned long sendlen,
1289  unsigned char *data, unsigned long *putlen);
1290 typedef struct _PTPDataHandler {
1291  PTPDataGetFunc getfunc;
1292  PTPDataPutFunc putfunc;
1293  void *private;
1294 } PTPDataHandler;
1295 
1296 /*
1297  * This functions take PTP oriented arguments and send them over an
1298  * appropriate data layer doing byteorder conversion accordingly.
1299  */
1300 typedef uint16_t (* PTPIOSendReq) (PTPParams* params, PTPContainer* req);
1301 typedef uint16_t (* PTPIOSendData) (PTPParams* params, PTPContainer* ptp,
1302  unsigned long size, PTPDataHandler*getter);
1303 
1304 typedef uint16_t (* PTPIOGetResp) (PTPParams* params, PTPContainer* resp);
1305 typedef uint16_t (* PTPIOGetData) (PTPParams* params, PTPContainer* ptp,
1306  PTPDataHandler *putter);
1307 /* debug functions */
1308 typedef void (* PTPErrorFunc) (void *data, const char *format, va_list args)
1309 #if (__GNUC__ >= 3)
1310  __attribute__((__format__(printf,2,0)))
1311 #endif
1312 ;
1313 typedef void (* PTPDebugFunc) (void *data, const char *format, va_list args)
1314 #if (__GNUC__ >= 3)
1315  __attribute__((__format__(printf,2,0)))
1316 #endif
1317 ;
1318 
1319 struct _PTPParams {
1320  /* data layer byteorder */
1321  uint8_t byteorder;
1322  uint16_t maxpacketsize;
1323 
1324  /* PTP IO: Custom IO functions */
1325  PTPIOSendReq sendreq_func;
1326  PTPIOSendData senddata_func;
1327  PTPIOGetResp getresp_func;
1328  PTPIOGetData getdata_func;
1329  PTPIOGetResp event_check;
1330  PTPIOGetResp event_wait;
1331 
1332  /* Custom error and debug function */
1333  PTPErrorFunc error_func;
1334  PTPDebugFunc debug_func;
1335 
1336  /* Data passed to above functions */
1337  void *data;
1338 
1339  /* ptp transaction ID */
1340  uint32_t transaction_id;
1341  /* ptp session ID */
1342  uint32_t session_id;
1343 
1344  /* PTP IO: if we have MTP style split header/data transfers */
1345  int split_header_data;
1346 
1347  /* PTP: MTP specific structure. */
1348  MTPPropList *proplist;
1349 
1350  /* PTP: internal structures used by ptp driver */
1351  PTPObjectHandles handles;
1352  PTPObjectInfo *objectinfo;
1353  PTPDeviceInfo deviceinfo;
1354 
1355  /* PTP: Canon specific flags list */
1356  uint32_t *canon_flags; /* size(handles.n) */
1357 
1358  /* PTP: Wifi profiles */
1359  uint8_t wifi_profiles_version;
1360  uint8_t wifi_profiles_number;
1361  PTPNIKONWifiProfile *wifi_profiles;
1362 
1363  /* IO: PTP/IP related data */
1364  int cmdfd, evtfd;
1365  uint8_t cameraguid[16];
1366  uint32_t eventpipeid;
1367  char *cameraname;
1368 
1369  /* PTP: iconv converters */
1370  iconv_t cd_locale_to_ucs2;
1371  iconv_t cd_ucs2_to_locale;
1372 
1373  /* IO: Sometimes the response packet get send in the dataphase
1374  * too. This only happens for a Samsung player now.
1375  */
1376  uint8_t *response_packet;
1377  uint16_t response_packet_size;
1378 };
1379 
1380 /* last, but not least - ptp functions */
1381 uint16_t ptp_usb_sendreq (PTPParams* params, PTPContainer* req);
1382 uint16_t ptp_usb_senddata (PTPParams* params, PTPContainer* ptp,
1383  unsigned long size, PTPDataHandler *handler);
1384 uint16_t ptp_usb_getresp (PTPParams* params, PTPContainer* resp);
1385 uint16_t ptp_usb_getdata (PTPParams* params, PTPContainer* ptp,
1386  PTPDataHandler *handler);
1387 uint16_t ptp_usb_event_check (PTPParams* params, PTPContainer* event);
1388 uint16_t ptp_usb_event_wait (PTPParams* params, PTPContainer* event);
1389 
1390 int ptp_ptpip_connect (PTPParams* params, const char *port);
1391 uint16_t ptp_ptpip_sendreq (PTPParams* params, PTPContainer* req);
1392 uint16_t ptp_ptpip_senddata (PTPParams* params, PTPContainer* ptp,
1393  unsigned long size, PTPDataHandler *handler);
1394 uint16_t ptp_ptpip_getresp (PTPParams* params, PTPContainer* resp);
1395 uint16_t ptp_ptpip_getdata (PTPParams* params, PTPContainer* ptp,
1396  PTPDataHandler *handler);
1397 uint16_t ptp_ptpip_event_wait (PTPParams* params, PTPContainer* event);
1398 uint16_t ptp_ptpip_event_check (PTPParams* params, PTPContainer* event);
1399 
1400 uint16_t ptp_getdeviceinfo (PTPParams* params, PTPDeviceInfo* deviceinfo);
1401 
1402 uint16_t ptp_opensession (PTPParams *params, uint32_t session);
1403 uint16_t ptp_closesession (PTPParams *params);
1404 
1405 uint16_t ptp_getstorageids (PTPParams* params, PTPStorageIDs* storageids);
1406 uint16_t ptp_getstorageinfo (PTPParams* params, uint32_t storageid,
1407  PTPStorageInfo* storageinfo);
1408 uint16_t ptp_formatstore (PTPParams* params, uint32_t storageid);
1409 
1410 uint16_t ptp_getobjecthandles (PTPParams* params, uint32_t storage,
1411  uint32_t objectformatcode,
1412  uint32_t associationOH,
1413  PTPObjectHandles* objecthandles);
1414 
1415 uint16_t ptp_getnumobjects (PTPParams* params, uint32_t storage,
1416  uint32_t objectformatcode,
1417  uint32_t associationOH,
1418  uint32_t* numobs);
1419 
1420 uint16_t ptp_getobjectinfo (PTPParams *params, uint32_t handle,
1421  PTPObjectInfo* objectinfo);
1422 
1423 uint16_t ptp_getobject (PTPParams *params, uint32_t handle,
1424  unsigned char** object);
1425 uint16_t ptp_getobject_tofd (PTPParams* params, uint32_t handle, int fd);
1426 uint16_t ptp_getobject_to_handler (PTPParams* params, uint32_t handle, PTPDataHandler*);
1427 uint16_t ptp_getpartialobject (PTPParams* params, uint32_t handle, uint32_t offset,
1428  uint32_t maxbytes, unsigned char** object);
1429 uint16_t ptp_getthumb (PTPParams *params, uint32_t handle,
1430  unsigned char** object);
1431 
1432 uint16_t ptp_deleteobject (PTPParams* params, uint32_t handle,
1433  uint32_t ofc);
1434 
1435 uint16_t ptp_sendobjectinfo (PTPParams* params, uint32_t* store,
1436  uint32_t* parenthandle, uint32_t* handle,
1437  PTPObjectInfo* objectinfo);
1438 uint16_t ptp_sendobject (PTPParams* params, unsigned char* object,
1439  uint32_t size);
1440 uint16_t ptp_sendobject_fromfd (PTPParams* params, int fd, uint32_t size);
1441 uint16_t ptp_sendobject_from_handler (PTPParams* params, PTPDataHandler*, uint32_t size);
1442 
1443 uint16_t ptp_initiatecapture (PTPParams* params, uint32_t storageid,
1444  uint32_t ofc);
1445 
1446 uint16_t ptp_getdevicepropdesc (PTPParams* params, uint16_t propcode,
1447  PTPDevicePropDesc *devicepropertydesc);
1448 uint16_t ptp_getdevicepropvalue (PTPParams* params, uint16_t propcode,
1449  PTPPropertyValue* value, uint16_t datatype);
1450 uint16_t ptp_setdevicepropvalue (PTPParams* params, uint16_t propcode,
1451  PTPPropertyValue* value, uint16_t datatype);
1452 
1453 /* Microsoft MTP extensions */
1454 uint16_t ptp_mtp_getobjectpropdesc (PTPParams* params, uint16_t opc, uint16_t ofc,
1455  PTPObjectPropDesc *objectpropertydesc);
1456 uint16_t ptp_mtp_getobjectpropvalue (PTPParams* params, uint32_t oid, uint16_t opc,
1457  PTPPropertyValue *value, uint16_t datatype);
1458 uint16_t ptp_mtp_setobjectpropvalue (PTPParams* params, uint32_t oid, uint16_t opc,
1459  PTPPropertyValue *value, uint16_t datatype);
1460 uint16_t ptp_mtp_getobjectreferences (PTPParams* params, uint32_t handle, uint32_t** ohArray, uint32_t* arraylen);
1461 uint16_t ptp_mtp_setobjectreferences (PTPParams* params, uint32_t handle, uint32_t* ohArray, uint32_t arraylen);
1462 uint16_t ptp_mtp_getobjectproplist (PTPParams* params, uint32_t handle, MTPPropList **proplist);
1463 uint16_t ptp_mtp_sendobjectproplist (PTPParams* params, uint32_t* store, uint32_t* parenthandle, uint32_t* handle,
1464  uint16_t objecttype, uint64_t objectsize, MTPPropList *proplist);
1465 
1466 /* Eastman Kodak extensions */
1467 uint16_t ptp_ek_9007 (PTPParams* params, unsigned char **serial, unsigned int *size);
1468 uint16_t ptp_ek_9009 (PTPParams* params, uint32_t*, uint32_t*);
1469 uint16_t ptp_ek_900c (PTPParams* params, unsigned char **serial, unsigned int *size);
1470 uint16_t ptp_ek_getserial (PTPParams* params, unsigned char **serial, unsigned int *size);
1471 uint16_t ptp_ek_setserial (PTPParams* params, unsigned char *serial, uint32_t size);
1472 uint16_t ptp_ek_settext (PTPParams* params, PTPEKTextParams *text);
1473 uint16_t ptp_ek_sendfileobjectinfo (PTPParams* params, uint32_t* store,
1474  uint32_t* parenthandle, uint32_t* handle,
1475  PTPObjectInfo* objectinfo);
1476 uint16_t ptp_ek_sendfileobject (PTPParams* params, unsigned char* object,
1477  uint32_t size);
1478 uint16_t ptp_ek_sendfileobject_from_handler (PTPParams* params, PTPDataHandler*,
1479  uint32_t size);
1480 
1481 /* Canon PTP extensions */
1482 uint16_t ptp_canon_9012 (PTPParams* params);
1483 uint16_t ptp_canon_initiate_direct_transfer (PTPParams* params, uint32_t* out);
1484 uint16_t ptp_canon_get_target_handles (PTPParams* params, PTPCanon_directtransfer_entry**, unsigned int*cnt);
1485 uint16_t ptp_canon_getpartialobjectinfo (PTPParams* params, uint32_t handle,
1486  uint32_t p2, uint32_t* size, uint32_t* rp2);
1487 
1488 uint16_t ptp_canon_get_mac_address (PTPParams* params, unsigned char **mac);
1489 uint16_t ptp_canon_startshootingmode (PTPParams* params);
1490 uint16_t ptp_canon_endshootingmode (PTPParams* params);
1491 
1492 uint16_t ptp_canon_viewfinderon (PTPParams* params);
1493 uint16_t ptp_canon_viewfinderoff (PTPParams* params);
1494 
1495 uint16_t ptp_canon_aeafawb (PTPParams* params, uint32_t p1);
1496 uint16_t ptp_canon_checkevent (PTPParams* params,
1497  PTPUSBEventContainer* event, int* isevent);
1498 uint16_t ptp_canon_focuslock (PTPParams* params);
1499 uint16_t ptp_canon_focusunlock (PTPParams* params);
1500 uint16_t ptp_canon_initiatecaptureinmemory (PTPParams* params);
1501 uint16_t ptp_canon_getpartialobject (PTPParams* params, uint32_t handle,
1502  uint32_t offset, uint32_t size,
1503  uint32_t pos, unsigned char** block,
1504  uint32_t* readnum);
1505 uint16_t ptp_canon_getviewfinderimage (PTPParams* params, unsigned char** image,
1506  uint32_t* size);
1507 uint16_t ptp_canon_getchanges (PTPParams* params, uint16_t** props,
1508  uint32_t* propnum);
1509 uint16_t ptp_canon_getobjectinfo (PTPParams* params, uint32_t store,
1510  uint32_t p2, uint32_t parenthandle,
1511  uint32_t handle,
1512  PTPCANONFolderEntry** entries,
1513  uint32_t* entnum);
1514 uint16_t ptp_canon_get_objecthandle_by_name (PTPParams* params, char* name, uint32_t* objectid);
1515 uint16_t ptp_canon_get_directory (PTPParams* params, PTPObjectHandles *handles, PTPObjectInfo **oinfos, uint32_t **flags);
1516 uint16_t ptp_canon_setobjectarchive (PTPParams* params, uint32_t oid, uint32_t flags);
1517 uint16_t ptp_canon_get_customize_data (PTPParams* params, uint32_t themenr,
1518  unsigned char **data, unsigned int *size);
1519 
1520 
1521 uint16_t ptp_nikon_curve_download (PTPParams* params,
1522  unsigned char **data, unsigned int *size);
1523 uint16_t ptp_nikon_getptpipinfo (PTPParams* params, unsigned char **data, unsigned int *size);
1524 uint16_t ptp_nikon_getwifiprofilelist (PTPParams* params);
1525 uint16_t ptp_nikon_writewifiprofile (PTPParams* params, PTPNIKONWifiProfile* profile);
1526 uint16_t ptp_nikon_deletewifiprofile (PTPParams* params, uint32_t profilenr);
1527 uint16_t ptp_nikon_setcontrolmode (PTPParams* params, uint32_t mode);
1528 uint16_t ptp_nikon_capture (PTPParams* params, uint32_t x);
1529 uint16_t ptp_nikon_check_event (PTPParams* params, PTPUSBEventContainer **evt, int *evtcnt);
1530 uint16_t ptp_nikon_getfileinfoinblock (PTPParams* params, uint32_t p1, uint32_t p2, uint32_t p3,
1531  unsigned char **data, unsigned int *size);
1532 uint16_t ptp_nikon_device_ready (PTPParams* params);
1533 uint16_t ptp_mtp_getobjectpropssupported (PTPParams* params, uint16_t ofc, uint32_t *propnum, uint16_t **props);
1534 
1535 /* Non PTP protocol functions */
1536 int ptp_operation_issupported (PTPParams* params, uint16_t operation);
1537 int ptp_event_issupported (PTPParams* params, uint16_t event);
1538 int ptp_property_issupported (PTPParams* params, uint16_t property);
1539 
1540 void ptp_free_devicepropdesc (PTPDevicePropDesc* dpd);
1541 void ptp_free_devicepropvalue (uint16_t dt, PTPPropertyValue* dpd);
1542 void ptp_free_objectpropdesc (PTPObjectPropDesc* dpd);
1543 void ptp_free_params (PTPParams *params);
1544 
1545 void ptp_perror (PTPParams* params, uint16_t error);
1546 
1547 const char*
1548 ptp_get_property_description(PTPParams* params, uint16_t dpc);
1549 
1550 int
1551 ptp_render_property_value(PTPParams* params, uint16_t dpc,
1552  PTPDevicePropDesc *dpd, int length, char *out);
1553 int ptp_render_ofc(PTPParams* params, uint16_t ofc, int spaceleft, char *txt);
1554 int ptp_render_opcode(PTPParams* params, uint16_t opcode, int spaceleft, char *txt);
1555 int ptp_render_mtp_propname(uint16_t propid, int spaceleft, char *txt);
1556 
1557 /* ptpip.c */
1558 void ptp_nikon_getptpipguid (unsigned char* guid);
1559 #endif /* __PTP_H__ */
Definition: ptp.h:756
Definition: ptp.h:695
Definition: ptp.h:518
Definition: ptp.h:713
Definition: ptp.h:798
Definition: ptp.h:133
Definition: ptp.h:1290
Definition: ptp.h:777
Definition: ptp.h:806
Definition: ptp.h:460
Definition: ptp.h:92
Definition: ptp.h:103
Definition: ptp.h:506
Definition: ptp.h:770
Definition: ptp.h:686
Definition: ptp.h:721
Definition: ptp.h:784
Definition: ptp.h:492
Definition: ptp.h:677
Definition: ptp.h:737
Definition: ptp.h:36
Definition: ptp.h:485
Definition: ptp.h:1319
void ptp_nikon_getptpipguid(unsigned char *guid)
Definition: libmtp.c:4821
Definition: ptp.h:704
Definition: ptp.h:71