forked from realthunder/usbip
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathptp.h
3065 lines (2819 loc) · 114 KB
/
ptp.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
/* ptp.h
*
* Copyright (C) 2001 Mariusz Woloszyn <[email protected]>
* Copyright (C) 2003-2012 Marcus Meissner <[email protected]>
* Copyright (C) 2006-2008 Linus Walleij <[email protected]>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
* Boston, MA 02111-1307, USA.
*/
#ifndef __PTP_H__
#define __PTP_H__
#ifdef __KERNEL__
#include <linux/types.h>
#pragma pack(push,1)
#else /*__KERNEL__*/
#include <stdarg.h>
#include <time.h>
#ifdef HAVE_ICONV
#include <iconv.h>
#endif
#include "gphoto2-endian.h"
#endif /*__KERNEL__*/
#include "device-flags.h"
#ifdef __cplusplus
extern "C" {
#endif /* __cplusplus */
/* PTP datalayer byteorder */
#define PTP_DL_BE 0xF0
#define PTP_DL_LE 0x0F
/* USB interface class */
#ifndef USB_CLASS_PTP
#define USB_CLASS_PTP 6
#endif
/* PTP request/response/event general PTP container (transport independent) */
struct _PTPContainer {
uint16_t Code;
uint32_t SessionID;
uint32_t Transaction_ID;
/* params may be of any type of size less or equal to uint32_t */
uint32_t Param1;
uint32_t Param2;
uint32_t Param3;
/* events can only have three parameters */
uint32_t Param4;
uint32_t Param5;
/* the number of meaningfull parameters */
uint8_t Nparam;
};
typedef struct _PTPContainer PTPContainer;
/* PTP USB Bulk-Pipe container */
/* USB bulk max packet length for high speed endpoints */
/* The max packet is set to 512 bytes. The spec says
* "end of data transfers are signaled by short packets or NULL
* packets". It never says anything about 512, but current
* implementations seem to have chosen this value, which also
* happens to be the size of an USB 2.0 HS endpoint, even though
* this is not necessary.
*
* Previously we had this as 4096 for MTP devices. We have found
* and fixed the bugs that made this necessary and it can be 512 again.
*/
#define PTP_USB_BULK_HS_MAX_PACKET_LEN_WRITE 512
#define PTP_USB_BULK_HS_MAX_PACKET_LEN_READ 512
#define PTP_USB_BULK_HDR_LEN (2*sizeof(uint32_t)+2*sizeof(uint16_t))
#define PTP_USB_BULK_PAYLOAD_LEN_WRITE (PTP_USB_BULK_HS_MAX_PACKET_LEN_WRITE-PTP_USB_BULK_HDR_LEN)
#define PTP_USB_BULK_PAYLOAD_LEN_READ (PTP_USB_BULK_HS_MAX_PACKET_LEN_READ-PTP_USB_BULK_HDR_LEN)
#define PTP_USB_BULK_REQ_LEN (PTP_USB_BULK_HDR_LEN+5*sizeof(uint32_t))
typedef struct _PTPUSBBulkHeader {
uint32_t length;
uint16_t type;
uint16_t code;
uint32_t trans_id;
}PTPUSBBulkHeader;
struct _PTPUSBBulkContainer {
uint32_t length;
uint16_t type;
uint16_t code;
uint32_t trans_id;
union {
struct {
uint32_t param1;
uint32_t param2;
uint32_t param3;
uint32_t param4;
uint32_t param5;
} params;
/* this must be set to the maximum of PTP_USB_BULK_PAYLOAD_LEN_WRITE
* and PTP_USB_BULK_PAYLOAD_LEN_READ */
unsigned char data[PTP_USB_BULK_PAYLOAD_LEN_READ];
} payload;
};
typedef struct _PTPUSBBulkContainer PTPUSBBulkContainer;
/* PTP USB Asynchronous Event Interrupt Data Format */
struct _PTPUSBEventContainer {
uint32_t length;
uint16_t type;
uint16_t code;
uint32_t trans_id;
uint32_t param1;
uint32_t param2;
uint32_t param3;
};
typedef struct _PTPUSBEventContainer PTPUSBEventContainer;
struct _PTPCanon_directtransfer_entry {
uint32_t oid;
char *str;
};
typedef struct _PTPCanon_directtransfer_entry PTPCanon_directtransfer_entry;
/* USB container types */
#define PTP_USB_CONTAINER_UNDEFINED 0x0000
#define PTP_USB_CONTAINER_COMMAND 0x0001
#define PTP_USB_CONTAINER_DATA 0x0002
#define PTP_USB_CONTAINER_RESPONSE 0x0003
#define PTP_USB_CONTAINER_EVENT 0x0004
/* PTP/IP definitions */
#define PTPIP_INIT_COMMAND_REQUEST 1
#define PTPIP_INIT_COMMAND_ACK 2
#define PTPIP_INIT_EVENT_REQUEST 3
#define PTPIP_INIT_EVENT_ACK 4
#define PTPIP_INIT_FAIL 5
#define PTPIP_CMD_REQUEST 6
#define PTPIP_CMD_RESPONSE 7
#define PTPIP_EVENT 8
#define PTPIP_START_DATA_PACKET 9
#define PTPIP_DATA_PACKET 10
#define PTPIP_CANCEL_TRANSACTION 11
#define PTPIP_END_DATA_PACKET 12
#define PTPIP_PING 13
#define PTPIP_PONG 14
struct _PTPIPHeader {
uint32_t length;
uint32_t type;
};
typedef struct _PTPIPHeader PTPIPHeader;
#ifdef __KERNEL__
#pragma pack(pop)
#endif
/* Vendor IDs */
#define PTP_VENDOR_EASTMAN_KODAK 0x00000001
#define PTP_VENDOR_SEIKO_EPSON 0x00000002
#define PTP_VENDOR_AGILENT 0x00000003
#define PTP_VENDOR_POLAROID 0x00000004
#define PTP_VENDOR_AGFA_GEVAERT 0x00000005
#define PTP_VENDOR_MICROSOFT 0x00000006
#define PTP_VENDOR_EQUINOX 0x00000007
#define PTP_VENDOR_VIEWQUEST 0x00000008
#define PTP_VENDOR_STMICROELECTRONICS 0x00000009
#define PTP_VENDOR_NIKON 0x0000000A
#define PTP_VENDOR_CANON 0x0000000B
#define PTP_VENDOR_FOTONATION 0x0000000C
#define PTP_VENDOR_PENTAX 0x0000000D
#define PTP_VENDOR_FUJI 0x0000000E
/* not from standards papers, but from traces: */
#define PTP_VENDOR_SONY 0x00000011 /* observed in the A900 */
#define PTP_VENDOR_SAMSUNG 0x0000001a /* observed in the Samsung NX1000 */
/* Vendor extension ID used for MTP (occasionaly, usualy 6 is used) */
#define PTP_VENDOR_MTP 0xffffffff
/* Operation Codes */
/* PTP v1.0 operation codes */
#define PTP_OC_Undefined 0x1000
#define PTP_OC_GetDeviceInfo 0x1001
#define PTP_OC_OpenSession 0x1002
#define PTP_OC_CloseSession 0x1003
#define PTP_OC_GetStorageIDs 0x1004
#define PTP_OC_GetStorageInfo 0x1005
#define PTP_OC_GetNumObjects 0x1006
#define PTP_OC_GetObjectHandles 0x1007
#define PTP_OC_GetObjectInfo 0x1008
#define PTP_OC_GetObject 0x1009
#define PTP_OC_GetThumb 0x100A
#define PTP_OC_DeleteObject 0x100B
#define PTP_OC_SendObjectInfo 0x100C
#define PTP_OC_SendObject 0x100D
#define PTP_OC_InitiateCapture 0x100E
#define PTP_OC_FormatStore 0x100F
#define PTP_OC_ResetDevice 0x1010
#define PTP_OC_SelfTest 0x1011
#define PTP_OC_SetObjectProtection 0x1012
#define PTP_OC_PowerDown 0x1013
#define PTP_OC_GetDevicePropDesc 0x1014
#define PTP_OC_GetDevicePropValue 0x1015
#define PTP_OC_SetDevicePropValue 0x1016
#define PTP_OC_ResetDevicePropValue 0x1017
#define PTP_OC_TerminateOpenCapture 0x1018
#define PTP_OC_MoveObject 0x1019
#define PTP_OC_CopyObject 0x101A
#define PTP_OC_GetPartialObject 0x101B
#define PTP_OC_InitiateOpenCapture 0x101C
/* PTP v1.1 operation codes */
#define PTP_OC_StartEnumHandles 0x101D
#define PTP_OC_EnumHandles 0x101E
#define PTP_OC_StopEnumHandles 0x101F
#define PTP_OC_GetVendorExtensionMaps 0x1020
#define PTP_OC_GetVendorDeviceInfo 0x1021
#define PTP_OC_GetResizedImageObject 0x1022
#define PTP_OC_GetFilesystemManifest 0x1023
#define PTP_OC_GetStreamInfo 0x1024
#define PTP_OC_GetStream 0x1025
/* Eastman Kodak extension Operation Codes */
#define PTP_OC_EK_GetSerial 0x9003
#define PTP_OC_EK_SetSerial 0x9004
#define PTP_OC_EK_SendFileObjectInfo 0x9005
#define PTP_OC_EK_SendFileObject 0x9006
#define PTP_OC_EK_SetText 0x9008
/* Canon extension Operation Codes */
#define PTP_OC_CANON_GetPartialObjectInfo 0x9001
/* 9002 - sends 2 uint32, nothing back */
#define PTP_OC_CANON_SetObjectArchive 0x9002
#define PTP_OC_CANON_KeepDeviceOn 0x9003
#define PTP_OC_CANON_LockDeviceUI 0x9004
#define PTP_OC_CANON_UnlockDeviceUI 0x9005
#define PTP_OC_CANON_GetObjectHandleByName 0x9006
/* no 9007 observed yet */
#define PTP_OC_CANON_InitiateReleaseControl 0x9008
#define PTP_OC_CANON_TerminateReleaseControl 0x9009
#define PTP_OC_CANON_TerminatePlaybackMode 0x900A
#define PTP_OC_CANON_ViewfinderOn 0x900B
#define PTP_OC_CANON_ViewfinderOff 0x900C
#define PTP_OC_CANON_DoAeAfAwb 0x900D
/* 900e - send nothing, gets 5 uint16t in 32bit entities back in 20byte datablob */
#define PTP_OC_CANON_GetCustomizeSpec 0x900E
#define PTP_OC_CANON_GetCustomizeItemInfo 0x900F
#define PTP_OC_CANON_GetCustomizeData 0x9010
#define PTP_OC_CANON_SetCustomizeData 0x9011
#define PTP_OC_CANON_GetCaptureStatus 0x9012
#define PTP_OC_CANON_CheckEvent 0x9013
#define PTP_OC_CANON_FocusLock 0x9014
#define PTP_OC_CANON_FocusUnlock 0x9015
#define PTP_OC_CANON_GetLocalReleaseParam 0x9016
#define PTP_OC_CANON_SetLocalReleaseParam 0x9017
#define PTP_OC_CANON_AskAboutPcEvf 0x9018
#define PTP_OC_CANON_SendPartialObject 0x9019
#define PTP_OC_CANON_InitiateCaptureInMemory 0x901A
#define PTP_OC_CANON_GetPartialObjectEx 0x901B
#define PTP_OC_CANON_SetObjectTime 0x901C
#define PTP_OC_CANON_GetViewfinderImage 0x901D
#define PTP_OC_CANON_GetObjectAttributes 0x901E
#define PTP_OC_CANON_ChangeUSBProtocol 0x901F
#define PTP_OC_CANON_GetChanges 0x9020
#define PTP_OC_CANON_GetObjectInfoEx 0x9021
#define PTP_OC_CANON_InitiateDirectTransfer 0x9022
#define PTP_OC_CANON_TerminateDirectTransfer 0x9023
#define PTP_OC_CANON_SendObjectInfoByPath 0x9024
#define PTP_OC_CANON_SendObjectByPath 0x9025
#define PTP_OC_CANON_InitiateDirectTansferEx 0x9026
#define PTP_OC_CANON_GetAncillaryObjectHandles 0x9027
#define PTP_OC_CANON_GetTreeInfo 0x9028
#define PTP_OC_CANON_GetTreeSize 0x9029
#define PTP_OC_CANON_NotifyProgress 0x902A
#define PTP_OC_CANON_NotifyCancelAccepted 0x902B
/* 902c: no parms, read 3 uint32 in data, no response parms */
#define PTP_OC_CANON_902C 0x902C
#define PTP_OC_CANON_GetDirectory 0x902D
#define PTP_OC_CANON_SetPairingInfo 0x9030
#define PTP_OC_CANON_GetPairingInfo 0x9031
#define PTP_OC_CANON_DeletePairingInfo 0x9032
#define PTP_OC_CANON_GetMACAddress 0x9033
/* 9034: 1 param, no parms returned */
#define PTP_OC_CANON_SetDisplayMonitor 0x9034
#define PTP_OC_CANON_PairingComplete 0x9035
#define PTP_OC_CANON_GetWirelessMAXChannel 0x9036
/* 9101: no args, 8 byte data (01 00 00 00 00 00 00 00), no resp data. */
#define PTP_OC_CANON_EOS_GetStorageIDs 0x9101
/* 9102: 1 arg (0)
* 0x28 bytes of data:
00000000: 34 00 00 00 02 00 02 91 0a 00 00 00 04 00 03 00
00000010: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00000020: 00 00 ff ff ff ff 03 43 00 46 00 00 00 03 41 00
00000030: 3a 00 00 00
* no resp args
*/
#define PTP_OC_CANON_EOS_GetStorageInfo 0x9102
#define PTP_OC_CANON_EOS_GetObjectInfo 0x9103
#define PTP_OC_CANON_EOS_GetObject 0x9104
#define PTP_OC_CANON_EOS_DeleteObject 0x9105
#define PTP_OC_CANON_EOS_FormatStore 0x9106
#define PTP_OC_CANON_EOS_GetPartialObject 0x9107
#define PTP_OC_CANON_EOS_GetDeviceInfoEx 0x9108
/* sample1:
* 3 cmdargs: 1,0xffffffff,00 00 10 00;
* data:
00000000: 48 00 00 00 02 00 09 91 12 00 00 00 01 00 00 00
00000010: 38 00 00 00 00 00 00 30 01 00 00 00 01 30 00 00
00000020: 01 00 00 00 10 00 00 00 00 00 00 00 00 00 00 20
00000030: 00 00 00 30 44 43 49 4d 00 00 00 00 00 00 00 00 DCIM
00000040: 00 00 00 00 cc c3 01 46
* 2 respargs: 0x0, 0x3c
*
* sample2:
*
00000000: 18 00 00 00 01 00 09 91 15 00 00 00 01 00 00 00
00000010: 00 00 00 30 00 00 10 00
00000000: 48 00 00 00 02 00 09 91 15 00 00 00 01 00 00 00
00000010: 38 00 00 00 00 00 9c 33 01 00 00 00 01 30 00 00
00000020: 01 00 00 00 10 00 00 00 00 00 00 00 00 00 00 30
00000030: 00 00 9c 33 32 33 31 43 41 4e 4f 4e 00 00 00 00 231CANON
00000040: 00 00 00 00 cc c3 01 46
*/
#define PTP_OC_CANON_EOS_GetObjectInfoEx 0x9109
#define PTP_OC_CANON_EOS_GetThumbEx 0x910A
#define PTP_OC_CANON_EOS_SendPartialObject 0x910B
#define PTP_OC_CANON_EOS_SetObjectAttributes 0x910C
#define PTP_OC_CANON_EOS_GetObjectTime 0x910D
#define PTP_OC_CANON_EOS_SetObjectTime 0x910E
/* 910f: no args, no data, 1 response arg (0). */
#define PTP_OC_CANON_EOS_RemoteRelease 0x910F
/* Marcus: looks more like "Set DeviceProperty" in the trace.
*
* no cmd args
* data phase (0xc, 0xd11c, 0x1)
* no resp args
*/
#define PTP_OC_CANON_EOS_SetDevicePropValueEx 0x9110
#define PTP_OC_CANON_EOS_GetRemoteMode 0x9113
/* 9114: 1 arg (0x1), no data, no resp data. */
#define PTP_OC_CANON_EOS_SetRemoteMode 0x9114
/* 9115: 1 arg (0x1), no data, no resp data. */
#define PTP_OC_CANON_EOS_SetEventMode 0x9115
/* 9116: no args, data phase, no resp data. */
#define PTP_OC_CANON_EOS_GetEvent 0x9116
#define PTP_OC_CANON_EOS_TransferComplete 0x9117
#define PTP_OC_CANON_EOS_CancelTransfer 0x9118
#define PTP_OC_CANON_EOS_ResetTransfer 0x9119
/* 911a: 3 args (0xfffffff7, 0x00001000, 0x00000001), no data, no resp data. */
/* 911a: 3 args (0x001dfc60, 0x00001000, 0x00000001), no data, no resp data. */
#define PTP_OC_CANON_EOS_PCHDDCapacity 0x911A
/* 911b: no cmd args, no data, no resp args */
#define PTP_OC_CANON_EOS_SetUILock 0x911B
/* 911c: no cmd args, no data, no resp args */
#define PTP_OC_CANON_EOS_ResetUILock 0x911C
#define PTP_OC_CANON_EOS_KeepDeviceOn 0x911D
#define PTP_OC_CANON_EOS_SetNullPacketMode 0x911E
#define PTP_OC_CANON_EOS_UpdateFirmware 0x911F
#define PTP_OC_CANON_EOS_TransferCompleteDT 0x9120
#define PTP_OC_CANON_EOS_CancelTransferDT 0x9121
#define PTP_OC_CANON_EOS_SetWftProfile 0x9122
#define PTP_OC_CANON_EOS_GetWftProfile 0x9122
#define PTP_OC_CANON_EOS_SetProfileToWft 0x9124
#define PTP_OC_CANON_EOS_BulbStart 0x9125
#define PTP_OC_CANON_EOS_BulbEnd 0x9126
#define PTP_OC_CANON_EOS_RequestDevicePropValue 0x9127
/* 0x9128 args (0x1/0x2, 0x0), no data, no resp args */
#define PTP_OC_CANON_EOS_RemoteReleaseOn 0x9128
/* 0x9129 args (0x1/0x2), no data, no resp args */
#define PTP_OC_CANON_EOS_RemoteReleaseOff 0x9129
#define PTP_OC_CANON_EOS_InitiateViewfinder 0x9151
#define PTP_OC_CANON_EOS_TerminateViewfinder 0x9152
#define PTP_OC_CANON_EOS_GetViewFinderData 0x9153
#define PTP_OC_CANON_EOS_DoAf 0x9154
#define PTP_OC_CANON_EOS_DriveLens 0x9155
#define PTP_OC_CANON_EOS_DepthOfFieldPreview 0x9156
#define PTP_OC_CANON_EOS_ClickWB 0x9157
#define PTP_OC_CANON_EOS_Zoom 0x9158
#define PTP_OC_CANON_EOS_ZoomPosition 0x9159
#define PTP_OC_CANON_EOS_SetLiveAfFrame 0x915a
#define PTP_OC_CANON_EOS_AfCancel 0x9160
#define PTP_OC_CANON_EOS_FAPIMessageTX 0x91FE
#define PTP_OC_CANON_EOS_FAPIMessageRX 0x91FF
/* Nikon extension Operation Codes */
#define PTP_OC_NIKON_GetProfileAllData 0x9006
#define PTP_OC_NIKON_SendProfileData 0x9007
#define PTP_OC_NIKON_DeleteProfile 0x9008
#define PTP_OC_NIKON_SetProfileData 0x9009
#define PTP_OC_NIKON_AdvancedTransfer 0x9010
#define PTP_OC_NIKON_GetFileInfoInBlock 0x9011
#define PTP_OC_NIKON_Capture 0x90C0 /* 1 param, no data */
#define PTP_OC_NIKON_AfDrive 0x90C1 /* no params, no data */
#define PTP_OC_NIKON_SetControlMode 0x90C2 /* 1 param, no data */
#define PTP_OC_NIKON_DelImageSDRAM 0x90C3 /* no params, no data */
#define PTP_OC_NIKON_GetLargeThumb 0x90C4
#define PTP_OC_NIKON_CurveDownload 0x90C5 /* 1 param, data in */
#define PTP_OC_NIKON_CurveUpload 0x90C6 /* 1 param, data out */
#define PTP_OC_NIKON_CheckEvent 0x90C7 /* no params, data in */
#define PTP_OC_NIKON_DeviceReady 0x90C8 /* no params, no data */
#define PTP_OC_NIKON_SetPreWBData 0x90C9 /* 3 params, data out */
#define PTP_OC_NIKON_GetVendorPropCodes 0x90CA /* 0 params, data in */
#define PTP_OC_NIKON_AfCaptureSDRAM 0x90CB /* no params, no data */
#define PTP_OC_NIKON_GetPictCtrlData 0x90CC
#define PTP_OC_NIKON_SetPictCtrlData 0x90CD
#define PTP_OC_NIKON_DelCstPicCtrl 0x90CE
#define PTP_OC_NIKON_GetPicCtrlCapability 0x90CF
/* Nikon Liveview stuff */
#define PTP_OC_NIKON_GetPreviewImg 0x9200
#define PTP_OC_NIKON_StartLiveView 0x9201
#define PTP_OC_NIKON_EndLiveView 0x9202
#define PTP_OC_NIKON_GetLiveViewImg 0x9203
#define PTP_OC_NIKON_MfDrive 0x9204
#define PTP_OC_NIKON_ChangeAfArea 0x9205
#define PTP_OC_NIKON_AfDriveCancel 0x9206
/* 2 params:
* 0xffffffff == No AF before, 0xfffffffe == AF before capture
* sdram=1, card=0
*/
#define PTP_OC_NIKON_InitiateCaptureRecInMedia 0x9207
#define PTP_OC_NIKON_StartMovieRecInCard 0x920a
#define PTP_OC_NIKON_EndMovieRec 0x920b
#define PTP_OC_NIKON_GetDevicePTPIPInfo 0x90E0
/* Casio EX-F1 (from http://code.google.com/p/exf1ctrl/ ) */
#define PTP_OC_CASIO_STILL_START 0x9001
#define PTP_OC_CASIO_STILL_STOP 0x9002
#define PTP_OC_CASIO_FOCUS 0x9007
#define PTP_OC_CASIO_CF_PRESS 0x9009
#define PTP_OC_CASIO_CF_RELEASE 0x900A
#define PTP_OC_CASIO_GET_OBJECT_INFO 0x900C
#define PTP_OC_CASIO_SHUTTER 0x9024
#define PTP_OC_CASIO_GET_STILL_HANDLES 0x9027
#define PTP_OC_CASIO_STILL_RESET 0x9028
#define PTP_OC_CASIO_HALF_PRESS 0x9029
#define PTP_OC_CASIO_HALF_RELEASE 0x902A
#define PTP_OC_CASIO_CS_PRESS 0x902B
#define PTP_OC_CASIO_CS_RELEASE 0x902C
#define PTP_OC_CASIO_ZOOM 0x902D
#define PTP_OC_CASIO_CZ_PRESS 0x902E
#define PTP_OC_CASIO_CZ_RELEASE 0x902F
#define PTP_OC_CASIO_MOVIE_START 0x9041
#define PTP_OC_CASIO_MOVIE_STOP 0x9042
#define PTP_OC_CASIO_MOVIE_PRESS 0x9043
#define PTP_OC_CASIO_MOVIE_RELEASE 0x9044
#define PTP_OC_CASIO_GET_MOVIE_HANDLES 0x9045
#define PTP_OC_CASIO_MOVIE_RESET 0x9046
#define PTP_OC_CASIO_GET_OBJECT 0x9025
#define PTP_OC_CASIO_GET_THUMBNAIL 0x9026
/* Sony stuff */
#define PTP_OC_SONY_SDIOConnect 0x9201
#define PTP_OC_SONY_GetSDIOGetExtDeviceInfo 0x9202
#define PTP_OC_SONY_GetDevicePropdesc 0x9203
#define PTP_OC_SONY_GetDevicePropertyValue 0x9204
#define PTP_OC_SONY_SetControlDeviceA 0x9205
#define PTP_OC_SONY_GetControlDeviceDesc 0x9206
#define PTP_OC_SONY_SetControlDeviceB 0x9207
#define PTP_OC_SONY_9209 0x9209 /* gets a 4126 byte blob ?*/
/* Microsoft / MTP extension codes */
#define PTP_OC_MTP_GetObjectPropsSupported 0x9801
#define PTP_OC_MTP_GetObjectPropDesc 0x9802
#define PTP_OC_MTP_GetObjectPropValue 0x9803
#define PTP_OC_MTP_SetObjectPropValue 0x9804
#define PTP_OC_MTP_GetObjPropList 0x9805
#define PTP_OC_MTP_SetObjPropList 0x9806
#define PTP_OC_MTP_GetInterdependendPropdesc 0x9807
#define PTP_OC_MTP_SendObjectPropList 0x9808
#define PTP_OC_MTP_GetObjectReferences 0x9810
#define PTP_OC_MTP_SetObjectReferences 0x9811
#define PTP_OC_MTP_UpdateDeviceFirmware 0x9812
#define PTP_OC_MTP_Skip 0x9820
/*
* Windows Media Digital Rights Management for Portable Devices
* Extension Codes (microsoft.com/WMDRMPD: 10.1)
*/
#define PTP_OC_MTP_WMDRMPD_GetSecureTimeChallenge 0x9101
#define PTP_OC_MTP_WMDRMPD_GetSecureTimeResponse 0x9102
#define PTP_OC_MTP_WMDRMPD_SetLicenseResponse 0x9103
#define PTP_OC_MTP_WMDRMPD_GetSyncList 0x9104
#define PTP_OC_MTP_WMDRMPD_SendMeterChallengeQuery 0x9105
#define PTP_OC_MTP_WMDRMPD_GetMeterChallenge 0x9106
#define PTP_OC_MTP_WMDRMPD_SetMeterResponse 0x9107
#define PTP_OC_MTP_WMDRMPD_CleanDataStore 0x9108
#define PTP_OC_MTP_WMDRMPD_GetLicenseState 0x9109
#define PTP_OC_MTP_WMDRMPD_SendWMDRMPDCommand 0x910A
#define PTP_OC_MTP_WMDRMPD_SendWMDRMPDRequest 0x910B
/*
* Windows Media Digital Rights Management for Portable Devices
* Extension Codes (microsoft.com/WMDRMPD: 10.1)
* Below are operations that have no public documented identifier
* associated with them "Vendor-defined Command Code"
*/
#define PTP_OC_MTP_WMDRMPD_SendWMDRMPDAppRequest 0x9212
#define PTP_OC_MTP_WMDRMPD_GetWMDRMPDAppResponse 0x9213
#define PTP_OC_MTP_WMDRMPD_EnableTrustedFilesOperations 0x9214
#define PTP_OC_MTP_WMDRMPD_DisableTrustedFilesOperations 0x9215
#define PTP_OC_MTP_WMDRMPD_EndTrustedAppSession 0x9216
/* ^^^ guess ^^^ */
/*
* Microsoft Advanced Audio/Video Transfer
* Extensions (microsoft.com/AAVT: 1.0)
*/
#define PTP_OC_MTP_AAVT_OpenMediaSession 0x9170
#define PTP_OC_MTP_AAVT_CloseMediaSession 0x9171
#define PTP_OC_MTP_AAVT_GetNextDataBlock 0x9172
#define PTP_OC_MTP_AAVT_SetCurrentTimePosition 0x9173
/*
* Windows Media Digital Rights Management for Network Devices
* Extensions (microsoft.com/WMDRMND: 1.0) MTP/IP?
*/
#define PTP_OC_MTP_WMDRMND_SendRegistrationRequest 0x9180
#define PTP_OC_MTP_WMDRMND_GetRegistrationResponse 0x9181
#define PTP_OC_MTP_WMDRMND_GetProximityChallenge 0x9182
#define PTP_OC_MTP_WMDRMND_SendProximityResponse 0x9183
#define PTP_OC_MTP_WMDRMND_SendWMDRMNDLicenseRequest 0x9184
#define PTP_OC_MTP_WMDRMND_GetWMDRMNDLicenseResponse 0x9185
/*
* Windows Media Player Portiable Devices
* Extension Codes (microsoft.com/WMPPD: 11.1)
*/
#define PTP_OC_MTP_WMPPD_ReportAddedDeletedItems 0x9201
#define PTP_OC_MTP_WMPPD_ReportAcquiredItems 0x9202
#define PTP_OC_MTP_WMPPD_PlaylistObjectPref 0x9203
/*
* Undocumented Zune Operation Codes
* maybe related to WMPPD extension set?
*/
#define PTP_OC_MTP_ZUNE_GETUNDEFINED001 0x9204
/* WiFi Provisioning MTP Extension Codes (microsoft.com/WPDWCN: 1.0) */
#define PTP_OC_MTP_WPDWCN_ProcessWFCObject 0x9122
/* Olympus E series commands */
#define PTP_OC_OLYMPUS_Capture 0x9101
#define PTP_OC_OLYMPUS_SelfCleaning 0x9103
#define PTP_OC_OLYMPUS_SetRGBGain 0x9106
#define PTP_OC_OLYMPUS_SetPresetMode 0x9107
#define PTP_OC_OLYMPUS_SetWBBiasAll 0x9108
#define PTP_OC_OLYMPUS_GetCameraControlMode 0x910a
#define PTP_OC_OLYMPUS_SetCameraControlMode 0x910b
#define PTP_OC_OLYMPUS_SetWBRGBGain 0x910c
#define PTP_OC_OLYMPUS_GetDeviceInfo 0x9301
#define PTP_OC_OLYMPUS_OpenSession 0x9302
#define PTP_OC_OLYMPUS_SetDateTime 0x9402
#define PTP_OC_OLYMPUS_GetDateTime 0x9482
#define PTP_OC_OLYMPUS_SetCameraID 0x9501
#define PTP_OC_OLYMPUS_GetCameraID 0x9581
/* Android Random I/O Extensions Codes */
#define PTP_OC_ANDROID_GetPartialObject64 0x95C1
#define PTP_OC_ANDROID_SendPartialObject 0x95C2
#define PTP_OC_ANDROID_TruncateObject 0x95C3
#define PTP_OC_ANDROID_BeginEditObject 0x95C4
#define PTP_OC_ANDROID_EndEditObject 0x95C5
/* Proprietary vendor extension operations mask */
#define PTP_OC_EXTENSION_MASK 0xF000
#define PTP_OC_EXTENSION 0x9000
/* Response Codes */
/* PTP v1.0 response codes */
#define PTP_RC_Undefined 0x2000
#define PTP_RC_OK 0x2001
#define PTP_RC_GeneralError 0x2002
#define PTP_RC_SessionNotOpen 0x2003
#define PTP_RC_InvalidTransactionID 0x2004
#define PTP_RC_OperationNotSupported 0x2005
#define PTP_RC_ParameterNotSupported 0x2006
#define PTP_RC_IncompleteTransfer 0x2007
#define PTP_RC_InvalidStorageId 0x2008
#define PTP_RC_InvalidObjectHandle 0x2009
#define PTP_RC_DevicePropNotSupported 0x200A
#define PTP_RC_InvalidObjectFormatCode 0x200B
#define PTP_RC_StoreFull 0x200C
#define PTP_RC_ObjectWriteProtected 0x200D
#define PTP_RC_StoreReadOnly 0x200E
#define PTP_RC_AccessDenied 0x200F
#define PTP_RC_NoThumbnailPresent 0x2010
#define PTP_RC_SelfTestFailed 0x2011
#define PTP_RC_PartialDeletion 0x2012
#define PTP_RC_StoreNotAvailable 0x2013
#define PTP_RC_SpecificationByFormatUnsupported 0x2014
#define PTP_RC_NoValidObjectInfo 0x2015
#define PTP_RC_InvalidCodeFormat 0x2016
#define PTP_RC_UnknownVendorCode 0x2017
#define PTP_RC_CaptureAlreadyTerminated 0x2018
#define PTP_RC_DeviceBusy 0x2019
#define PTP_RC_InvalidParentObject 0x201A
#define PTP_RC_InvalidDevicePropFormat 0x201B
#define PTP_RC_InvalidDevicePropValue 0x201C
#define PTP_RC_InvalidParameter 0x201D
#define PTP_RC_SessionAlreadyOpened 0x201E
#define PTP_RC_TransactionCanceled 0x201F
#define PTP_RC_SpecificationOfDestinationUnsupported 0x2020
/* PTP v1.1 response codes */
#define PTP_RC_InvalidEnumHandle 0x2021
#define PTP_RC_NoStreamEnabled 0x2022
#define PTP_RC_InvalidDataSet 0x2023
/* Eastman Kodak extension Response Codes */
#define PTP_RC_EK_FilenameRequired 0xA001
#define PTP_RC_EK_FilenameConflicts 0xA002
#define PTP_RC_EK_FilenameInvalid 0xA003
/* Nikon specific response codes */
#define PTP_RC_NIKON_HardwareError 0xA001
#define PTP_RC_NIKON_OutOfFocus 0xA002
#define PTP_RC_NIKON_ChangeCameraModeFailed 0xA003
#define PTP_RC_NIKON_InvalidStatus 0xA004
#define PTP_RC_NIKON_SetPropertyNotSupported 0xA005
#define PTP_RC_NIKON_WbResetError 0xA006
#define PTP_RC_NIKON_DustReferenceError 0xA007
#define PTP_RC_NIKON_ShutterSpeedBulb 0xA008
#define PTP_RC_NIKON_MirrorUpSequence 0xA009
#define PTP_RC_NIKON_CameraModeNotAdjustFNumber 0xA00A
#define PTP_RC_NIKON_NotLiveView 0xA00B
#define PTP_RC_NIKON_MfDriveStepEnd 0xA00C
#define PTP_RC_NIKON_MfDriveStepInsufficiency 0xA00E
#define PTP_RC_NIKON_AdvancedTransferCancel 0xA022
/* Canon specific response codes */
#define PTP_RC_CANON_UNKNOWN_COMMAND 0xA001
#define PTP_RC_CANON_OPERATION_REFUSED 0xA005
#define PTP_RC_CANON_LENS_COVER 0xA006
#define PTP_RC_CANON_BATTERY_LOW 0xA101
#define PTP_RC_CANON_NOT_READY 0xA102
#define PTP_RC_CANON_A009 0xA009
/* Microsoft/MTP specific codes */
#define PTP_RC_MTP_Undefined 0xA800
#define PTP_RC_MTP_Invalid_ObjectPropCode 0xA801
#define PTP_RC_MTP_Invalid_ObjectProp_Format 0xA802
#define PTP_RC_MTP_Invalid_ObjectProp_Value 0xA803
#define PTP_RC_MTP_Invalid_ObjectReference 0xA804
#define PTP_RC_MTP_Invalid_Dataset 0xA806
#define PTP_RC_MTP_Specification_By_Group_Unsupported 0xA807
#define PTP_RC_MTP_Specification_By_Depth_Unsupported 0xA808
#define PTP_RC_MTP_Object_Too_Large 0xA809
#define PTP_RC_MTP_ObjectProp_Not_Supported 0xA80A
/* Microsoft Advanced Audio/Video Transfer response codes
(microsoft.com/AAVT 1.0) */
#define PTP_RC_MTP_Invalid_Media_Session_ID 0xA170
#define PTP_RC_MTP_Media_Session_Limit_Reached 0xA171
#define PTP_RC_MTP_No_More_Data 0xA172
/* WiFi Provisioning MTP Extension Error Codes (microsoft.com/WPDWCN: 1.0) */
#define PTP_RC_MTP_Invalid_WFC_Syntax 0xA121
#define PTP_RC_MTP_WFC_Version_Not_Supported 0xA122
/* libptp2 extended ERROR codes */
#define PTP_ERROR_IO 0x02FF
#define PTP_ERROR_DATA_EXPECTED 0x02FE
#define PTP_ERROR_RESP_EXPECTED 0x02FD
#define PTP_ERROR_BADPARAM 0x02FC
#define PTP_ERROR_CANCEL 0x02FB
#define PTP_ERROR_TIMEOUT 0x02FA
/* PTP Event Codes */
#define PTP_EC_Undefined 0x4000
#define PTP_EC_CancelTransaction 0x4001
#define PTP_EC_ObjectAdded 0x4002
#define PTP_EC_ObjectRemoved 0x4003
#define PTP_EC_StoreAdded 0x4004
#define PTP_EC_StoreRemoved 0x4005
#define PTP_EC_DevicePropChanged 0x4006
#define PTP_EC_ObjectInfoChanged 0x4007
#define PTP_EC_DeviceInfoChanged 0x4008
#define PTP_EC_RequestObjectTransfer 0x4009
#define PTP_EC_StoreFull 0x400A
#define PTP_EC_DeviceReset 0x400B
#define PTP_EC_StorageInfoChanged 0x400C
#define PTP_EC_CaptureComplete 0x400D
#define PTP_EC_UnreportedStatus 0x400E
/* Canon extension Event Codes */
#define PTP_EC_CANON_ExtendedErrorcode 0xC005 /* ? */
#define PTP_EC_CANON_ObjectInfoChanged 0xC008
#define PTP_EC_CANON_RequestObjectTransfer 0xC009
#define PTP_EC_CANON_ShutterButtonPressed0 0xC00B
#define PTP_EC_CANON_CameraModeChanged 0xC00C
#define PTP_EC_CANON_ShutterButtonPressed1 0xC00E
#define PTP_EC_CANON_StartDirectTransfer 0xC011
#define PTP_EC_CANON_StopDirectTransfer 0xC013
/* Canon EOS events */
#define PTP_EC_CANON_EOS_RequestGetEvent 0xc101
#define PTP_EC_CANON_EOS_ObjectAddedEx 0xc181
#define PTP_EC_CANON_EOS_ObjectRemoved 0xc182
#define PTP_EC_CANON_EOS_RequestGetObjectInfoEx 0xc183
#define PTP_EC_CANON_EOS_StorageStatusChanged 0xc184
#define PTP_EC_CANON_EOS_StorageInfoChanged 0xc185
#define PTP_EC_CANON_EOS_RequestObjectTransfer 0xc186
#define PTP_EC_CANON_EOS_ObjectInfoChangedEx 0xc187
#define PTP_EC_CANON_EOS_ObjectContentChanged 0xc188
#define PTP_EC_CANON_EOS_PropValueChanged 0xc189
#define PTP_EC_CANON_EOS_AvailListChanged 0xc18a
#define PTP_EC_CANON_EOS_CameraStatusChanged 0xc18b
#define PTP_EC_CANON_EOS_WillSoonShutdown 0xc18d
#define PTP_EC_CANON_EOS_ShutdownTimerUpdated 0xc18e
#define PTP_EC_CANON_EOS_RequestCancelTransfer 0xc18f
#define PTP_EC_CANON_EOS_RequestObjectTransferDT 0xc190
#define PTP_EC_CANON_EOS_RequestCancelTransferDT 0xc191
#define PTP_EC_CANON_EOS_StoreAdded 0xc192
#define PTP_EC_CANON_EOS_StoreRemoved 0xc193
#define PTP_EC_CANON_EOS_BulbExposureTime 0xc194
#define PTP_EC_CANON_EOS_RecordingTime 0xc195
#define PTP_EC_CANON_EOS_RequestObjectTransferTS 0xC1a2
#define PTP_EC_CANON_EOS_AfResult 0xc1a3
/* Nikon extension Event Codes */
/* Nikon extension Event Codes */
#define PTP_EC_Nikon_ObjectAddedInSDRAM 0xC101
#define PTP_EC_Nikon_CaptureCompleteRecInSdram 0xC102
/* Gets 1 parameter, objectid pointing to DPOF object */
#define PTP_EC_Nikon_AdvancedTransfer 0xC103
#define PTP_EC_Nikon_PreviewImageAdded 0xC104
/* Olympus E series */
#define PTP_EC_Olympus_PropertyChanged 0xC102
#define PTP_EC_Olympus_CaptureComplete 0xC103
/* MTP Event codes */
#define PTP_EC_MTP_ObjectPropChanged 0xC801
#define PTP_EC_MTP_ObjectPropDescChanged 0xC802
#define PTP_EC_MTP_ObjectReferencesChanged 0xC803
/* constants for GetObjectHandles */
#define PTP_GOH_ALL_STORAGE 0xffffffff
#define PTP_GOH_ALL_FORMATS 0x00000000
#define PTP_GOH_ALL_ASSOCS 0x00000000
#define PTP_GOH_ROOT_PARENT 0xffffffff
/* PTP device info structure (returned by GetDevInfo) */
struct _PTPDeviceInfo {
uint16_t StandardVersion;
uint32_t VendorExtensionID;
uint16_t VendorExtensionVersion;
char *VendorExtensionDesc;
uint16_t FunctionalMode;
uint32_t OperationsSupported_len;
uint16_t *OperationsSupported;
uint32_t EventsSupported_len;
uint16_t *EventsSupported;
uint32_t DevicePropertiesSupported_len;
uint16_t *DevicePropertiesSupported;
uint32_t CaptureFormats_len;
uint16_t *CaptureFormats;
uint32_t ImageFormats_len;
uint16_t *ImageFormats;
char *Manufacturer;
char *Model;
char *DeviceVersion;
char *SerialNumber;
};
typedef struct _PTPDeviceInfo PTPDeviceInfo;
/* PTP storageIDs structute (returned by GetStorageIDs) */
struct _PTPStorageIDs {
uint32_t n;
uint32_t *Storage;
};
typedef struct _PTPStorageIDs PTPStorageIDs;
/* PTP StorageInfo structure (returned by GetStorageInfo) */
struct _PTPStorageInfo {
uint16_t StorageType;
uint16_t FilesystemType;
uint16_t AccessCapability;
uint64_t MaxCapability;
uint64_t FreeSpaceInBytes;
uint32_t FreeSpaceInImages;
char *StorageDescription;
char *VolumeLabel;
};
typedef struct _PTPStorageInfo PTPStorageInfo;
/* PTP objecthandles structure (returned by GetObjectHandles) */
struct _PTPObjectHandles {
uint32_t n;
uint32_t *Handler;
};
typedef struct _PTPObjectHandles PTPObjectHandles;
#define PTP_HANDLER_SPECIAL 0xffffffff
#define PTP_HANDLER_ROOT 0x00000000
/* PTP objectinfo structure (returned by GetObjectInfo) */
struct _PTPObjectInfo {
uint32_t StorageID;
uint16_t ObjectFormat;
uint16_t ProtectionStatus;
/* In the regular objectinfo this is 32bit,
* but we keep the general object size here
* that also arrives via other methods and so
* use 64bit */
uint64_t ObjectCompressedSize;
uint16_t ThumbFormat;
uint32_t ThumbCompressedSize;
uint32_t ThumbPixWidth;
uint32_t ThumbPixHeight;
uint32_t ImagePixWidth;
uint32_t ImagePixHeight;
uint32_t ImageBitDepth;
uint32_t ParentObject;
uint16_t AssociationType;
uint32_t AssociationDesc;
uint32_t SequenceNumber;
char *Filename;
time_t CaptureDate;
time_t ModificationDate;
char *Keywords;
};
typedef struct _PTPObjectInfo PTPObjectInfo;
/* max ptp string length INCLUDING terminating null character */
#define PTP_MAXSTRLEN 255
/* PTP Object Format Codes */
/* ancillary formats */
#define PTP_OFC_Undefined 0x3000
#define PTP_OFC_Defined 0x3800
#define PTP_OFC_Association 0x3001
#define PTP_OFC_Script 0x3002
#define PTP_OFC_Executable 0x3003
#define PTP_OFC_Text 0x3004
#define PTP_OFC_HTML 0x3005
#define PTP_OFC_DPOF 0x3006
#define PTP_OFC_AIFF 0x3007
#define PTP_OFC_WAV 0x3008
#define PTP_OFC_MP3 0x3009
#define PTP_OFC_AVI 0x300A
#define PTP_OFC_MPEG 0x300B
#define PTP_OFC_ASF 0x300C
#define PTP_OFC_QT 0x300D /* guessing */
/* image formats */
#define PTP_OFC_EXIF_JPEG 0x3801
#define PTP_OFC_TIFF_EP 0x3802
#define PTP_OFC_FlashPix 0x3803
#define PTP_OFC_BMP 0x3804
#define PTP_OFC_CIFF 0x3805
#define PTP_OFC_Undefined_0x3806 0x3806
#define PTP_OFC_GIF 0x3807
#define PTP_OFC_JFIF 0x3808
#define PTP_OFC_PCD 0x3809
#define PTP_OFC_PICT 0x380A
#define PTP_OFC_PNG 0x380B
#define PTP_OFC_Undefined_0x380C 0x380C
#define PTP_OFC_TIFF 0x380D
#define PTP_OFC_TIFF_IT 0x380E
#define PTP_OFC_JP2 0x380F
#define PTP_OFC_JPX 0x3810
/* ptp v1.1 has only DNG new */
#define PTP_OFC_DNG 0x3811
/* Eastman Kodak extension ancillary format */
#define PTP_OFC_EK_M3U 0xb002
/* Canon extension */
#define PTP_OFC_CANON_CRW 0xb101
#define PTP_OFC_CANON_CRW3 0xb103
#define PTP_OFC_CANON_MOV 0xb104
#define PTP_OFC_CANON_MOV2 0xb105
/* CHDK specific raw mode */
#define PTP_OFC_CANON_CHDK_CRW 0xb1ff
/* MTP extensions */
#define PTP_OFC_MTP_MediaCard 0xb211
#define PTP_OFC_MTP_MediaCardGroup 0xb212
#define PTP_OFC_MTP_Encounter 0xb213
#define PTP_OFC_MTP_EncounterBox 0xb214
#define PTP_OFC_MTP_M4A 0xb215
#define PTP_OFC_MTP_ZUNEUNDEFINED 0xb217 /* Unknown file type */
#define PTP_OFC_MTP_Firmware 0xb802
#define PTP_OFC_MTP_WindowsImageFormat 0xb881
#define PTP_OFC_MTP_UndefinedAudio 0xb900
#define PTP_OFC_MTP_WMA 0xb901
#define PTP_OFC_MTP_OGG 0xb902
#define PTP_OFC_MTP_AAC 0xb903
#define PTP_OFC_MTP_AudibleCodec 0xb904
#define PTP_OFC_MTP_FLAC 0xb906
#define PTP_OFC_MTP_SamsungPlaylist 0xb909
#define PTP_OFC_MTP_UndefinedVideo 0xb980
#define PTP_OFC_MTP_WMV 0xb981
#define PTP_OFC_MTP_MP4 0xb982
#define PTP_OFC_MTP_MP2 0xb983
#define PTP_OFC_MTP_3GP 0xb984
#define PTP_OFC_MTP_UndefinedCollection 0xba00
#define PTP_OFC_MTP_AbstractMultimediaAlbum 0xba01
#define PTP_OFC_MTP_AbstractImageAlbum 0xba02
#define PTP_OFC_MTP_AbstractAudioAlbum 0xba03
#define PTP_OFC_MTP_AbstractVideoAlbum 0xba04
#define PTP_OFC_MTP_AbstractAudioVideoPlaylist 0xba05
#define PTP_OFC_MTP_AbstractContactGroup 0xba06
#define PTP_OFC_MTP_AbstractMessageFolder 0xba07
#define PTP_OFC_MTP_AbstractChapteredProduction 0xba08
#define PTP_OFC_MTP_AbstractAudioPlaylist 0xba09
#define PTP_OFC_MTP_AbstractVideoPlaylist 0xba0a
#define PTP_OFC_MTP_AbstractMediacast 0xba0b
#define PTP_OFC_MTP_WPLPlaylist 0xba10
#define PTP_OFC_MTP_M3UPlaylist 0xba11
#define PTP_OFC_MTP_MPLPlaylist 0xba12
#define PTP_OFC_MTP_ASXPlaylist 0xba13
#define PTP_OFC_MTP_PLSPlaylist 0xba14
#define PTP_OFC_MTP_UndefinedDocument 0xba80
#define PTP_OFC_MTP_AbstractDocument 0xba81
#define PTP_OFC_MTP_XMLDocument 0xba82
#define PTP_OFC_MTP_MSWordDocument 0xba83
#define PTP_OFC_MTP_MHTCompiledHTMLDocument 0xba84
#define PTP_OFC_MTP_MSExcelSpreadsheetXLS 0xba85
#define PTP_OFC_MTP_MSPowerpointPresentationPPT 0xba86
#define PTP_OFC_MTP_UndefinedMessage 0xbb00
#define PTP_OFC_MTP_AbstractMessage 0xbb01
#define PTP_OFC_MTP_UndefinedContact 0xbb80
#define PTP_OFC_MTP_AbstractContact 0xbb81
#define PTP_OFC_MTP_vCard2 0xbb82
#define PTP_OFC_MTP_vCard3 0xbb83
#define PTP_OFC_MTP_UndefinedCalendarItem 0xbe00
#define PTP_OFC_MTP_AbstractCalendarItem 0xbe01
#define PTP_OFC_MTP_vCalendar1 0xbe02
#define PTP_OFC_MTP_vCalendar2 0xbe03
#define PTP_OFC_MTP_UndefinedWindowsExecutable 0xbe80
#define PTP_OFC_MTP_MediaCast 0xbe81
#define PTP_OFC_MTP_Section 0xbe82
/* PTP Association Types */
#define PTP_AT_Undefined 0x0000
#define PTP_AT_GenericFolder 0x0001
#define PTP_AT_Album 0x0002
#define PTP_AT_TimeSequence 0x0003
#define PTP_AT_HorizontalPanoramic 0x0004
#define PTP_AT_VerticalPanoramic 0x0005
#define PTP_AT_2DPanoramic 0x0006
#define PTP_AT_AncillaryData 0x0007
/* PTP Protection Status */
#define PTP_PS_NoProtection 0x0000
#define PTP_PS_ReadOnly 0x0001
#define PTP_PS_MTP_ReadOnlyData 0x8002
#define PTP_PS_MTP_NonTransferableData 0x8003
/* PTP Storage Types */
#define PTP_ST_Undefined 0x0000
#define PTP_ST_FixedROM 0x0001