camlib
Documentation for camlib is still a work-in-progress
Loading...
Searching...
No Matches
ptp.h
Go to the documentation of this file.
1
2// This file describes Picture Transfer Protocol (ISO 15740)
3// And many vendor opcodes, property codes, and event codes.
4
5#ifndef PTP_H
6#define PTP_H
7
8#include <stdint.h>
9
10#pragma pack(push, 1)
11
12// PTP Packet container types
13#define PTP_PACKET_TYPE_COMMAND 0x1
14#define PTP_PACKET_TYPE_DATA 0x2
15#define PTP_PACKET_TYPE_RESPONSE 0x3
16#define PTP_PACKET_TYPE_EVENT 0x4
17
18// Standard USB-only packet
20 uint32_t length; // length of packet, in bytes
21 uint16_t type; // See PACKET_TYPE_*
22 uint16_t code; // See PTP_OC_*
23 uint32_t transaction;
24
25 // Parameters are only included in command packets,
26 // It is typically considered a part of payload in data packets
27 uint32_t params[5];
28
29 // Payload data follows, if any
30};
31
33 uint32_t length;
34 uint16_t type;
35 uint16_t code;
36 uint32_t transaction;
37
38 uint32_t params[3];
39};
40
42 uint32_t length;
43 uint32_t type;
44 uint32_t params[3];
45};
46
47// TODO: Rename to ptp request container
49 uint32_t length;
50 uint32_t type;
51 uint32_t data_phase;
52 uint16_t code;
53 uint32_t transaction;
54 uint32_t params[5];
55};
56
58 uint32_t length;
59 uint32_t type;
60 uint16_t code;
61 uint32_t transaction;
62 uint32_t params[5];
63};
64
66 uint32_t length;
67 uint32_t type;
68 uint32_t transaction;
69 uint64_t payload_length;
70};
71
73 uint32_t length;
74 uint32_t type;
75 uint32_t transaction;
76};
77
79 uint32_t length;
80 uint32_t type;
81 uint32_t guid1;
82 uint32_t guid2;
83 uint32_t guid3;
84 uint32_t guid4;
85 char device_name[8]; // Size ??
86 uint16_t major_ver;
87 uint16_t minor_ver;
88};
89
90// Standard PTP Operation Codes (OC)
91#define PTP_OC_GetDeviceInfo 0x1001
92#define PTP_OC_OpenSession 0x1002
93#define PTP_OC_CloseSession 0x1003
94#define PTP_OC_GetStorageIDs 0x1004
95#define PTP_OC_GetStorageInfo 0x1005
96#define PTP_OC_GetNumObjects 0x1006
97#define PTP_OC_GetObjectHandles 0x1007
98#define PTP_OC_GetObjectInfo 0x1008
99#define PTP_OC_GetObject 0x1009
100#define PTP_OC_GetThumb 0x100A
101#define PTP_OC_DeleteObject 0x100B
102#define PTP_OC_SendObjectInfo 0x100C
103#define PTP_OC_SendObject 0x100D
104#define PTP_OC_InitiateCapture 0x100E
105#define PTP_OC_FormatStore 0x100F
106#define PTP_OC_ResetDevice 0x1010
107#define PTP_OC_SelfTest 0x1011
108#define PTP_OC_SetObjectProtection 0x1012
109#define PTP_OC_PowerDown 0x1013
110#define PTP_OC_GetDevicePropDesc 0x1014
111#define PTP_OC_GetDevicePropValue 0x1015
112#define PTP_OC_SetDevicePropValue 0x1016
113#define PTP_OC_ResetDevicePropValue 0x1017
114#define PTP_OC_TerminateOpenCapture 0x1018
115#define PTP_OC_MoveObject 0x1019
116#define PTP_OC_CopyObject 0x101A
117#define PTP_OC_GetPartialObject 0x101B
118#define PTP_OC_InitiateOpenCapture 0x101C
119
120// Media Transfer Protocol (MTP) / Microsoft codes
121#define PTP_OC_MTP_GetObjectPropsSupported 0x9801
122#define PTP_OC_MTP_GetObjectPropDesc 0x9802
123#define PTP_OC_MTP_GetObjectPropValue 0x9803
124#define PTP_OC_MTP_SetObjectPropValue 0x9804
125#define PTP_OC_MTP_GetObjPropList 0x9805
126#define PTP_OC_MTP_SetObjPropList 0x9806
127#define PTP_OC_MTP_SendObjectPropList 0x9808
128#define PTP_OC_MTP_GetObjectReferences 0x9810
129#define PTP_OC_MTP_SetObjectReferences 0x9811
130#define PTP_OC_MTP_UpdateDeviceFirmware 0x9812
131#define PTP_OC_MTP_Skip 0x9820
132
133#define PTP_OC_NIKON_Capture 0x90C0
134#define PTP_OC_NIKON_AfCaptureSDRAM 0x90CB
135#define PTP_OC_NIKON_StartLiveView 0x9201
136#define PTP_OC_NIKON_EndLiveView 0x9202
137#define PTP_OC_NIKON_GetEvent 0x90C7
138
139// Non EOS (Canon point and shoot) operation codes
140#define PTP_OC_CANON_ViewFinderOn 0x900B
141#define PTP_OC_CANON_ViewFinderOff 0x900C
142#define PTP_OC_CANON_InitCaptureInRAM 0x901A
143#define PTP_OC_CANON_GetViewFinderImage 0x901D
144#define PTP_OC_CANON_LockUI 0x9004
145#define PTP_OC_CANON_UnlockUI 0x9005
146#define PTP_OC_CANON_DoNothing 0x902F
147
148// EOS specific
149#define PTP_OC_EOS_GetStorageIDs 0x9101
150#define PTP_OC_EOS_GetStorageInfo 0x9102
151#define PTP_OC_EOS_GetObjectInfoEx 0x9109
152#define PTP_OC_EOS_SetDevicePropValueEx 0x9110
153#define PTP_OC_EOS_SetRemoteMode 0x9114
154#define PTP_OC_EOS_SetEventMode 0x9115
155#define PTP_OC_EOS_GetEvent 0x9116
156#define PTP_OC_EOS_PCHDDCapacity 0x911A
157#define PTP_OC_EOS_SetUILock 0x911B
158#define PTP_OC_EOS_ResetUILock 0x911C
159#define PTP_OC_EOS_KeepDeviceOn 0x911D
160#define PTP_OC_EOS_UpdateFirmware 0x911F
161#define PTP_OC_EOS_BulbStart 0x9125
162#define PTP_OC_EOS_BulbEnd 0x9126
163#define PTP_OC_EOS_GetDevicePropValue 0x9127
164#define PTP_OC_EOS_RemoteReleaseOn 0x9128
165#define PTP_OC_EOS_RemoteReleaseOff 0x9129
166#define PTP_OC_EOS_DriveLens 0x9155
167#define PTP_OC_EOS_InitiateViewfinder 0x9151
168#define PTP_OC_EOS_TerminateViewfinder 0x9152
169#define PTP_OC_EOS_GetViewFinderData 0x9153
170#define PTP_OC_EOS_DoAutoFocus 0x9154
171#define PTP_OC_EOS_AfCancel 0x9160
172#define PTP_OC_EOS_SetDefaultSetting 0x91BE
173
174#define PTP_OC_EOS_EnableEventProc 0x9050
175#define PTP_OC_EOS_ExecuteEventProc 0x9052
176#define PTP_OC_EOS_GetEventProcReturnData 0x9053
177#define PTP_OC_EOS_IsEventProcRunning 0x9057
178
179#define EOS_DESTINATION_CAM 0x2
180#define EOS_DESTINATION_PC 0x4
181#define EOS_DESTINATION_BOTH 0x6
182
183// Return codes (RC)
184#define PTP_RC_Undefined 0x2000
185#define PTP_RC_OK 0x2001
186#define PTP_RC_GeneralError 0x2002
187#define PTP_RC_SessionNotOpen 0x2003
188#define PTP_RC_InvalidTransactionID 0x2004
189#define PTP_RC_OperationNotSupported 0x2005
190#define PTP_RC_ParameterNotSupported 0x2006
191#define PTP_RC_IncompleteTransfer 0x2007
192#define PTP_RC_InvalidStorageId 0x2008
193#define PTP_RC_InvalidObjectHandle 0x2009
194#define PTP_RC_DevicePropNotSupported 0x200A
195#define PTP_RC_InvalidObjectFormatCode 0x200B
196#define PTP_RC_StoreFull 0x200C
197#define PTP_RC_ObjectWriteProtected 0x200D
198#define PTP_RC_StoreReadOnly 0x200E
199#define PTP_RC_AccessDenied 0x200F
200#define PTP_RC_NoThumbnailPresent 0x2010
201#define PTP_RC_SelfTestFailed 0x2011
202#define PTP_RC_PartialDeletion 0x2012
203#define PTP_RC_StoreNotAvailable 0x2013
204#define PTP_RC_SpecByFormatUnsupported 0x2014
205#define PTP_RC_NoValidObjectInfo 0x2015
206#define PTP_RC_InvalidCodeFormat 0x2016
207#define PTP_RC_UnknownVendorCode 0x2017
208#define PTP_RC_CaptureAlreadyTerminated 0x2018
209#define PTP_RC_DeviceBusy 0x2019
210#define PTP_RC_InvalidParentObject 0x201A
211#define PTP_RC_InvalidDevicePropFormat 0x201B
212#define PTP_RC_InvalidDevicePropValue 0x201C
213#define PTP_RC_InvalidParameter 0x201D
214#define PTP_RC_SessionAlreadyOpened 0x201E
215#define PTP_RC_TransactionCanceled 0x201F
216#define PTP_RC_SpecOfDestinationUnsupported 0x2020
217
218// EOS or Canon?
219#define PTP_RC_CANON_Unknown 0xA001
220#define PTP_RC_CANON_NotReady 0xA102
221#define PTP_RC_CANON_BatteryLow 0xA101
222
223// MTP (Microsoft) extension
224#define PTP_RC_UndefinedMTP 0xA800
225#define PTP_RC_InvalidObjPropCode 0xA801
226#define PTP_RC_InvalidObjPropCodeFormat 0xA802
227#define PTP_RC_InvalidObjPropCodeValue 0xA803
228#define PTP_RC_InvalidObjReference 0xA804
229#define PTP_RC_InvalidDataset 0xA806
230#define PTP_RC_GroupSpecUnsupported 0xA807
231#define PTP_RC_DepthSpecUnsupported 0xA808
232#define PTP_RC_ObjectTooLarge 0xA809
233#define PTP_RC_ObjectPropUnsupported 0xA80A
234
235// Event Codes (EC)
236#define PTP_EC_Undefined 0x4000
237#define PTP_EC_CancelTransaction 0x4001
238#define PTP_EC_ObjectAdded 0x4002
239#define PTP_EC_ObjectRemoved 0x4003
240#define PTP_EC_StoreAdded 0x4004
241#define PTP_EC_StoreRemoved 0x4005
242#define PTP_EC_DevicePropChanged 0x4006
243#define PTP_EC_ObjectInfoChanged 0x4007
244#define PTP_EC_DeviceInfoChanged 0x4008
245#define PTP_EC_RequestObjectTransfer 0x4009
246#define PTP_EC_StoreFull 0x400A
247#define PTP_EC_DeviceReset 0x400B
248#define PTP_EC_StorageInfoChanged 0x400C
249#define PTP_EC_CaptureComplete 0x400D
250#define PTP_EC_UnreportedStatus 0x400E
251
252#define PTP_EC_Canon_RequestObjectTransfer 0xC009
253
254/* EOS events */
255#define PTP_EC_EOS_RequestGetEvent 0xC101
256#define PTP_EC_EOS_ObjectAddedEx 0xC181
257#define PTP_EC_EOS_ObjectRemoved 0xC182
258#define PTP_EC_EOS_RequestGetObjectInfoEx 0xC183
259#define PTP_EC_EOS_StorageStatusChanged 0xC184
260#define PTP_EC_EOS_StorageInfoChanged 0xC185
261#define PTP_EC_EOS_RequestObjectTransfer 0xc186
262#define PTP_EC_EOS_ObjectInfoChangedEx 0xC187
263#define PTP_EC_EOS_ObjectContentChanged 0xC188
264#define PTP_EC_EOS_PropValueChanged 0xC189
265#define PTP_EC_EOS_AvailListChanged 0xC18A
266#define PTP_EC_EOS_CameraStatusChanged 0xC18B
267#define PTP_EC_EOS_WillSoonShutdown 0xC18D
268#define PTP_EC_EOS_ShutdownTimerUpdated 0xC18E
269#define PTP_EC_EOS_RequestCancelTransfer 0xC18F
270#define PTP_EC_EOS_RequestObjectTransferDT 0xC190
271#define PTP_EC_EOS_RequestCancelTransferDT 0xC191
272#define PTP_EC_EOS_StoreAdded 0xC192
273#define PTP_EC_EOS_StoreRemoved 0xC193
274#define PTP_EC_EOS_BulbExposureTime 0xC194
275#define PTP_EC_EOS_RecordingTime 0xC195
276#define PTP_EC_EOS_RequestObjectTransferTS 0xC1A2
277#define PTP_EC_EOS_AfResult 0xC1A3
278#define PTP_EC_EOS_InfoCheckComplete 0xC1A4
279
280#define PTP_EC_Nikon_ObjectAddedInSDRAM 0xC101
281#define PTP_EC_Nikon_CaptureCompleteRecInSdram 0xC102
282
283// Object Formats (OF)
284#define PTP_OF_Undefined 0x3000
285#define PTP_OF_Association 0x3001 // Aka Folder
286#define PTP_OF_Script 0x3002
287#define PTP_OF_Executable 0x3003
288#define PTP_OF_Text 0x3004
289#define PTP_OF_HTML 0x3005
290#define PTP_OF_DPOF 0x3006
291#define PTP_OF_AIFF 0x3007
292#define PTP_OF_WAV 0x3008
293#define PTP_OF_MP3 0x3009
294#define PTP_OF_AVI 0x300A
295#define PTP_OF_MPEG 0x300B
296#define PTP_OF_ASF 0x300C
297#define PTP_OF_MOV 0x300D
298#define PTP_OF_JPEG 0x3801
299#define PTP_OF_TIFF_EP 0x3802
300#define PTP_OF_FlashPix 0x3803
301#define PTP_OF_BMP 0x3804
302#define PTP_OF_CIFF 0x3805
303#define PTP_OF_Reserved2 0x3806
304#define PTP_OF_GIF 0x3807
305#define PTP_OF_JFIF 0x3808
306#define PTP_OF_PCD 0x3809
307#define PTP_OF_PICT 0x380A
308#define PTP_OF_PNG 0x380B
309#define PTP_OF_Reserved1 0x380C
310#define PTP_OF_TIFF 0x380D
311#define PTP_OF_TIFF_IT 0x380E
312#define PTP_OF_JP2 0x380F
313#define PTP_OF_JPX 0x3810
314#define PTP_OF_Firmware 0xB802
315#define PTP_OF_WIF 0xB881
316#define PTP_OF_Audio 0xB900
317#define PTP_OF_WMA 0xb901
318#define PTP_OF_OGG 0xb902
319#define PTP_OF_AAC 0xb903
320#define PTP_OF_Audible 0xb904
321#define PTP_OF_FLAC 0xb906
322#define PTP_OF_SamsungPlaylist 0xb909
323#define PTP_OF_Video 0xb980
324#define PTP_OF_WMV 0xb981
325#define PTP_OF_MP4 0xb982
326#define PTP_OF_3GP 0xb984
327#define PTP_OF_MP2 0xb983
328
329// MTP specific Object Properties (copied from libgphoto2)
330#define PTP_OPC_StorageID 0xDC01
331#define PTP_OPC_ObjectFormat 0xDC02
332#define PTP_OPC_ProtectionStatus 0xDC03
333#define PTP_OPC_ObjectSize 0xDC04
334#define PTP_OPC_AssociationType 0xDC05
335#define PTP_OPC_AssociationDesc 0xDC06
336#define PTP_OPC_ObjectFileName 0xDC07
337#define PTP_OPC_DateCreated 0xDC08
338#define PTP_OPC_DateModified 0xDC09
339#define PTP_OPC_Keywords 0xDC0A
340#define PTP_OPC_ParentObject 0xDC0B
341#define PTP_OPC_AllowedFolderContents 0xDC0C
342#define PTP_OPC_Hidden 0xDC0D
343#define PTP_OPC_SystemObject 0xDC0E
344#define PTP_OPC_PersistantUniqueObjectIdentifier 0xDC41
345#define PTP_OPC_SyncID 0xDC42
346#define PTP_OPC_PropertyBag 0xDC43
347#define PTP_OPC_Name 0xDC44
348#define PTP_OPC_CreatedBy 0xDC45
349#define PTP_OPC_Artist 0xDC46
350#define PTP_OPC_DateAuthored 0xDC47
351#define PTP_OPC_Description 0xDC48
352#define PTP_OPC_URLReference 0xDC49
353#define PTP_OPC_LanguageLocale 0xDC4A
354#define PTP_OPC_CopyrightInformation 0xDC4B
355#define PTP_OPC_Source 0xDC4C
356#define PTP_OPC_OriginLocation 0xDC4D
357#define PTP_OPC_DateAdded 0xDC4E
358#define PTP_OPC_NonConsumable 0xDC4F
359#define PTP_OPC_CorruptOrUnplayable 0xDC50
360#define PTP_OPC_ProducerSerialNumber 0xDC51
361#define PTP_OPC_RepresentativeSampleFormat 0xDC81
362#define PTP_OPC_RepresentativeSampleSize 0xDC82
363#define PTP_OPC_RepresentativeSampleHeight 0xDC83
364#define PTP_OPC_RepresentativeSampleWidth 0xDC84
365#define PTP_OPC_RepresentativeSampleDuration 0xDC85
366#define PTP_OPC_RepresentativeSampleData 0xDC86
367#define PTP_OPC_Width 0xDC87
368#define PTP_OPC_Height 0xDC88
369#define PTP_OPC_Duration 0xDC89
370#define PTP_OPC_Rating 0xDC8A
371#define PTP_OPC_Track 0xDC8B
372#define PTP_OPC_Genre 0xDC8C
373#define PTP_OPC_Credits 0xDC8D
374#define PTP_OPC_Lyrics 0xDC8E
375#define PTP_OPC_SubscriptionContentID 0xDC8F
376#define PTP_OPC_ProducedBy 0xDC90
377#define PTP_OPC_UseCount 0xDC91
378#define PTP_OPC_SkipCount 0xDC92
379#define PTP_OPC_LastAccessed 0xDC93
380#define PTP_OPC_ParentalRating 0xDC94
381#define PTP_OPC_MetaGenre 0xDC95
382#define PTP_OPC_Composer 0xDC96
383#define PTP_OPC_EffectiveRating 0xDC97
384#define PTP_OPC_Subtitle 0xDC98
385#define PTP_OPC_OriginalReleaseDate 0xDC99
386#define PTP_OPC_AlbumName 0xDC9A
387#define PTP_OPC_AlbumArtist 0xDC9B
388#define PTP_OPC_Mood 0xDC9C
389#define PTP_OPC_DRMStatus 0xDC9D
390#define PTP_OPC_SubDescription 0xDC9E
391#define PTP_OPC_IsCropped 0xDCD1
392#define PTP_OPC_IsColorCorrected 0xDCD2
393#define PTP_OPC_ImageBitDepth 0xDCD3
394#define PTP_OPC_Fnumber 0xDCD4
395#define PTP_OPC_ExposureTime 0xDCD5
396#define PTP_OPC_ExposureIndex 0xDCD6
397#define PTP_OPC_DisplayName 0xDCE0
398#define PTP_OPC_BodyText 0xDCE1
399#define PTP_OPC_Subject 0xDCE2
400#define PTP_OPC_Priority 0xDCE3
401#define PTP_OPC_GivenName 0xDD00
402#define PTP_OPC_MiddleNames 0xDD01
403#define PTP_OPC_FamilyName 0xDD02
404#define PTP_OPC_Prefix 0xDD03
405#define PTP_OPC_Suffix 0xDD04
406#define PTP_OPC_PhoneticGivenName 0xDD05
407#define PTP_OPC_PhoneticFamilyName 0xDD06
408#define PTP_OPC_EmailPrimary 0xDD07
409#define PTP_OPC_EmailPersonal1 0xDD08
410#define PTP_OPC_EmailPersonal2 0xDD09
411#define PTP_OPC_EmailBusiness1 0xDD0A
412#define PTP_OPC_EmailBusiness2 0xDD0B
413#define PTP_OPC_EmailOthers 0xDD0C
414#define PTP_OPC_PhoneNumberPrimary 0xDD0D
415#define PTP_OPC_PhoneNumberPersonal 0xDD0E
416#define PTP_OPC_PhoneNumberPersonal2 0xDD0F
417#define PTP_OPC_PhoneNumberBusiness 0xDD10
418#define PTP_OPC_PhoneNumberBusiness2 0xDD11
419#define PTP_OPC_PhoneNumberMobile 0xDD12
420#define PTP_OPC_PhoneNumberMobile2 0xDD13
421#define PTP_OPC_FaxNumberPrimary 0xDD14
422#define PTP_OPC_FaxNumberPersonal 0xDD15
423#define PTP_OPC_FaxNumberBusiness 0xDD16
424#define PTP_OPC_PagerNumber 0xDD17
425#define PTP_OPC_PhoneNumberOthers 0xDD18
426#define PTP_OPC_PrimaryWebAddress 0xDD19
427#define PTP_OPC_PersonalWebAddress 0xDD1A
428#define PTP_OPC_BusinessWebAddress 0xDD1B
429#define PTP_OPC_InstantMessengerAddress 0xDD1C
430#define PTP_OPC_InstantMessengerAddress2 0xDD1D
431#define PTP_OPC_InstantMessengerAddress3 0xDD1E
432#define PTP_OPC_PostalAddressPersonalFull 0xDD1F
433#define PTP_OPC_PostalAddressPersonalFullLine1 0xDD20
434#define PTP_OPC_PostalAddressPersonalFullLine2 0xDD21
435#define PTP_OPC_PostalAddressPersonalFullCity 0xDD22
436#define PTP_OPC_PostalAddressPersonalFullRegion 0xDD23
437#define PTP_OPC_PostalAddressPersonalFullPostalCode 0xDD24
438#define PTP_OPC_PostalAddressPersonalFullCountry 0xDD25
439#define PTP_OPC_PostalAddressBusinessFull 0xDD26
440#define PTP_OPC_PostalAddressBusinessLine1 0xDD27
441#define PTP_OPC_PostalAddressBusinessLine2 0xDD28
442#define PTP_OPC_PostalAddressBusinessCity 0xDD29
443#define PTP_OPC_PostalAddressBusinessRegion 0xDD2A
444#define PTP_OPC_PostalAddressBusinessPostalCode 0xDD2B
445#define PTP_OPC_PostalAddressBusinessCountry 0xDD2C
446#define PTP_OPC_PostalAddressOtherFull 0xDD2D
447#define PTP_OPC_PostalAddressOtherLine1 0xDD2E
448#define PTP_OPC_PostalAddressOtherLine2 0xDD2F
449#define PTP_OPC_PostalAddressOtherCity 0xDD30
450#define PTP_OPC_PostalAddressOtherRegion 0xDD31
451#define PTP_OPC_PostalAddressOtherPostalCode 0xDD32
452#define PTP_OPC_PostalAddressOtherCountry 0xDD33
453#define PTP_OPC_OrganizationName 0xDD34
454#define PTP_OPC_PhoneticOrganizationName 0xDD35
455#define PTP_OPC_Role 0xDD36
456#define PTP_OPC_Birthdate 0xDD37
457#define PTP_OPC_MessageTo 0xDD40
458#define PTP_OPC_MessageCC 0xDD41
459#define PTP_OPC_MessageBCC 0xDD42
460#define PTP_OPC_MessageRead 0xDD43
461#define PTP_OPC_MessageReceivedTime 0xDD44
462#define PTP_OPC_MessageSender 0xDD45
463#define PTP_OPC_ActivityBeginTime 0xDD50
464#define PTP_OPC_ActivityEndTime 0xDD51
465#define PTP_OPC_ActivityLocation 0xDD52
466#define PTP_OPC_ActivityRequiredAttendees 0xDD54
467#define PTP_OPC_ActivityOptionalAttendees 0xDD55
468#define PTP_OPC_ActivityResources 0xDD56
469#define PTP_OPC_ActivityAccepted 0xDD57
470#define PTP_OPC_Owner 0xDD5D
471#define PTP_OPC_Editor 0xDD5E
472#define PTP_OPC_Webmaster 0xDD5F
473#define PTP_OPC_URLSource 0xDD60
474#define PTP_OPC_URLDestination 0xDD61
475#define PTP_OPC_TimeBookmark 0xDD62
476#define PTP_OPC_ObjectBookmark 0xDD63
477#define PTP_OPC_ByteBookmark 0xDD64
478#define PTP_OPC_LastBuildDate 0xDD70
479#define PTP_OPC_TimetoLive 0xDD71
480#define PTP_OPC_MediaGUID 0xDD72
481#define PTP_OPC_TotalBitRate 0xDE91
482#define PTP_OPC_BitRateType 0xDE92
483#define PTP_OPC_SampleRate 0xDE93
484#define PTP_OPC_NumberOfChannels 0xDE94
485#define PTP_OPC_AudioBitDepth 0xDE95
486#define PTP_OPC_ScanDepth 0xDE97
487#define PTP_OPC_AudioWAVECodec 0xDE99
488#define PTP_OPC_AudioBitRate 0xDE9A
489#define PTP_OPC_VideoFourCCCodec 0xDE9B
490#define PTP_OPC_VideoBitRate 0xDE9C
491#define PTP_OPC_FramesPerThousandSeconds 0xDE9D
492#define PTP_OPC_KeyFrameDistance 0xDE9E
493#define PTP_OPC_BufferSize 0xDE9F
494#define PTP_OPC_EncodingQuality 0xDEA0
495#define PTP_OPC_EncodingProfile 0xDEA1
496#define PTP_OPC_BuyFlag 0xD901
497
498// Multple vendors appear to use these
499#define PTP_OF_CANON_CRW 0xb101
500#define PTP_OF_RAW 0xb103
501#define PTP_OF_CANON_MOV 0xb104
502
503// Association types
504#define PTP_AT_Folder 0x1
505#define PTP_AT_Album 0x1
506
507// ISO Standard Property codes
508#define PTP_DPC_BatteryLevel 0x5001
509#define PTP_DPC_FunctionalMode 0x5002
510#define PTP_DPC_ImageSize 0x5003
511#define PTP_DPC_CompressionSetting 0x5004
512#define PTP_DPC_WhiteBalance 0x5005
513#define PTP_DPC_RGBGain 0x5006
514#define PTP_DPC_FNumber 0x5007
515#define PTP_DPC_FocalLength 0x5008
516#define PTP_DPC_FocalDistance 0x5009
517#define PTP_DPC_FocusMode 0x500A
518#define PTP_DPC_ExposureMeteringMode 0x500B
519#define PTP_DPC_FlashMode 0x500C
520#define PTP_DPC_ExposureTime 0x500D
521#define PTP_DPC_ExposureProgramMode 0x500E
522#define PTP_DPC_ExposureIndex 0x500F
523#define PTP_DPC_ExposureBiasCompensation 0x5010
524#define PTP_DPC_DateTime 0x5011
525#define PTP_DPC_CaptureDelay 0x5012
526#define PTP_DPC_StillCaptureMode 0x5013
527#define PTP_DPC_Contrast 0x5014
528#define PTP_DPC_Sharpness 0x5015
529#define PTP_DPC_DigitalZoom 0x5016
530#define PTP_DPC_EffectMode 0x5017
531#define PTP_DPC_BurstNumber 0x5018
532#define PTP_DPC_BurstInterval 0x5019
533#define PTP_DPC_TimelapseNumber 0x501A
534#define PTP_DPC_TimelapseInterval 0x501B
535#define PTP_DPC_FocusMeteringMode 0x501C
536#define PTP_DPC_UploadURL 0x501D
537#define PTP_DPC_Artist 0x501E
538#define PTP_DPC_CopyrightInfo 0x501F
539
540#define PTP_DPC_SupportedStreams 0x5020
541#define PTP_DPC_EnabledStreams 0x5021
542#define PTP_DPC_VideoFormat 0x5022
543#define PTP_DPC_VideoResolution 0x5023
544#define PTP_DPC_VideoQuality 0x5024
545#define PTP_DPC_VideoFrameRate 0x5025
546#define PTP_DPC_VideoContrast 0x5026
547#define PTP_DPC_VideoBrightness 0x5027
548#define PTP_DPC_AudioFormat 0x5028
549#define PTP_DPC_AudioBitrate 0x5029
550#define PTP_DPC_AudioSamplingRate 0x502A
551#define PTP_DPC_AudioBitPerSample 0x502B
552#define PTP_DPC_AudioVolume 0x502C
553
554// Canon (Not EOS) Property Codes
555#define PTP_DPC_CANON_BeepCode 0xD001
556#define PTP_DPC_CANON_ViewFinderMode 0xD003
557#define PTP_DPC_CANON_ImageQuality 0xD006
558#define PTP_DPC_CANON_ImageSize 0xD008
559#define PTP_DPC_CANON_FlashMode 0xD00a
560#define PTP_DPC_CANON_TvAvSetting 0xD00c
561#define PTP_DPC_CANON_MeteringMode 0xd010
562#define PTP_DPC_CANON_MacroMode 0xd011
563#define PTP_DPC_CANON_FocusingPoint 0xd012
564#define PTP_DPC_CANON_WhiteBalance 0xd013
565#define PTP_DPC_CANON_AFMode 0xD015
566#define PTP_DPC_CANON_Contrast 0xD017
567#define PTP_DPC_CANON_ISOSpeed 0xd01c
568#define PTP_DPC_CANON_Aperture 0xd01c
569#define PTP_DPC_CANON_ShutterSpeed 0xd01e
570#define PTP_DPC_CANON_ExpComp 0xd01f
571#define PTP_DPC_CANON_Zoom 0xd02a
572#define PTP_DPC_CANON_SizeQuality 0xd02c
573#define PTP_DPC_CANON_FlashMemory 0xd031
574#define PTP_DPC_CANON_CameraModel 0xd032
575#define PTP_DPC_CANON_CameraOwner 0xd033
576#define PTP_DPC_CANON_UnixTime 0xd032
577#define PTP_DPC_CANON_ViewFinderOut 0xD036
578#define PTP_DPC_CANON_RealImageWidth 0xD039
579#define PTP_DPC_CANON_PhotoEffect 0xD040
580#define PTP_DPC_CANON_AssistLight 0xD041
581
582// EOS Device Property Codes
583#define PTP_DPC_EOS_Aperture 0xD101
584#define PTP_DPC_EOS_ShutterSpeed 0xD102
585#define PTP_DPC_EOS_ISOSpeed 0xD103
586#define PTP_DPC_EOS_ExpCompensation 0xD104
587#define PTP_DPC_EOS_AutoExposureMode 0xD105
588#define PTP_DPC_EOS_DriveMode 0xD106
589#define PTP_DPC_EOS_MeteringMode 0xD107
590#define PTP_DPC_EOS_FocusMode 0xD108
591#define PTP_DPC_EOS_WhiteBalance 0xD109
592#define PTP_DPC_EOS_ColorTemperature 0xD10A
593#define PTP_DPC_EOS_WhiteBalanceAdjustA 0xD10B
594#define PTP_DPC_EOS_WhiteBalanceAdjustB 0xD10C
595#define PTP_DPC_EOS_WhiteBalanceXA 0xD10D
596#define PTP_DPC_EOS_WhiteBalanceXB 0xD10E
597#define PTP_DPC_EOS_ColorSpace 0xD10F
598#define PTP_DPC_EOS_PictureStyle 0xD110
599#define PTP_DPC_EOS_BatteryPower 0xD111
600#define PTP_DPC_EOS_BatterySelect 0xD112
601#define PTP_DPC_EOS_CameraTime 0xD113
602#define PTP_DPC_EOS_Owner 0xD115
603#define PTP_DPC_EOS_ModelID 0xD116
604#define PTP_DPC_EOS_PTPExtensionVersion 0xD119
605#define PTP_DPC_EOS_DPOFVersion 0xD11A
606#define PTP_DPC_EOS_AvailableShots 0xD11B
607#define PTP_DPC_EOS_CaptureDestination 0xD11C
608#define PTP_DPC_EOS_CurrentFolder 0xD11F
609#define PTP_DPC_EOS_ImageFormat 0xD120
610#define PTP_DPC_EOS_ImageFormatCF 0xD121
611#define PTP_DPC_EOS_ImageFormatSD 0xD122
612#define PTP_DPC_EOS_ImageFormatExtHD 0xD123
613#define PTP_DPC_EOS_AEModeDial 0xD138
614#define PTP_DPC_EOS_ShutterCounter 0xD1AC
615#define PTP_DPC_EOS_VF_Output 0xD1B0
616#define PTP_DPC_EOS_EVFMode 0xD1B1
617#define PTP_DPC_EOS_DOFPreview 0xD1B2
618#define PTP_DPC_EOS_VFSharp 0xD1B3
619#define PTP_DPC_EOS_EVFWBMode 0xD1B4
620#define PTP_DPC_EOS_FocusInfoEx 0xD1D3
621
622// Magic Lantern ptpview old opcodes
623#define PTP_OC_ML_LiveBmpRam 0x9996
624#define PTP_OC_ML_Live360x240 0x9997
625
626#define PTP_OC_MagicLantern 0x9998
627#define PTP_OC_CHDK 0x9999
628
629// Storage Types
630#define PTP_ST_Undefined 0x0
631#define PTP_ST_FixedROM 0x1
632#define PTP_ST_RemovableROM 0x2
633#define PTP_ST_FixedRAM 0x3
634#define PTP_ST_RemovableRAM 0x4
635
636// Filesystem Type
637#define PTP_FT_Undefined 0x0
638#define PTP_FT_GenericFlat 0x1
639#define PTP_FT_GenericHei 0x2
640#define PTP_FT_DCF 0x3
641
642// Access Capability
643#define PTP_AC_ReadWrite 0x0
644#define PTP_AC_Read 0x1
645#define PTP_AC_ReadDelete 0x2
646
647// Device type codes
648#define PTP_TC_UNDEF 0x0
649#define PTP_TC_INT8 0x1
650#define PTP_TC_UINT8 0x2
651#define PTP_TC_INT16 0x3
652#define PTP_TC_UINT16 0x4
653#define PTP_TC_INT32 0x5
654#define PTP_TC_UINT32 0x6
655#define PTP_TC_INT64 0x7
656#define PTP_TC_UINT64 0x8
657#define PTP_TC_INT128 0x9
658#define PTP_TC_UINT128 0xA
659#define PTP_TC_UINT8ARRAY 0x4002
660#define PTP_TC_UINT16ARRAY 0x4004
661#define PTP_TC_UINT32ARRAY 0x4006
662#define PTP_TC_UINT64ARRAY 0x4008
663#define PTP_TC_STRING 0xFFFF
664
665#define PTP_RangeForm 0x1
666#define PTP_EnumerationForm 0x2
667
668// Used for socket initialization
669#define PTPIP_INIT_COMMAND_REQ 0x1
670#define PTPIP_INIT_COMMAND_ACK 0x2
671#define PTPIP_INIT_EVENT_REQ 0x3
672#define PTPIP_INIT_EVENT_ACK 0x4
673
674// Packet type extensions for PTP/IP
675#define PTPIP_INIT_FAIL 0x5
676#define PTPIP_COMMAND_REQUEST 0x6
677#define PTPIP_COMMAND_RESPONSE 0x7
678#define PTPIP_EVENT 0x8
679#define PTPIP_DATA_PACKET_START 0x9
680#define PTPIP_DATA_PACKET 0xA
681#define PTPIP_CANCEL_TRANSACTION 0xB
682#define PTPIP_DATA_PACKET_END 0xC
683#define PTPIP_PING 0xD
684#define PTPIP_PONG 0xE
685
686#define USB_VENDOR_CANON 0x4A9
687
688// ISO number for PTP/IP
689#define PTP_IP_PORT 15740
690
691// Standard interface Class ID for PTP.
692// See https://en.wikipedia.org/wiki/USB#Device_classes
693#define PTP_CLASS_ID 6
694
695// bRequest codes
696#define MTP_REQ_CANCEL 0x64
697#define MTP_REQ_GET_EXT_EVENT_DATA 0x65
698#define USB_REQ_RESET 0x66
699#define USB_REQ_STATUS 0x67
700#define USB_REQ_GET_STATUS 0x00
701#define USB_REQ_CLEAR_FEATURE 0x01
702#define USB_REQ_SET_FEATURE 0x03
703
704// Data phase host to device, device to host
705#define USB_DP_HTD 0x0
706#define USB_DP_DTH 0x80
707
708#define USB_RECIP_DEVICE 0x00
709#define USB_RECIP_INTERFACE 0x01
710#define USB_RECIP_ENDPOINT 0x02
711#ifndef USB_TYPE_CLASS
712#define USB_TYPE_CLASS 0x20
713#endif
714
715#pragma pack(pop)
716
717#endif