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