-
Notifications
You must be signed in to change notification settings - Fork 322
/
library.c
8731 lines (7733 loc) · 321 KB
/
library.c
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
/* library.c
*
* Copyright (C) 2001-2005 Mariusz Woloszyn <[email protected]>
* Copyright (C) 2003-2019 Marcus Meissner <[email protected]>
* Copyright (C) 2005 Hubert Figuiere <[email protected]>
* Copyright (C) 2009 Axel Waggershauser <[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., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301 USA
*/
#define _DEFAULT_SOURCE
#include "config.h"
#include <stdlib.h>
#include <string.h>
#include <stdio.h>
#include <stdarg.h>
#include <time.h>
#include <sys/time.h>
#if defined(HAVE_ICONV) && defined(HAVE_LANGINFO_H)
#include <langinfo.h>
#endif
#include <gphoto2/gphoto2-library.h>
#include <gphoto2/gphoto2-port-log.h>
#include <gphoto2/gphoto2-setting.h>
#ifdef ENABLE_NLS
# include <libintl.h>
# undef _
# define _(String) dgettext (GETTEXT_PACKAGE, String)
# ifdef gettext_noop
# define N_(String) gettext_noop (String)
# else
# define N_(String) (String)
# endif
#else
# define textdomain(String) (String)
# define gettext(String) (String)
# define dgettext(Domain,Message) (Message)
# define dcgettext(Domain,Message,Type) (Message)
# define bindtextdomain(Domain,Directory) (Domain)
# define _(String) (String)
# define N_(String) (String)
#endif
#include "ptp.h"
#include "ptp-bugs.h"
#include "ptp-private.h"
#include "ptp-pack.c"
#include "olympus-wrap.h"
#define USB_START_TIMEOUT 8000
#define USB_CANON_START_TIMEOUT 1500 /* 1.5 seconds (0.5 was too low) */
#define USB_NORMAL_TIMEOUT 20000
static int normal_timeout = USB_NORMAL_TIMEOUT;
#define USB_TIMEOUT_CAPTURE 100000
static int capture_timeout = USB_TIMEOUT_CAPTURE;
#define SET_CONTEXT(camera, ctx) ((PTPData *) camera->pl->params.data)->context = ctx
#define SET_CONTEXT_P(p, ctx) ((PTPData *) p->data)->context = ctx
/* below macro makes a copy of fn without leading character ('/'),
* removes the '/' at the end if present, and calls folder_to_handle()
* funtion proviging as the first argument the string after the second '/'.
* for example if fn is '/store_00010001/DCIM/somefolder/', the macro will
* call folder_to_handle() with 'DCIM/somefolder' as the very first argument.
* it's used to omit storage pseudofolder and remove trailing '/'
*/
#define find_folder_handle(params,fn,s,p) { \
{ \
int len=strlen(fn); \
char *backfolder=malloc(len); \
char *tmpfolder; \
memcpy(backfolder,fn+1, len); \
if (backfolder[len-2]=='/') backfolder[len-2]='\0';\
if ((tmpfolder=strchr(backfolder+1,'/'))==NULL) tmpfolder="/";\
p=folder_to_handle(params, tmpfolder+1,s,0,NULL);\
free(backfolder); \
} \
}
#define folder_to_storage(fn,s) { \
if (!strncmp(fn,"/"STORAGE_FOLDER_PREFIX,strlen(STORAGE_FOLDER_PREFIX)+1)) \
{ \
if (strlen(fn)<strlen(STORAGE_FOLDER_PREFIX)+8+1) \
return (GP_ERROR); \
s = strtoul(fn + strlen(STORAGE_FOLDER_PREFIX)+1, NULL, 16); \
} else { \
gp_context_error (context, _("You need to specify a folder starting with /store_xxxxxxxxx/")); \
return (GP_ERROR); \
} \
}
typedef int (*getfunc_t)(CameraFilesystem*, const char*, const char *, CameraFileType, CameraFile *, void *, GPContext *);
typedef int (*putfunc_t)(CameraFilesystem*, const char*, CameraFile*, void*, GPContext*);
struct special_file {
char *name;
getfunc_t getfunc;
putfunc_t putfunc;
};
static unsigned int nrofspecial_files = 0;
static struct special_file *special_files = NULL;
static int
add_special_file (char *name, getfunc_t getfunc, putfunc_t putfunc) {
C_MEM (special_files = realloc (special_files, sizeof(special_files[0])*(nrofspecial_files+1)));
C_MEM (special_files[nrofspecial_files].name = strdup(name));
special_files[nrofspecial_files].putfunc = putfunc;
special_files[nrofspecial_files].getfunc = getfunc;
nrofspecial_files++;
return (GP_OK);
}
#define STORAGE_FOLDER_PREFIX "store_"
int
translate_ptp_result (uint16_t result)
{
switch (result) {
case PTP_RC_OK: return GP_OK;
case PTP_RC_ParameterNotSupported: return GP_ERROR_BAD_PARAMETERS;
case PTP_RC_OperationNotSupported: return GP_ERROR_NOT_SUPPORTED;
case PTP_RC_DeviceBusy: return GP_ERROR_CAMERA_BUSY;
case PTP_ERROR_NODEVICE: return GP_ERROR_IO_USB_FIND;
case PTP_ERROR_TIMEOUT: return GP_ERROR_TIMEOUT;
case PTP_ERROR_CANCEL: return GP_ERROR_CANCEL;
case PTP_ERROR_BADPARAM: return GP_ERROR_BAD_PARAMETERS;
case PTP_ERROR_IO:
case PTP_ERROR_DATA_EXPECTED:
case PTP_ERROR_RESP_EXPECTED: return GP_ERROR_IO;
default: return GP_ERROR;
}
}
uint16_t
translate_gp_result_to_ptp (int gp_result)
{
switch (gp_result) {
case GP_OK: return PTP_RC_OK;
case GP_ERROR_BAD_PARAMETERS: return PTP_RC_ParameterNotSupported;
case GP_ERROR_NOT_SUPPORTED: return PTP_RC_OperationNotSupported;
case GP_ERROR_CAMERA_BUSY: return PTP_RC_DeviceBusy;
case GP_ERROR_IO_USB_FIND: return PTP_ERROR_NODEVICE;
case GP_ERROR_TIMEOUT: return PTP_ERROR_TIMEOUT;
case GP_ERROR_CANCEL: return PTP_ERROR_CANCEL;
case GP_ERROR_IO: return PTP_ERROR_IO;
default: return PTP_RC_GeneralError;
}
}
static void
print_debug_deviceinfo (PTPParams *params, PTPDeviceInfo *di)
{
unsigned int i;
GP_LOG_D ("Device info:");
GP_LOG_D ("Manufacturer: %s",di->Manufacturer);
GP_LOG_D (" Model: %s", di->Model);
GP_LOG_D (" device version: %s", di->DeviceVersion);
GP_LOG_D (" serial number: '%s'",di->SerialNumber);
GP_LOG_D ("Vendor extension ID: 0x%08x",di->VendorExtensionID);
GP_LOG_D ("Vendor extension version: %d",di->VendorExtensionVersion);
GP_LOG_D ("Vendor extension description: %s",di->VendorExtensionDesc);
GP_LOG_D ("Functional Mode: 0x%04x",di->FunctionalMode);
GP_LOG_D ("PTP Standard Version: %d",di->StandardVersion);
GP_LOG_D ("Supported operations:");
for (i=0; i<di->OperationsSupported_len; i++)
GP_LOG_D (" 0x%04x (%s)", di->OperationsSupported[i], ptp_get_opcode_name (params, di->OperationsSupported[i]));
GP_LOG_D ("Events Supported:");
for (i=0; i<di->EventsSupported_len; i++)
GP_LOG_D (" 0x%04x (%s)", di->EventsSupported[i], ptp_get_event_code_name (params, di->EventsSupported[i]));
GP_LOG_D ("Device Properties Supported:");
for (i=0; i<di->DevicePropertiesSupported_len; i++) {
const char *ptpname = ptp_get_property_description (params, di->DevicePropertiesSupported[i]);
GP_LOG_D (" 0x%04x (%s)", di->DevicePropertiesSupported[i], ptpname ? ptpname : "Unknown DPC code");
}
}
/* struct timeval is simply two long int values, so passing it by value is not expensive.
* It is most likely going to be inlined anyway and therefore 'free'. Passing it by value
* leads to a cleaner interface. */
static struct timeval
time_now() {
struct timeval curtime;
gettimeofday (&curtime, NULL);
return curtime;
}
static int
time_since (const struct timeval start) {
struct timeval curtime = time_now();
return ((curtime.tv_sec - start.tv_sec)*1000)+((curtime.tv_usec - start.tv_usec)/1000);
}
static int
waiting_for_timeout (int *current_wait, struct timeval start, int timeout) {
#ifndef FUZZING_BUILD_MODE_UNSAFE_FOR_PRODUCTION
int time_to_timeout = timeout - time_since (start);
if (time_to_timeout <= 0) /* we timed out already ... */
return 0;
*current_wait += 50; /* increase sleep time by 50ms per cycle */
if (*current_wait > 200)
*current_wait = 200; /* 200ms is the maximum sleep time */
if (*current_wait > time_to_timeout)
*current_wait = time_to_timeout; /* never sleep 'into' the timeout */
if (*current_wait > 0)
usleep (*current_wait * 1000);
return *current_wait > 0;
#else
/* Wait always timeout during fuzzing! */
return 0;
#endif
}
/* Changes the ptp deviceinfo with additional hidden information available,
* or stuff that requires special tricks
*/
int
fixup_cached_deviceinfo (Camera *camera, PTPDeviceInfo *di) {
CameraAbilities a;
PTPParams *params = &camera->pl->params;
gp_camera_get_abilities(camera, &a);
/* Panasonic GH5 */
if ( (di->VendorExtensionID == PTP_VENDOR_PANASONIC) &&
(camera->port->type == GP_PORT_USB) &&
(a.usb_product == 0x2382)
) {
C_MEM (di->OperationsSupported = realloc(di->OperationsSupported,sizeof(di->OperationsSupported[0])*(di->OperationsSupported_len + 6)));
di->OperationsSupported[di->OperationsSupported_len+0] = PTP_OC_PANASONIC_GetProperty;
di->OperationsSupported[di->OperationsSupported_len+1] = PTP_OC_PANASONIC_SetProperty;
di->OperationsSupported[di->OperationsSupported_len+2] = PTP_OC_PANASONIC_ListProperty;
di->OperationsSupported[di->OperationsSupported_len+3] = PTP_OC_PANASONIC_InitiateCapture;
di->OperationsSupported[di->OperationsSupported_len+4] = PTP_OC_PANASONIC_Liveview;
di->OperationsSupported[di->OperationsSupported_len+5] = PTP_OC_PANASONIC_LiveviewImage;
di->OperationsSupported_len += 6;
}
/* Panasonic hack */
if ( (di->VendorExtensionID == PTP_VENDOR_MICROSOFT) &&
(camera->port->type == GP_PORT_USB) &&
(a.usb_vendor == 0x04da)
) {
PTPPropertyValue propval;
/* Panasonic changes its device info if the MTP Initiator
* is set, and e.g. adds DeleteObject.
* (found in Windows USB traces) */
if (!ptp_property_issupported(params, PTP_DPC_MTP_SessionInitiatorInfo))
return GP_OK;
propval.str = "Windows/6.2.9200 MTPClassDriver/6.2.9200.16384";
C_PTP (ptp_setdevicepropvalue (params, PTP_DPC_MTP_SessionInitiatorInfo, &propval, PTP_DTC_STR));
C_PTP (ptp_getdeviceinfo (params, di));
return GP_OK;
}
/* XML style Olympus E series control. internal deviceInfos is encoded in XML. */
if ( di->Manufacturer && !strcmp(di->Manufacturer,"OLYMPUS") &&
(params->device_flags & DEVICE_FLAG_OLYMPUS_XML_WRAPPED)
) {
PTPDeviceInfo ndi, newdi, *outerdi;
unsigned int i;
C_PTP (ptp_getdeviceinfo (params, ¶ms->outer_deviceinfo));
outerdi = ¶ms->outer_deviceinfo;
C_PTP (ptp_olympus_getdeviceinfo (&camera->pl->params, &ndi));
/* Now merge the XML (inner) and outer (PictBridge) Deviceinfo. */
memcpy (&newdi, outerdi, sizeof(PTPDeviceInfo));
/* dup the strings */
if (outerdi->VendorExtensionDesc) C_MEM (newdi.VendorExtensionDesc = strdup (outerdi->VendorExtensionDesc));
if (outerdi->Manufacturer) C_MEM (newdi.Manufacturer = strdup (outerdi->Manufacturer));
if (outerdi->Model) C_MEM (newdi.Model = strdup (outerdi->Model));
if (outerdi->DeviceVersion) C_MEM (newdi.DeviceVersion = strdup (outerdi->DeviceVersion));
if (outerdi->SerialNumber) C_MEM (newdi.SerialNumber = strdup (outerdi->SerialNumber));
/* Dup and merge the lists */
#define DI_MERGE(x) \
C_MEM (newdi.x = malloc(sizeof(outerdi->x[0])*(ndi.x##_len + outerdi->x##_len)));\
for (i = 0; i < outerdi->x##_len ; i++) \
newdi.x[i] = outerdi->x[i]; \
for (i = 0; i < ndi.x##_len ; i++) \
newdi.x[i+outerdi->x##_len] = ndi.x[i]; \
newdi.x##_len = ndi.x##_len + outerdi->x##_len;
DI_MERGE(OperationsSupported);
DI_MERGE(EventsSupported);
DI_MERGE(DevicePropertiesSupported);
DI_MERGE(CaptureFormats);
DI_MERGE(ImageFormats);
/* libgphoto2 specific for usage in config trees */
newdi.VendorExtensionID = PTP_VENDOR_GP_OLYMPUS;
GP_LOG_D ("Dumping Olympus Deviceinfo");
print_debug_deviceinfo (params, &newdi);
ptp_free_DI (di);
memcpy (di, &newdi, sizeof(newdi));
return GP_OK;
}
/* for USB class matches on unknown cameras that were matches with PTP generic... */
if (!a.usb_vendor && di->Manufacturer) {
if (strstr (di->Manufacturer,"Canon"))
a.usb_vendor = 0x4a9;
if (strstr (di->Manufacturer,"Nikon"))
a.usb_vendor = 0x4b0;
}
/* Switch the PTP vendor, so that the vendor specific sets become available. */
if ( (di->VendorExtensionID == PTP_VENDOR_MICROSOFT) &&
di->Manufacturer
) {
if (strstr (di->Manufacturer,"Canon"))
di->VendorExtensionID = PTP_VENDOR_CANON;
if (strstr (di->Manufacturer,"Nikon"))
di->VendorExtensionID = PTP_VENDOR_NIKON;
}
/* Newer Canons say that they are MTP devices. Restore Canon vendor extid. */
if ( ( (di->VendorExtensionID == PTP_VENDOR_MICROSOFT) ||
(di->VendorExtensionID == PTP_VENDOR_MTP)
) &&
(camera->port->type == GP_PORT_USB) &&
(a.usb_vendor == 0x4a9)
) {
/*camera->pl->bugs |= PTP_MTP;*/
di->VendorExtensionID = PTP_VENDOR_CANON;
}
/* Newer Nikons (D40) say that they are MTP devices. Restore Nikon vendor extid. */
if ( ( (di->VendorExtensionID == PTP_VENDOR_MICROSOFT) ||
(di->VendorExtensionID == PTP_VENDOR_MTP)
) &&
(camera->port->type == GP_PORT_USB) &&
(a.usb_vendor == 0x4b0)
) {
/*camera->pl->bugs |= PTP_MTP;*/
di->VendorExtensionID = PTP_VENDOR_NIKON;
}
/* Fuji S5 Pro mostly, make its vendor set available. */
if ( (di->VendorExtensionID == PTP_VENDOR_MICROSOFT) &&
(camera->port->type == GP_PORT_USB) &&
(a.usb_vendor == 0x4cb) &&
strstr(di->VendorExtensionDesc,"fujifilm.co.jp: 1.0;")
) {
/*camera->pl->bugs |= PTP_MTP;*/
di->VendorExtensionID = PTP_VENDOR_FUJI;
}
if ( di->Manufacturer && !strcmp(di->Manufacturer,"OLYMPUS") && !strncmp(di->Model,"E-M",3) ) {
GP_LOG_D ("Setting Olympus VendorExtensionID to PTP_VENDOR_GP_OLYMPUS_OMD");
di->VendorExtensionID = PTP_VENDOR_GP_OLYMPUS_OMD;
}
if (di->VendorExtensionID == PTP_VENDOR_FUJI) {
C_MEM (di->DevicePropertiesSupported = realloc(di->DevicePropertiesSupported,sizeof(di->DevicePropertiesSupported[0])*(di->DevicePropertiesSupported_len + 5)));
di->DevicePropertiesSupported[di->DevicePropertiesSupported_len+0] = PTP_DPC_ExposureTime;
di->DevicePropertiesSupported[di->DevicePropertiesSupported_len+1] = PTP_DPC_FNumber;
di->DevicePropertiesSupported[di->DevicePropertiesSupported_len+2] = 0xd38c; /* PC Mode */
di->DevicePropertiesSupported[di->DevicePropertiesSupported_len+3] = 0xd171; /* Focus control */
di->DevicePropertiesSupported[di->DevicePropertiesSupported_len+4] = 0xd21c; /* Needed for X-T2? */
di->DevicePropertiesSupported_len += 5;
}
/* Nikon DSLR hide its newer opcodes behind another vendor specific query,
* do that and merge it into the generic PTP deviceinfo. */
if (di->VendorExtensionID == PTP_VENDOR_NIKON) {
unsigned int i;
unsigned int nikond;
/* Nikon V* and J* advertise the new Nikon stuff, but only do the generic
* PTP capture. FIXME: could use flags. */
if (params->deviceinfo.Model && (
(params->deviceinfo.Model[0]=='J') || /* J1 - J3 currently */
(params->deviceinfo.Model[0]=='V') || /* V1 - V3 currently */
((params->deviceinfo.Model[0]=='S') && strlen(params->deviceinfo.Model) < 3) /* S1 - S2 currently */
/* but not S7000 */
)
) {
if (!NIKON_1(&camera->pl->params)) {
GP_LOG_E ("if camera is Nikon 1 series, camera should probably have flag NIKON_1 set. report that to the libgphoto2 project");
camera->pl->params.device_flags |= PTP_NIKON_1;
}
/* The 1 hides some commands from us ... */
if ( ptp_operation_issupported(&camera->pl->params, PTP_OC_NIKON_CheckEvent) &&
!ptp_operation_issupported(&camera->pl->params, PTP_OC_NIKON_GetVendorPropCodes)
) {
C_MEM (di->OperationsSupported = realloc(di->OperationsSupported,sizeof(di->OperationsSupported[0])*(di->OperationsSupported_len + 2)));
di->OperationsSupported[di->OperationsSupported_len+0] = PTP_OC_NIKON_GetVendorPropCodes;
di->OperationsSupported_len++;
/* Nikon J5 does not advertise the PTP_OC_NIKON_InitiateCaptureRecInMedia cmd ... gnh */
/* logic: If we have one 0x920x command, we will probably have 0x9207 too. */
if ( !ptp_operation_issupported(&camera->pl->params, PTP_OC_NIKON_InitiateCaptureRecInMedia) &&
ptp_operation_issupported(&camera->pl->params, PTP_OC_NIKON_StartLiveView)
) {
di->OperationsSupported[di->OperationsSupported_len+0] = PTP_OC_NIKON_InitiateCaptureRecInMedia;
di->OperationsSupported_len++;
}
/* probably more */
}
}
if (params->deviceinfo.Model && !strcmp(params->deviceinfo.Model,"COOLPIX A")) {
/* The A also hides some commands from us ... */
if (!ptp_operation_issupported(&camera->pl->params, PTP_OC_NIKON_GetVendorPropCodes)) {
C_MEM (di->OperationsSupported = realloc(di->OperationsSupported,sizeof(di->OperationsSupported[0])*(di->OperationsSupported_len + 10)));
di->OperationsSupported[di->OperationsSupported_len+0] = PTP_OC_NIKON_GetVendorPropCodes;
di->OperationsSupported[di->OperationsSupported_len+1] = PTP_OC_NIKON_CheckEvent;
di->OperationsSupported[di->OperationsSupported_len+2] = PTP_OC_NIKON_AfDrive;
di->OperationsSupported[di->OperationsSupported_len+3] = PTP_OC_NIKON_SetControlMode;
di->OperationsSupported[di->OperationsSupported_len+4] = PTP_OC_NIKON_DeviceReady;
di->OperationsSupported[di->OperationsSupported_len+5] = PTP_OC_NIKON_StartLiveView;
di->OperationsSupported[di->OperationsSupported_len+6] = PTP_OC_NIKON_EndLiveView;
di->OperationsSupported[di->OperationsSupported_len+7] = PTP_OC_NIKON_GetLiveViewImg;
di->OperationsSupported[di->OperationsSupported_len+8] = PTP_OC_NIKON_ChangeAfArea;
di->OperationsSupported[di->OperationsSupported_len+9] = PTP_OC_NIKON_InitiateCaptureRecInMedia;
di->OperationsSupported_len += 10;
}
}
if (params->deviceinfo.Model && (sscanf(params->deviceinfo.Model,"D%d", &nikond)))
{
if ((nikond >= 3000) && (nikond < 3199)) {
GP_LOG_D("The D3xxx series hides commands from us ... adding all D3000 ones");
if (!ptp_operation_issupported(&camera->pl->params, PTP_OC_NIKON_GetVendorPropCodes)) {
C_MEM (di->OperationsSupported = realloc(di->OperationsSupported,sizeof(di->OperationsSupported[0])*(di->OperationsSupported_len + 15)));
di->OperationsSupported[di->OperationsSupported_len+0] = PTP_OC_NIKON_GetVendorPropCodes;
di->OperationsSupported[di->OperationsSupported_len+1] = PTP_OC_NIKON_CheckEvent;
di->OperationsSupported[di->OperationsSupported_len+2] = PTP_OC_NIKON_Capture;
di->OperationsSupported[di->OperationsSupported_len+3] = PTP_OC_NIKON_AfDrive;
di->OperationsSupported[di->OperationsSupported_len+4] = PTP_OC_NIKON_SetControlMode;
di->OperationsSupported[di->OperationsSupported_len+5] = PTP_OC_NIKON_DeviceReady;
di->OperationsSupported[di->OperationsSupported_len+6] = PTP_OC_NIKON_AfCaptureSDRAM;
di->OperationsSupported[di->OperationsSupported_len+7] = PTP_OC_NIKON_DelImageSDRAM;
di->OperationsSupported[di->OperationsSupported_len+8] = PTP_OC_NIKON_GetPreviewImg;
di->OperationsSupported[di->OperationsSupported_len+9] = PTP_OC_NIKON_StartLiveView;
di->OperationsSupported[di->OperationsSupported_len+10] = PTP_OC_NIKON_EndLiveView;
di->OperationsSupported[di->OperationsSupported_len+11] = PTP_OC_NIKON_GetLiveViewImg;
di->OperationsSupported[di->OperationsSupported_len+12] = PTP_OC_NIKON_MfDrive;
di->OperationsSupported[di->OperationsSupported_len+13] = PTP_OC_NIKON_ChangeAfArea;
di->OperationsSupported[di->OperationsSupported_len+14] = PTP_OC_NIKON_AfDriveCancel;
/* only opcodes up to 9206 ... I think. */
di->OperationsSupported_len += 15;
}
}
if ((nikond >= 3200) && (nikond < 3999)) {
GP_LOG_D("The D3xxx series hides commands from us ... adding all D7100 ones");
if (!ptp_operation_issupported(&camera->pl->params, PTP_OC_NIKON_GetVendorPropCodes)) {
C_MEM (di->OperationsSupported = realloc(di->OperationsSupported,sizeof(di->OperationsSupported[0])*(di->OperationsSupported_len + 19)));
di->OperationsSupported[di->OperationsSupported_len+0] = PTP_OC_NIKON_GetVendorPropCodes;
di->OperationsSupported[di->OperationsSupported_len+1] = PTP_OC_NIKON_CheckEvent;
di->OperationsSupported[di->OperationsSupported_len+2] = PTP_OC_NIKON_Capture;
di->OperationsSupported[di->OperationsSupported_len+3] = PTP_OC_NIKON_AfDrive;
di->OperationsSupported[di->OperationsSupported_len+4] = PTP_OC_NIKON_SetControlMode;
di->OperationsSupported[di->OperationsSupported_len+5] = PTP_OC_NIKON_DeviceReady;
di->OperationsSupported[di->OperationsSupported_len+6] = PTP_OC_NIKON_AfCaptureSDRAM;
di->OperationsSupported[di->OperationsSupported_len+7] = PTP_OC_NIKON_DelImageSDRAM;
di->OperationsSupported[di->OperationsSupported_len+8] = PTP_OC_NIKON_GetPreviewImg;
di->OperationsSupported[di->OperationsSupported_len+9] = PTP_OC_NIKON_StartLiveView;
di->OperationsSupported[di->OperationsSupported_len+10] = PTP_OC_NIKON_EndLiveView;
di->OperationsSupported[di->OperationsSupported_len+11] = PTP_OC_NIKON_GetLiveViewImg;
di->OperationsSupported[di->OperationsSupported_len+12] = PTP_OC_NIKON_MfDrive;
di->OperationsSupported[di->OperationsSupported_len+13] = PTP_OC_NIKON_ChangeAfArea;
di->OperationsSupported[di->OperationsSupported_len+14] = PTP_OC_NIKON_InitiateCaptureRecInMedia;
di->OperationsSupported[di->OperationsSupported_len+15] = PTP_OC_NIKON_AfDriveCancel;
di->OperationsSupported[di->OperationsSupported_len+15] = PTP_OC_NIKON_AfDriveCancel;
di->OperationsSupported[di->OperationsSupported_len+16] = PTP_OC_NIKON_StartMovieRecInCard;
di->OperationsSupported[di->OperationsSupported_len+17] = PTP_OC_NIKON_EndMovieRec;
di->OperationsSupported[di->OperationsSupported_len+18] = PTP_OC_NIKON_TerminateCapture;
/* probably more */
di->OperationsSupported_len += 19;
}
}
}
if (ptp_operation_issupported(&camera->pl->params, PTP_OC_NIKON_GetVendorPropCodes)) {
uint16_t *xprops;
unsigned int xsize;
if (PTP_RC_OK == LOG_ON_PTP_E (ptp_nikon_get_vendorpropcodes (&camera->pl->params, &xprops, &xsize))) {
di->DevicePropertiesSupported = realloc(di->DevicePropertiesSupported,sizeof(di->DevicePropertiesSupported[0])*(di->DevicePropertiesSupported_len + xsize));
if (!di->DevicePropertiesSupported) {
free (xprops);
C_MEM (di->DevicePropertiesSupported);
}
for (i=0;i<xsize;i++)
di->DevicePropertiesSupported[i+di->DevicePropertiesSupported_len] = xprops[i];
di->DevicePropertiesSupported_len += xsize;
free (xprops);
}
}
/* For nikon 1 j5, they have blanked this space */
if (camera->pl->params.device_flags & PTP_NIKON_1) {
for (i=0;i<di->DevicePropertiesSupported_len;i++)
if ((di->DevicePropertiesSupported[i] & 0xf000) == 0xf000)
break;
/* The J5 so far goes up to 0xf01c */
#define NIKON_1_ADDITIONAL_DEVPROPS 29
if (i==di->DevicePropertiesSupported_len) {
di->DevicePropertiesSupported = realloc(di->DevicePropertiesSupported,sizeof(di->DevicePropertiesSupported[0])*(di->DevicePropertiesSupported_len + NIKON_1_ADDITIONAL_DEVPROPS));
if (!di->DevicePropertiesSupported) {
C_MEM (di->DevicePropertiesSupported);
}
for (i=0;i<NIKON_1_ADDITIONAL_DEVPROPS;i++)
di->DevicePropertiesSupported[i+di->DevicePropertiesSupported_len] = 0xf000 | i;
di->DevicePropertiesSupported_len += NIKON_1_ADDITIONAL_DEVPROPS;
}
}
#if 0
if (!ptp_operation_issupported(&camera->pl->params, 0x9207)) {
C_MEM (di->OperationsSupported = realloc(di->OperationsSupported,sizeof(di->OperationsSupported[0])*(di->OperationsSupported_len + 2)));
di->OperationsSupported[di->OperationsSupported_len+0] = PTP_OC_NIKON_Capture;
di->OperationsSupported[di->OperationsSupported_len+1] = PTP_OC_NIKON_AfCaptureSDRAM;
di->OperationsSupported_len+=2;
}
#endif
}
/* Mostly for PTP/IP mode */
if (di->VendorExtensionID == PTP_VENDOR_MTP && di->Manufacturer && !strcmp(di->Manufacturer,"Sony Corporation")) {
di->VendorExtensionID = PTP_VENDOR_SONY;
}
/* Sony DSLR also hide its newer opcodes behind another vendor specific query,
* do that and merge it into the generic PTP deviceinfo. */
if (di->VendorExtensionID == PTP_VENDOR_SONY) {
unsigned int i;
if (ptp_operation_issupported(&camera->pl->params, PTP_OC_SONY_GetSDIOGetExtDeviceInfo)) {
int opcodes = 0, propcodes = 0, events = 0, j,k,l;
uint16_t *xprops;
unsigned int xsize;
C_PTP (ptp_sony_sdioconnect (&camera->pl->params, 1, 0, 0));
C_PTP (ptp_sony_sdioconnect (&camera->pl->params, 2, 0, 0));
C_PTP (ptp_sony_get_vendorpropcodes (&camera->pl->params, &xprops, &xsize));
for (i=0;i<xsize;i++) {
switch (xprops[i] & 0x7000) {
case 0x1000: opcodes++; break;
case 0x4000: events++; break;
case 0x5000: propcodes++; break;
default:
GP_LOG_E ("ptp_sony_get_vendorpropcodes() unknown opcode %x", xprops[i]);
break;
}
}
C_MEM (di->DevicePropertiesSupported = realloc(di->DevicePropertiesSupported,sizeof(di->DevicePropertiesSupported[0])*(di->DevicePropertiesSupported_len + propcodes)));
C_MEM (di->OperationsSupported = realloc(di->OperationsSupported, sizeof(di->OperationsSupported[0])*(di->OperationsSupported_len + opcodes)));
C_MEM (di->EventsSupported = realloc(di->EventsSupported, sizeof(di->EventsSupported[0])*(di->EventsSupported_len + events)));
j = 0; k = 0; l = 0;
for (i=0;i<xsize;i++) {
GP_LOG_D ("sony code: %x", xprops[i]);
switch (xprops[i] & 0x7000) {
case 0x1000:
di->OperationsSupported[(k++)+di->OperationsSupported_len] = xprops[i];
break;
case 0x4000:
di->EventsSupported[(l++)+di->EventsSupported_len] = xprops[i];
break;
case 0x5000:
di->DevicePropertiesSupported[(j++)+di->DevicePropertiesSupported_len] = xprops[i];
break;
default:
break;
}
}
di->DevicePropertiesSupported_len += propcodes;
di->EventsSupported_len += events;
di->OperationsSupported_len += opcodes;
free (xprops);
C_PTP (ptp_sony_sdioconnect (&camera->pl->params, 3, 0, 0));
}
}
#if 0 /* Marcus: not regular ptp properties, not queryable via getdevicepropertyvalue */
if (di->VendorExtensionID == PTP_VENDOR_CANON) {
if (ptp_operation_issupported(&camera->pl->params, PTP_OC_CANON_EOS_GetDeviceInfoEx)) {
PTPCanonEOSDeviceInfo eosdi;
int i;
C_PTP (ptp_canon_eos_getdeviceinfo (&camera->pl->params, &eosdi));
C_MEM (di->DevicePropertiesSupported = realloc(di->DevicePropertiesSupported,sizeof(di->DevicePropertiesSupported[0])*(di->DevicePropertiesSupported_len + eosdi.DevicePropertiesSupported_len)));
for (i=0;i<eosdi.DevicePropertiesSupported_len;i++)
di->DevicePropertiesSupported[i+di->DevicePropertiesSupported_len] = eosdi.DevicePropertiesSupported[i];
di->DevicePropertiesSupported_len += eosdi.DevicePropertiesSupported_len;
}
}
#endif
return GP_OK;
}
static uint16_t
nikon_wait_busy(PTPParams *params, int waitms, int timeout) {
uint16_t res;
int tries;
/* wait either 1 second, or 50 tries */
if (waitms)
tries=timeout/waitms;
else
tries=50;
do {
res = ptp_nikon_device_ready(params);
if (res != PTP_RC_DeviceBusy) {
if (res == 0xa201) /* seems to mean something like "not relevant" ... will repeat forever */
return PTP_RC_OK;
return res;
}
if (waitms) usleep(waitms*1000)/*wait a bit*/;
} while (tries--);
return res;
}
static struct {
const char *model;
unsigned short usb_vendor;
unsigned short usb_product;
unsigned long device_flags;
} models[] = {
#ifndef FUZZING_BUILD_MODE_UNSAFE_FOR_PRODUCTION
/*
* The very first PTP camera (with special firmware only), also
* called "PTP Prototype", may report non PTP interface class
*/
{"Kodak:DC240 (PTP mode)", 0x040a, 0x0121, 0},
/*
* Old DC-4800 firmware reported custom interface class, so we have
* to detect it by product/vendor IDs
*/
{"Kodak:DC4800", 0x040a, 0x0160, 0},
/* Below other camers known to be detected by interface class */
{"Kodak:DX3900", 0x040a, 0x0170, 0},
{"Kodak:MC3", 0x040a, 0x0400, 0},
/* reported by Ken Moffat */
{"Kodak:Z7590", 0x040a, 0x0403, 0},
{"Kodak:DX3500", 0x040a, 0x0500, 0},
{"Kodak:DX3600", 0x040a, 0x0510, 0},
{"Kodak:DX3215", 0x040a, 0x0525, 0},
{"Kodak:DX3700", 0x040a, 0x0530, 0},
{"Kodak:CX4230", 0x040a, 0x0535, 0},
{"Kodak:LS420", 0x040a, 0x0540, 0},
{"Kodak:DX4900", 0x040a, 0x0550, 0},
{"Kodak:DX4330", 0x040a, 0x0555, 0},
{"Kodak:CX4200", 0x040a, 0x0560, 0},
{"Kodak:CX4210", 0x040a, 0x0560, 0},
{"Kodak:LS743", 0x040a, 0x0565, 0},
/* both above with different product IDs
normal/retail versions of the same model */
{"Kodak:CX4300", 0x040a, 0x0566, 0},
{"Kodak:CX4310", 0x040a, 0x0566, 0},
{"Kodak:LS753", 0x040a, 0x0567, 0},
{"Kodak:LS443", 0x040a, 0x0568, 0},
{"Kodak:LS663", 0x040a, 0x0569, 0},
{"Kodak:DX6340", 0x040a, 0x0570, 0},
{"Kodak:CX6330", 0x040a, 0x0571, 0},
{"Kodak:DX6440", 0x040a, 0x0572, 0},
{"Kodak:CX6230", 0x040a, 0x0573, 0},
{"Kodak:CX6200", 0x040a, 0x0574, 0},
{"Kodak:DX6490", 0x040a, 0x0575, 0},
{"Kodak:DX4530", 0x040a, 0x0576, 0},
{"Kodak:DX7630", 0x040a, 0x0577, 0},
{"Kodak:CX7300", 0x040a, 0x0578, 0},
{"Kodak:CX7310", 0x040a, 0x0578, 0},
{"Kodak:CX7220", 0x040a, 0x0579, 0},
{"Kodak:CX7330", 0x040a, 0x057a, 0},
{"Kodak:CX7430", 0x040a, 0x057b, 0},
{"Kodak:CX7530", 0x040a, 0x057c, 0},
{"Kodak:DX7440", 0x040a, 0x057d, 0},
/* c300 Pau Rodriguez-Estivill <[email protected]> */
{"Kodak:C300", 0x040a, 0x057e, 0},
{"Kodak:DX7590", 0x040a, 0x057f, 0},
{"Kodak:Z730", 0x040a, 0x0580, 0},
{"Kodak:CX6445", 0x040a, 0x0584, 0},
/* Francesco Del Prete <[email protected]> */
{"Kodak:M893 IS",0x040a, 0x0585, 0},
{"Kodak:CX7525", 0x040a, 0x0586, 0},
/* a sf bugreporter */
{"Kodak:Z700", 0x040a, 0x0587, 0},
/* EasyShare Z740, Benjamin Mesing <[email protected]> */
{"Kodak:Z740", 0x040a, 0x0588, 0},
/* EasyShare C360, Guilherme de S. Pastore via Debian */
{"Kodak:C360", 0x040a, 0x0589, 0},
/* Giulio Salani <[email protected]> */
{"Kodak:C310", 0x040a, 0x058a, 0},
/* Brandon Sharitt */
{"Kodak:C330", 0x040a, 0x058c, 0},
/* c340 Maurizio Daniele <[email protected]> */
{"Kodak:C340", 0x040a, 0x058d, 0},
{"Kodak:V530", 0x040a, 0x058e, 0},
/* v550 Jon Burgess <[email protected]> */
{"Kodak:V550", 0x040a, 0x058f, 0},
/* https://sourceforge.net/tracker/?func=detail&atid=358874&aid=1618878&group_id=8874 */
{"Kodak:V570", 0x040a, 0x0591, 0},
{"Kodak:P850", 0x040a, 0x0592, 0},
{"Kodak:P880", 0x040a, 0x0593, 0},
/* Илья Розановский <[email protected]> */
{"Kodak:Z8612 IS",0x040a, 0x0595, 0},
/* https://launchpad.net/distros/ubuntu/+source/libgphoto2/+bug/67532 */
{"Kodak:C530", 0x040a, 0x059a, 0},
/* Ivan Baldo, http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=387998 */
{"Kodak:CD33", 0x040a, 0x059c, 0},
/* https://sourceforge.net/tracker/?func=detail&atid=208874&aid=1565144&group_id=8874 */
{"Kodak:Z612", 0x040a, 0x059d, 0},
/* David D. Huff Jr. <[email protected]> */
{"Kodak:Z650", 0x040a, 0x059e, 0},
/* Sonja Krause-Harder */
{"Kodak:M753", 0x040a, 0x059f, 0},
/* irc reporter */
{"Kodak:V603", 0x040a, 0x05a0, 0},
/* http://sourceforge.net/tracker/index.php?func=detail&aid=1547142&group_id=8874&atid=358874 */
{"Kodak:C533", 0x040a, 0x05a2, 0},
/* Marc Santhoff <[email protected]> */
{"Kodak:C643", 0x040a, 0x05a7, 0},
/* Eric Kibbee <[email protected]> */
{"Kodak:C875", 0x040a, 0x05a9, 0},
/* https://launchpad.net/bugs/64146 */
{"Kodak:C433", 0x040a, 0x05aa, 0},
/* https://launchpad.net/bugs/64146 */
{"Kodak:V705", 0x040a, 0x05ab, 0},
/* https://launchpad.net/bugs/67532 */
{"Kodak:V610", 0x040a, 0x05ac, 0},
/* http://sourceforge.net/tracker/index.php?func=detail&aid=1861193&group_id=8874&atid=358874 */
{"Kodak:M883", 0x040a, 0x05ad, 0},
/* from Thomas <[email protected]> */
{"Kodak:C743", 0x040a, 0x05ae, 0},
/* via IRC */
{"Kodak:C653", 0x040a, 0x05af, 0},
/* "William L. Thomson Jr." <[email protected]> */
{"Kodak:Z710", 0x040a, 0x05b3, 0},
/* Nicolas Brodu <[email protected]> */
{"Kodak:Z712 IS",0x040a, 0x05b4, 0},
/* http://sourceforge.net/tracker/index.php?func=detail&aid=1904224&group_id=8874&atid=358874 */
{"Kodak:Z812 IS",0x040a, 0x05b5, 0},
/* */
{"Kodak:C613", 0x040a, 0x05b7, 0},
/* [email protected] https://bugs.kde.org/show_bug.cgi?id=190795 */
{"Kodak:V803", 0x040a, 0x05b8, 0},
/* via IRC */
{"Kodak:C633", 0x040a, 0x05ba, 0},
/* https://bugs.launchpad.net/bugs/203402 */
{"Kodak:ZD710", 0x040a, 0x05c0, 0},
/* https://bugs.launchpad.net/ubuntu/+source/libgphoto2/+bug/385432 */
{"Kodak:M863", 0x040a, 0x05c1, 0},
/* Peter F Bradshaw <[email protected]> */
{"Kodak:C813", 0x040a, 0x05c3, 0},
/* reported by Christian Le Corre <[email protected]> */
{"Kodak:C913", 0x040a, 0x05c6, 0},
/* IRC reporter */
{"Kodak:Z950", 0x040a, 0x05cd, 0},
/* reported by Jim Nelson <[email protected]> */
{"Kodak:M1063", 0x040a, 0x05ce, 0},
/* http://sourceforge.net/tracker/index.php?func=detail&aid=2889451&group_id=8874&atid=358874 */
{"Kodak:Z915", 0x040a, 0x05cf, 0},
/* [email protected] */
{"Kodak:M531", 0x040a, 0x0600, 0},
/* [email protected] */
{"Kodak:C183", 0x040a, 0x060b, 0},
/* Oleh Malyi <[email protected]> */
{"Kodak:Z990", 0x040a, 0x0613, 0},
/* [email protected] */
{"Kodak:C1530", 0x040a, 0x0617, 0},
/* HP PTP cameras */
#if 0
/* 0x4002 seems to be the mass storage ID, which various forums suggest. -Marcus */
{"HP:PhotoSmart ... ", 0x03f0, 0x4002, 0},
#endif
{"HP:PhotoSmart 812 (PTP mode)", 0x03f0, 0x4202, 0},
{"HP:PhotoSmart 850 (PTP mode)", 0x03f0, 0x4302, 0},
/* HP PhotoSmart 935: T. Kaproncai, 25 Jul 2003*/
{"HP:PhotoSmart 935 (PTP mode)", 0x03f0, 0x4402, 0},
/* HP:PhotoSmart 945: T. Jelbert, 2004/03/29 */
{"HP:PhotoSmart 945 (PTP mode)", 0x03f0, 0x4502, 0},
{"HP:PhotoSmart C500 (PTP mode)", 0x03f0, 0x6002, 0},
{"HP:PhotoSmart 318 (PTP mode)", 0x03f0, 0x6302, 0},
{"HP:PhotoSmart 612 (PTP mode)", 0x03f0, 0x6302, 0},
{"HP:PhotoSmart 715 (PTP mode)", 0x03f0, 0x6402, 0},
{"HP:PhotoSmart 120 (PTP mode)", 0x03f0, 0x6502, 0},
{"HP:PhotoSmart 320 (PTP mode)", 0x03f0, 0x6602, 0},
{"HP:PhotoSmart 720 (PTP mode)", 0x03f0, 0x6702, 0},
{"HP:PhotoSmart 620 (PTP mode)", 0x03f0, 0x6802, 0},
{"HP:PhotoSmart 735 (PTP mode)", 0x03f0, 0x6a02, 0},
{"HP:PhotoSmart 707 (PTP mode)", 0x03f0, 0x6b02, 0},
{"HP:PhotoSmart 733 (PTP mode)", 0x03f0, 0x6c02, 0},
{"HP:PhotoSmart 607 (PTP mode)", 0x03f0, 0x6d02, 0},
{"HP:PhotoSmart 507 (PTP mode)", 0x03f0, 0x6e02, 0},
{"HP:PhotoSmart 635 (PTP mode)", 0x03f0, 0x7102, 0},
/* report from Federico Prat Villar <[email protected]> */
{"HP:PhotoSmart 43x (PTP mode)", 0x03f0, 0x7202, 0},
{"HP:PhotoSmart M307 (PTP mode)", 0x03f0, 0x7302, 0},
{"HP:PhotoSmart 407 (PTP mode)", 0x03f0, 0x7402, 0},
{"HP:PhotoSmart M22 (PTP mode)", 0x03f0, 0x7502, 0},
{"HP:PhotoSmart 717 (PTP mode)", 0x03f0, 0x7602, 0},
{"HP:PhotoSmart 817 (PTP mode)", 0x03f0, 0x7702, 0},
{"HP:PhotoSmart 417 (PTP mode)", 0x03f0, 0x7802, 0},
{"HP:PhotoSmart 517 (PTP mode)", 0x03f0, 0x7902, 0},
/* http://sourceforge.net/tracker/index.php?func=detail&aid=1365941&group_id=8874&atid=108874 */
{"HP:PhotoSmart M415 (PTP mode)", 0x03f0, 0x7a02, 0},
/* irc contact, YGingras */
{"HP:PhotoSmart M23 (PTP mode)", 0x03f0, 0x7b02, 0},
{"HP:PhotoSmart 217 (PTP mode)", 0x03f0, 0x7c02, 0},
/* irc contact */
{"HP:PhotoSmart 317 (PTP mode)", 0x03f0, 0x7d02, 0},
{"HP:PhotoSmart 818 (PTP mode)", 0x03f0, 0x7e02, 0},
/* Robin <[email protected]> */
{"HP:PhotoSmart M425 (PTP mode)", 0x03f0, 0x8002, 0},
{"HP:PhotoSmart M525 (PTP mode)", 0x03f0, 0x8102, 0},
{"HP:PhotoSmart M527 (PTP mode)", 0x03f0, 0x8202, 0},
{"HP:PhotoSmart M725 (PTP mode)", 0x03f0, 0x8402, 0},
{"HP:PhotoSmart M727 (PTP mode)", 0x03f0, 0x8502, 0},
/* http://sourceforge.net/tracker/index.php?func=detail&aid=1584447&group_id=8874&atid=358874 */
{"HP:PhotoSmart R927 (PTP mode)", 0x03f0, 0x8702, 0},
/* R967 - Far Jump <[email protected]> */
{"HP:PhotoSmart R967 (PTP mode)", 0x03f0, 0x8802, 0},
{"HP:PhotoSmart E327 (PTP mode)", 0x03f0, 0x8b02, 0},
/* https://sourceforge.net/tracker/?func=detail&atid=358874&aid=1589879&group_id=8874 */
{"HP:PhotoSmart E427 (PTP mode)", 0x03f0, 0x8c02, 0},
/* Martin Laberge <[email protected]> */
{"HP:PhotoSmart M737 (PTP mode)", 0x03f0, 0x9602, 0},
/* https://bugs.launchpad.net/bugs/178916 */
{"HP:PhotoSmart R742 (PTP mode)", 0x03f0, 0x9702, 0},
/* http://sourceforge.net/tracker/index.php?func=detail&aid=1814147&group_id=8874&atid=358874 */
{"HP:PhotoSmart M547 (PTP mode)", 0x03f0, 0x9b02, 0},
/* Most Sony PTP cameras use the same product/vendor IDs. */
{"Sony:PTP", 0x054c, 0x004e, 0},
{"Sony:DSC-H1 (PTP mode)", 0x054c, 0x004e, 0},
{"Sony:DSC-H2 (PTP mode)", 0x054c, 0x004e, 0},
{"Sony:DSC-H5 (PTP mode)", 0x054c, 0x004e, 0},
{"Sony:DSC-N2 (PTP mode)", 0x054c, 0x004e, 0},
{"Sony:DSC-P5 (PTP mode)", 0x054c, 0x004e, 0},
{"Sony:DSC-P10 (PTP mode)", 0x054c, 0x004e, 0},
{"Sony:DSC-F707V (PTP mode)", 0x054c, 0x004e, 0},
{"Sony:DSC-F717 (PTP mode)", 0x054c, 0x004e, 0},
{"Sony:DSC-F828 (PTP mode)", 0x054c, 0x004e, 0},
{"Sony:DSC-P30 (PTP mode)", 0x054c, 0x004e, 0},
/* P32 reported on May 1st by Justin Alexander <justin (at) harshangel.com> */
{"Sony:DSC-P31 (PTP mode)", 0x054c, 0x004e, 0},
{"Sony:DSC-P32 (PTP mode)", 0x054c, 0x004e, 0},
{"Sony:DSC-P41 (PTP mode)", 0x054c, 0x004e, 0},
{"Sony:DSC-P43 (PTP mode)", 0x054c, 0x004e, 0},
{"Sony:DSC-P50 (PTP mode)", 0x054c, 0x004e, 0},
{"Sony:DSC-P51 (PTP mode)", 0x054c, 0x004e, 0},
{"Sony:DSC-P52 (PTP mode)", 0x054c, 0x004e, 0},
{"Sony:DSC-P71 (PTP mode)", 0x054c, 0x004e, 0},
{"Sony:DSC-P72 (PTP mode)", 0x054c, 0x004e, 0},
{"Sony:DSC-P73 (PTP mode)", 0x054c, 0x004e, 0},
{"Sony:DSC-P92 (PTP mode)", 0x054c, 0x004e, 0},
{"Sony:DSC-P93 (PTP mode)", 0x054c, 0x004e, 0},
{"Sony:DSC-P100 (PTP mode)", 0x054c, 0x004e, 0},
{"Sony:DSC-P120 (PTP mode)", 0x054c, 0x004e, 0},
{"Sony:DSC-P200 (PTP mode)", 0x054c, 0x004e, 0},
{"Sony:DSC-R1 (PTP mode)", 0x054c, 0x004e, 0},
{"Sony:DSC-S40 (PTP mode)", 0x054c, 0x004e, 0},
{"Sony:DSC-S60 (PTP mode)", 0x054c, 0x004e, 0},
{"Sony:DSC-S75 (PTP mode)", 0x054c, 0x004e, 0},
{"Sony:DSC-S85 (PTP mode)", 0x054c, 0x004e, 0},
{"Sony:DSC-T1 (PTP mode)", 0x054c, 0x004e, 0},
{"Sony:DSC-T3 (PTP mode)", 0x054c, 0x004e, 0},
{"Sony:DSC-T10 (PTP mode)", 0x054c, 0x004e, 0},
{"Sony:DSC-U20 (PTP mode)", 0x054c, 0x004e, 0},
{"Sony:DSC-V1 (PTP mode)", 0x054c, 0x004e, 0},
{"Sony:DSC-W1 (PTP mode)", 0x054c, 0x004e, 0},
{"Sony:DSC-W12 (PTP mode)", 0x054c, 0x004e, 0},
{"Sony:DSC-W35 (PTP mode)", 0x054c, 0x004e, 0},
{"Sony:DSC-W55 (PTP mode)", 0x054c, 0x004e, 0},
{"Sony:MVC-CD300 (PTP mode)", 0x054c, 0x004e, 0},
{"Sony:MVC-CD500 (PTP mode)", 0x054c, 0x004e, 0},
{"Sony:DSC-U10 (PTP mode)", 0x054c, 0x004e, 0},
/* "Riccardo (C10uD)" <[email protected]> */
{"Sony:DSC-S730 (PTP mode)", 0x054c, 0x0296, 0},
{"Sony:DSC-S780 (PTP mode)", 0x054c, 0x0296, 0},
/* Fernando Santoro <[email protected]> */
{"Sony:DSC-A100 (PTP mode)", 0x054c, 0x02c0, 0},
/* Sam Tseng <[email protected]> */
/* this seems not to have a seperate control mode id, see https://github.com/gphoto/libgphoto2/issues/288 */
{"Sony:DSC-A900 (PTP mode)", 0x054c, 0x02e7, PTP_CAP},
/* new id?! Reported by Ruediger Oertel. */
{"Sony:DSC-W200 (PTP mode)", 0x054c, 0x02f8, 0},
/* Martin Vala <[email protected]> */
{"Sony:SLT-A350 (PTP mode)", 0x054c, 0x0321, 0},
/* http://sourceforge.net/tracker/index.php?func=detail&aid=1946931&group_id=8874&atid=308874 */
{"Sony:DSC-W130 (PTP mode)", 0x054c, 0x0343, 0},
/* https://sourceforge.net/p/gphoto/support-requests/115/ */
{"Sony:DSC-HX5V (PTP mode)", 0x054c, 0x0491, 0},
/* tux droid <[email protected]> */
{"Sony:SLT-A55 (PTP mode)", 0x054c, 0x04a3, 0},
/* http://sourceforge.net/tracker/?func=detail&atid=358874&aid=3515558&group_id=8874 */
{"Sony:SLT-A35 (PTP mode)", 0x054c, 0x04a7, 0},
/* [email protected] */
{"Sony:DSC-RX100 (PTP mode)", 0x054c, 0x052a, 0},
/* Stuart Nettleton <[email protected]> */
{"Sony:DSC-RX1 (PTP mode)", 0x054c, 0x052b, 0},
/* Maptz <[email protected]> */
{"Sony:DSC-W510 (PTP mode)", 0x054c, 0x053c, 0},
/* Rudi */
{"Sony:DSC-HX100V (PTP mode)",0x054c, 0x0543, 0},
/* [email protected] */
{"Sony:SLT-A65V (PTP mode)", 0x054c, 0x0574, 0},
/* Irina Iakovleva <[email protected]> */
{"Sony:SLT-A77V (PTP mode)", 0x054c, 0x0577, 0},
/* Jose Velez <[email protected]> */
{"Sony:NEX-7 (PTP mode)", 0x054c, 0x057d, 0},
/* https://sourceforge.net/p/libmtp/bugs/1459/ */
{"Sony:HDR-PJ260VE (PTP mode)",0x054c, 0x0603, 0},
/* Jean-Christophe Clavier <[email protected]> */
{"Sony:DSC-HX20V (PTP mode)", 0x054c, 0x061c, 0},
/* [email protected] */
{"Sony:DSC-HX200V (PTP mode)",0x054c, 0x061f, 0},
/* https://sourceforge.net/p/gphoto/feature-requests/424/ */
{"Sony:SLT-A57", 0x054c, 0x0669, 0},
/* Abhishek Anand <[email protected]> */
{"Sony:SLT-A37", 0x054c, 0x0669, 0},
/* https://sourceforge.net/p/gphoto/feature-requests/480/ */
{"Sony:NEX-5R", 0x054c, 0x066f, 0},
/* Mike Breeuwer <[email protected]> */
{"Sony:SLT-A99v", 0x054c, 0x0675, 0},
/* Ramon Carlos Garcia Bruna <[email protected]> */
{"Sony:NEX-6", 0x054c, 0x0678, 0},
/* [email protected] */
{"Sony:DSC-HX300 (PTP mode)", 0x054c, 0x06ee, 0},
/* [email protected] */
{"Sony:NEX-3N (PTP mode)", 0x054c, 0x072f, 0},
/* Thorsten Ludewig <[email protected]> */
{"Sony:SLT-A58", 0x054c, 0x0736, 0},
/* Marcus Meissner */
{"Sony:SLT-A58 (Control)", 0x054c, 0x0737, PTP_CAP},
/* Thorsten Ludewig <[email protected]> */
{"Sony:DSC-RX100M2", 0x054c, 0x074b, 0},
/* Thorsten Ludewig <[email protected]> */
{"Sony:Alpha-A3000", 0x054c, 0x074e, 0},
/* [email protected] */
{"Sony:Alpha-A68 (MTP)", 0x054c, 0x0779, 0},
/* https://github.com/gphoto/libgphoto2/issues/70 */
{"Sony:Alpha-A6300 (MTP)", 0x054c, 0x077a, 0},
/* https://github.com/gphoto/libgphoto2/issues/190 */
{"Sony:Alpha-A6500", 0x054c, 0x0784, 0},
/* [email protected] */
{"Sony:DSC-RX100M5 (Control)",0x054c, 0x07a3, PTP_CAP},
/* https://github.com/gphoto/libgphoto2/issues/190 */
{"Sony:Alpha-A6500 (Control)",0x054c, 0x07a4, PTP_CAP|PTP_CAP_PREVIEW},
/* https://sourceforge.net/p/gphoto/support-requests/127/ */
{"Sony:Alpha-A5000 (Control)",0x054c, 0x07c6, PTP_CAP},
/* [email protected] */
{"Sony:Alpha-A68 (Control)", 0x054c, 0x079b, PTP_CAP|PTP_CAP_PREVIEW},
/* https://github.com/gphoto/libgphoto2/issues/70 */
{"Sony:Alpha-A6300 (Control)",0x054c, 0x079c, PTP_CAP|PTP_CAP_PREVIEW},
/* Elijah Parker <[email protected]> */
{"Sony:Alpha-A99 M2 (Control)", 0x054c, 0x079e, PTP_CAP|PTP_CAP_PREVIEW},