1726
* ptp_canon_focuslock:
1728
* This operation locks the focus. It is followed by the CANON_GetChanges(?)
1729
* operation in the log.
1730
* It affects the CANON_MacroMode property.
1732
* params: PTPParams*
1734
* Return values: Some PTP_RC_* code.
1738
ptp_canon_focuslock (PTPParams* params)
1743
ptp.Code=PTP_OC_CANON_FocusLock;
1745
return ptp_transaction(params, &ptp, PTP_DP_NODATA, 0, NULL, NULL);
1749
* ptp_canon_focusunlock:
1751
* This operation unlocks the focus. It is followed by the CANON_GetChanges(?)
1752
* operation in the log.
1753
* It sets the CANON_MacroMode property value to 1 (where it occurs in the log).
1755
* params: PTPParams*
1757
* Return values: Some PTP_RC_* code.
1761
ptp_canon_focusunlock (PTPParams* params)
1766
ptp.Code=PTP_OC_CANON_FocusUnlock;
1768
return ptp_transaction(params, &ptp, PTP_DP_NODATA, 0, NULL, NULL);
1772
* ptp_canon_keepdeviceon:
1774
* This operation sends a "ping" style message to the camera.
1776
* params: PTPParams*
1778
* Return values: Some PTP_RC_* code.
1782
ptp_canon_keepdeviceon (PTPParams* params)
1787
ptp.Code=PTP_OC_CANON_KeepDeviceOn;
1789
return ptp_transaction(params, &ptp, PTP_DP_NODATA, 0, NULL, NULL);
1793
* ptp_canon_initiatecaptureinmemory:
1795
* This operation starts the image capture according to the current camera
1796
* settings. When the capture has happened, the camera emits a CaptureComplete
1797
* event via the interrupt pipe and pushes the CANON_RequestObjectTransfer,
1798
* CANON_DeviceInfoChanged and CaptureComplete events onto the event stack
1799
* (see operation CANON_CheckEvent). From the CANON_RequestObjectTransfer
1800
* event's parameter one can learn the just captured image's ObjectHandle.
1801
* The image is stored in the camera's own RAM.
1802
* On the next capture the image will be overwritten!
1804
* params: PTPParams*
1806
* Return values: Some PTP_RC_* code.
1810
ptp_canon_initiatecaptureinmemory (PTPParams* params)
1815
ptp.Code=PTP_OC_CANON_InitiateCaptureInMemory;
1817
return ptp_transaction(params, &ptp, PTP_DP_NODATA, 0, NULL, NULL);
1821
* ptp_canon_eos_capture:
1823
* This starts a EOS400D style capture. You have to use the
1824
* 0x9116 command to poll for its completion.
1825
* The image is saved on the CF Card currently.
1827
* params: PTPParams*
1829
* Return values: Some PTP_RC_* code.
1833
ptp_canon_eos_capture (PTPParams* params)
1838
ptp.Code=PTP_OC_CANON_EOS_RemoteRelease;
1840
return ptp_transaction(params, &ptp, PTP_DP_NODATA, 0, NULL, NULL);
1500
ptp_check_event (PTPParams *params) {
1504
if ( (params->deviceinfo.VendorExtensionID == PTP_VENDOR_NIKON) &&
1505
ptp_operation_issupported(params, PTP_OC_NIKON_CheckEvent)
1508
PTPContainer *xevent = NULL;
1510
ret = ptp_nikon_check_event(params, &xevent, &evtcnt);
1511
if (ret != PTP_RC_OK)
1515
if (params->nrofevents)
1516
params->events = realloc(params->events, sizeof(PTPContainer)*(evtcnt+params->nrofevents));
1518
params->events = malloc(sizeof(PTPContainer)*evtcnt);
1519
memcpy (¶ms->events[params->nrofevents],xevent,evtcnt*sizeof(PTPContainer));
1520
params->nrofevents += evtcnt;
1525
if ( (params->deviceinfo.VendorExtensionID == PTP_VENDOR_CANON) &&
1526
ptp_operation_issupported(params, PTP_OC_CANON_CheckEvent)
1530
ret = ptp_canon_checkevent (params,&event,&isevent);
1535
/* FIXME: fallthrough or return? */
1537
ret = params->event_check(params,&event);
1540
if (ret == PTP_RC_OK) {
1541
ptp_debug (params, "event: nparams=0x%X, code=0x%X, trans_id=0x%X, p1=0x%X, p2=0x%X, p3=0x%X", event.Nparam,event.Code,event.Transaction_ID, event.Param1, event.Param2, event.Param3);
1542
if (params->nrofevents)
1543
params->events = realloc(params->events, sizeof(PTPContainer)*(params->nrofevents+1));
1545
params->events = malloc(sizeof(PTPContainer)*1);
1546
memcpy (¶ms->events[params->nrofevents],&event,1*sizeof(PTPContainer));
1547
params->nrofevents += 1;
1549
if (ret == PTP_ERROR_TIMEOUT) /* ok, just new events */
1555
ptp_get_one_event(PTPParams *params, PTPContainer *event) {
1556
if (!params->nrofevents)
1558
memcpy (event, params->events, sizeof(PTPContainer));
1559
memmove (params->events, params->events+1, sizeof(PTPContainer)*(params->nrofevents-1));
1560
/* do not realloc on shrink. */
1561
params->nrofevents--;
2015
1718
if (params->nrofcanon_props == i)
2016
1719
return PTP_RC_Undefined;
2017
if (datatype != PTP_DTC_STR) {
2018
data = calloc(sizeof(uint32_t),3);
2019
size = sizeof(uint32_t)*3;
2022
return PTP_RC_Undefined;
1722
case PTP_DPC_CANON_EOS_ImageFormat:
1723
case PTP_DPC_CANON_EOS_ImageFormatCF:
1724
case PTP_DPC_CANON_EOS_ImageFormatSD:
1725
case PTP_DPC_CANON_EOS_ImageFormatExtHD:
1726
/* special handling of ImageFormat properties */
1727
size = 8 + ptp_pack_EOS_ImageFormat( params, NULL, value->u16 );
1728
data = malloc( size );
1729
params->canon_props[i].dpd.CurrentValue.u16 = value->u16;
1730
ptp_pack_EOS_ImageFormat( params, data + 8, value->u16 );
1733
if (datatype != PTP_DTC_STR) {
1734
data = calloc(sizeof(uint32_t),3);
1735
size = sizeof(uint32_t)*3;
1737
size = strlen(value->str) + 1 + 8;
1738
data = calloc(sizeof(char),size);
1742
/*fprintf (stderr, "%x -> %d\n", propcode, value->u8);*/
1743
htod8a(&data[8], value->u8);
1744
params->canon_props[i].dpd.CurrentValue.u8 = value->u8;
1746
case PTP_DTC_UINT16:
1747
/*fprintf (stderr, "%x -> %d\n", propcode, value->u16);*/
1748
htod16a(&data[8], value->u16);
1749
params->canon_props[i].dpd.CurrentValue.u16 = value->u16;
1751
case PTP_DTC_UINT32:
1752
/*fprintf (stderr, "%x -> %d\n", propcode, value->u32);*/
1753
htod32a(&data[8], value->u32);
1754
params->canon_props[i].dpd.CurrentValue.u32 = value->u32;
1757
strcpy((char*)data + 8, value->str);
1758
free (params->canon_props[i].dpd.CurrentValue.str);
1759
params->canon_props[i].dpd.CurrentValue.str = strdup(value->str);
2024
1764
htod32a(&data[0], size);
2025
1765
htod32a(&data[4], propcode);
2028
/*fprintf (stderr, "%x -> %d\n", propcode, value->u8);*/
2029
htod8a(&data[8], value->u8);
2030
params->canon_props[i].dpd.CurrentValue.u8 = value->u8;
2032
case PTP_DTC_UINT16:
2033
/*fprintf (stderr, "%x -> %d\n", propcode, value->u16);*/
2034
htod16a(&data[8], value->u16);
2035
params->canon_props[i].dpd.CurrentValue.u16 = value->u16;
2037
case PTP_DTC_UINT32:
2038
/*fprintf (stderr, "%x -> %d\n", propcode, value->u32);*/
2039
htod32a(&data[8], value->u32);
2040
params->canon_props[i].dpd.CurrentValue.u32 = value->u32;
2043
1767
ret = ptp_transaction(params, &ptp, PTP_DP_SENDDATA, size, &data, NULL);
2049
ptp_canon_eos_pchddcapacity (PTPParams* params, uint32_t p1, uint32_t p2, uint32_t p3)
2054
ptp.Code = PTP_OC_CANON_EOS_PCHDDCapacity;
2059
return ptp_transaction(params, &ptp, PTP_DP_NODATA, 0, NULL, NULL);
2064
ptp_canon_eos_setremotemode (PTPParams* params, uint32_t p1)
2069
ptp.Code = PTP_OC_CANON_EOS_SetRemoteMode;
2072
return ptp_transaction(params, &ptp, PTP_DP_NODATA, 0, NULL, NULL);
2077
ptp_canon_eos_seteventmode (PTPParams* params, uint32_t p1)
2082
ptp.Code = PTP_OC_CANON_EOS_SetEventMode;
2085
return ptp_transaction(params, &ptp, PTP_DP_NODATA, 0, NULL, NULL);
2090
ptp_canon_9012 (PTPParams* params)
2097
return ptp_transaction(params, &ptp, PTP_DP_NODATA, 0, NULL, NULL);
2101
1773
* ptp_canon_getpartialobject:
3584
3359
N_("Flash Mode Manual Power")},
3585
3360
{PTP_DPC_NIKON_FlashModeCommanderPower, /* 0xD16E */
3586
3361
N_("Flash Mode Commander Power")},
3362
{PTP_DPC_NIKON_AutoFP, /* 0xD16F */
3587
3364
{PTP_DPC_NIKON_CSMMenu, /* 0xD180 */
3588
3365
N_("CSM Menu")},
3366
{PTP_DPC_NIKON_WarningDisplay, /* 0xD181 */
3367
N_("Warning Display")},
3368
{PTP_DPC_NIKON_BatteryCellKind, /* 0xD182 */
3369
N_("Battery Cell Kind")},
3370
{PTP_DPC_NIKON_ISOAutoHiLimit, /* 0xD183 */
3371
N_("ISO Auto High Limit")},
3372
{PTP_DPC_NIKON_DynamicAFArea, /* 0xD184 */
3373
N_("Dynamic AF Area")},
3374
{PTP_DPC_NIKON_ContinuousSpeedHigh, /* 0xD186 */
3375
N_("Continuous Speed High")},
3376
{PTP_DPC_NIKON_InfoDispSetting, /* 0xD187 */
3377
N_("Info Disp Setting")},
3378
{PTP_DPC_NIKON_PreviewButton, /* 0xD189 */
3379
N_("Preview Button")},
3380
{PTP_DPC_NIKON_PreviewButton2, /* 0xD18A */
3381
N_("Preview Button 2")},
3382
{PTP_DPC_NIKON_AEAFLockButton2, /* 0xD18B */
3383
N_("AEAF Lock Button 2")},
3384
{PTP_DPC_NIKON_IndicatorDisp, /* 0xD18D */
3385
N_("Indicator Display")},
3386
{PTP_DPC_NIKON_CellKindPriority, /* 0xD18E */
3387
N_("Cell Kind Priority")},
3589
3388
{PTP_DPC_NIKON_BracketingFramesAndSteps, /* 0xD190 */
3590
3389
N_("Bracketing Frames and Steps")},
3591
{PTP_DPC_NIKON_LowLight, /* 0xD1B0 */
3390
{PTP_DPC_NIKON_LiveViewMode, /* 0xD1A0 */
3391
N_("Live View Mode")},
3392
{PTP_DPC_NIKON_LiveViewDriveMode, /* 0xD1A1 */
3393
N_("Live View Drive Mode")},
3394
{PTP_DPC_NIKON_LiveViewStatus, /* 0xD1A2 */
3395
N_("Live View Status")},
3396
{PTP_DPC_NIKON_LiveViewImageZoomRatio, /* 0xD1A3 */
3397
N_("Live View Image Zoom Ratio")},
3398
{PTP_DPC_NIKON_LiveViewProhibitCondition, /* 0xD1A4 */
3399
N_("Live View Prohibit Condition")},
3400
{PTP_DPC_NIKON_ExposureDisplayStatus, /* 0xD1B0 */
3401
N_("Exposure Display Status")},
3402
{PTP_DPC_NIKON_ExposureIndicateStatus, /* 0xD1B1 */
3403
N_("Exposure Indicate Status")},
3404
{PTP_DPC_NIKON_ExposureIndicateLightup, /* 0xD1B2 */
3405
N_("Exposure Indicate Lightup")},
3593
3406
{PTP_DPC_NIKON_FlashOpen, /* 0xD1C0 */
3594
3407
N_("Flash Open")},
3595
3408
{PTP_DPC_NIKON_FlashCharged, /* 0xD1C1 */
3596
3409
N_("Flash Charged")},
3410
{PTP_DPC_NIKON_FlashMRepeatValue, /* 0xD1D0 */
3411
N_("Flash MRepeat Value")},
3412
{PTP_DPC_NIKON_FlashMRepeatCount, /* 0xD1D1 */
3413
N_("Flash MRepeat Count")},
3414
{PTP_DPC_NIKON_FlashMRepeatInterval, /* 0xD1D2 */
3415
N_("Flash MRepeat Interval")},
3416
{PTP_DPC_NIKON_FlashCommandChannel, /* 0xD1D3 */
3417
N_("Flash Command Channel")},
3418
{PTP_DPC_NIKON_FlashCommandSelfMode, /* 0xD1D4 */
3419
N_("Flash Command Self Mode")},
3420
{PTP_DPC_NIKON_FlashCommandSelfCompensation, /* 0xD1D5 */
3421
N_("Flash Command Self Compensation")},
3422
{PTP_DPC_NIKON_FlashCommandSelfValue, /* 0xD1D6 */
3423
N_("Flash Command Self Value")},
3424
{PTP_DPC_NIKON_FlashCommandAMode, /* 0xD1D7 */
3425
N_("Flash Command A Mode")},
3426
{PTP_DPC_NIKON_FlashCommandACompensation, /* 0xD1D8 */
3427
N_("Flash Command A Compensation")},
3428
{PTP_DPC_NIKON_FlashCommandAValue, /* 0xD1D9 */
3429
N_("Flash Command A Value")},
3430
{PTP_DPC_NIKON_FlashCommandBMode, /* 0xD1DA */
3431
N_("Flash Command B Mode")},
3432
{PTP_DPC_NIKON_FlashCommandBCompensation, /* 0xD1DB */
3433
N_("Flash Command B Compensation")},
3434
{PTP_DPC_NIKON_FlashCommandBValue, /* 0xD1DC */
3435
N_("Flash Command B Value")},
3436
{PTP_DPC_NIKON_ActivePicCtrlItem, /* 0xD200 */
3437
N_("Active Pic Ctrl Item")},
3438
{PTP_DPC_NIKON_ChangePicCtrlItem, /* 0xD201 */
3439
N_("Change Pic Ctrl Item")},
3601
3444
const char *txt;
3602
3445
} ptp_device_properties_MTP[] = {
3603
{PTP_DPC_MTP_SecureTime, N_("Secure Time")},
3604
{PTP_DPC_MTP_DeviceCertificate, N_("Device Certificate")},
3605
{PTP_DPC_MTP_SynchronizationPartner,
3446
{PTP_DPC_MTP_SecureTime, N_("Secure Time")}, /* D101 */
3447
{PTP_DPC_MTP_DeviceCertificate, N_("Device Certificate")}, /* D102 */
3448
{PTP_DPC_MTP_RevocationInfo, N_("Revocation Info")}, /* D103 */
3449
{PTP_DPC_MTP_SynchronizationPartner, /* D401 */
3606
3450
N_("Synchronization Partner")},
3607
{PTP_DPC_MTP_DeviceFriendlyName,
3451
{PTP_DPC_MTP_DeviceFriendlyName, /* D402 */
3608
3452
N_("Friendly Device Name")},
3609
{PTP_DPC_MTP_VolumeLevel, N_("Volume Level")},
3610
{PTP_DPC_MTP_DeviceIcon, N_("Device Icon")},
3611
{PTP_DPC_MTP_PlaybackRate, N_("Playback Rate")},
3612
{PTP_DPC_MTP_PlaybackObject, N_("Playback Object")},
3613
{PTP_DPC_MTP_PlaybackContainerIndex,
3453
{PTP_DPC_MTP_VolumeLevel, N_("Volume Level")}, /* D403 */
3454
{PTP_DPC_MTP_DeviceIcon, N_("Device Icon")}, /* D405 */
3455
{PTP_DPC_MTP_SessionInitiatorInfo, N_("Session Initiator Info")},/* D406 */
3456
{PTP_DPC_MTP_PerceivedDeviceType, N_("Perceived Device Type")},/* D407 */
3457
{PTP_DPC_MTP_PlaybackRate, N_("Playback Rate")}, /* D410 */
3458
{PTP_DPC_MTP_PlaybackObject, N_("Playback Object")}, /* D411 */
3459
{PTP_DPC_MTP_PlaybackContainerIndex, /* D412 */
3614
3460
N_("Playback Container Index")},
3615
{PTP_DPC_MTP_PlaybackPosition, N_("Playback Position")},
3616
{PTP_DPC_MTP_RevocationInfo, N_("Revocation Info")},
3617
{PTP_DPC_MTP_PlaysForSureID, N_("PlaysForSure ID")},
3461
{PTP_DPC_MTP_PlaybackPosition, N_("Playback Position")}, /* D413 */
3462
{PTP_DPC_MTP_PlaysForSureID, N_("PlaysForSure ID")}, /* D131 (?) */
3704
3550
const char *format;
3705
3551
} ptp_value_trans[] = {
3706
{PTP_DPC_ExposureIndex, 0, 1.0, 0.0, "ISO %.0f"},
3707
{PTP_DPC_BatteryLevel, 0, 1.0, 0.0, "%.0f%%"},
3708
{PTP_DPC_FNumber, 0, 0.01, 0.0, "f/%.2g"},
3709
{PTP_DPC_FocalLength, 0, 0.01, 0.0, "%.0f mm"},
3710
{PTP_DPC_ExposureTime, 0, 0.00001, 0.0, "%.2g sec"},
3711
{PTP_DPC_ExposureBiasCompensation, 0, 0.001, 0.0, N_("%.1f stops")},
3552
{PTP_DPC_BatteryLevel, 0, 1.0, 0.0, "%.0f%%"}, /* 5001 */
3553
{PTP_DPC_FNumber, 0, 0.01, 0.0, "f/%.2g"}, /* 5007 */
3554
{PTP_DPC_FocalLength, 0, 0.01, 0.0, "%.0f mm"}, /* 5008 */
3555
{PTP_DPC_FocusDistance, 0, 0.01, 0.0, "%.0f mm"}, /* 5009 */
3556
{PTP_DPC_ExposureTime, 0, 0.00001, 0.0, "%.2g sec"}, /* 500D */
3557
{PTP_DPC_ExposureIndex, 0, 1.0, 0.0, "ISO %.0f"}, /* 500F */
3558
{PTP_DPC_ExposureBiasCompensation, 0, 0.001, 0.0, N_("%.1f stops")},/* 5010 */
3559
{PTP_DPC_DigitalZoom, 0, 0.1, 0.0, "%.1f"}, /* 5016 */
3713
{PTP_DPC_NIKON_LightMeter, PTP_VENDOR_NIKON, 0.08333, 0.0, N_("%.1f stops")},
3714
{PTP_DPC_NIKON_FlashExposureCompensation, PTP_VENDOR_NIKON, 0.16666, 0.0, N_("%.1f stops")},
3715
{PTP_DPC_NIKON_CenterWeightArea, PTP_VENDOR_NIKON, 2.0, 6.0, N_("%.0f mm")},
3716
{PTP_DPC_NIKON_FocalLengthMin, PTP_VENDOR_NIKON, 0.01, 0.0, "%.0f mm"},
3717
{PTP_DPC_NIKON_FocalLengthMax, PTP_VENDOR_NIKON, 0.01, 0.0, "%.0f mm"},
3718
{PTP_DPC_NIKON_MaxApAtMinFocalLength, PTP_VENDOR_NIKON, 0.01, 0.0, "f/%.2g"},
3719
{PTP_DPC_NIKON_MaxApAtMaxFocalLength, PTP_VENDOR_NIKON, 0.01, 0.0, "f/%.2g"},
3720
{PTP_DPC_NIKON_ExternalFlashCompensation, PTP_VENDOR_NIKON, 1.0/6.0, 0.0,"%.0f"},
3561
/* Nikon device properties */
3562
{PTP_DPC_NIKON_LightMeter, PTP_VENDOR_NIKON, 0.08333, 0.0, N_("%.1f stops")},/* D10A */
3563
{PTP_DPC_NIKON_FlashExposureCompensation, PTP_VENDOR_NIKON, 0.16666, 0.0, N_("%.1f stops")}, /* D126 */
3564
{PTP_DPC_NIKON_CenterWeightArea, PTP_VENDOR_NIKON, 2.0, 6.0, N_("%.0f mm")},/* D059 */
3565
{PTP_DPC_NIKON_FocalLengthMin, PTP_VENDOR_NIKON, 0.01, 0.0, "%.0f mm"}, /* D0E3 */
3566
{PTP_DPC_NIKON_FocalLengthMax, PTP_VENDOR_NIKON, 0.01, 0.0, "%.0f mm"}, /* D0E4 */
3567
{PTP_DPC_NIKON_MaxApAtMinFocalLength, PTP_VENDOR_NIKON, 0.01, 0.0, "f/%.2g"}, /* D0E5 */
3568
{PTP_DPC_NIKON_MaxApAtMaxFocalLength, PTP_VENDOR_NIKON, 0.01, 0.0, "f/%.2g"}, /* D0E6 */
3569
{PTP_DPC_NIKON_ExternalFlashCompensation, PTP_VENDOR_NIKON, 1.0/6.0, 0.0,"%.0f"}, /* D124 */
3570
{PTP_DPC_NIKON_ExposureIndicateStatus, PTP_VENDOR_NIKON, 0.08333, 0.0, N_("%.1f stops")},/* D1B1 - FIXME: check if correct. */
3721
3571
{0, 0, 0.0, 0.0, NULL}
3754
3614
{PTP_DPC_FlashMode, PTP_VENDOR_NIKON, 32785, N_("Slow Sync")},
3755
3615
{PTP_DPC_FlashMode, PTP_VENDOR_NIKON, 32786, N_("Rear Curtain Sync + Slow Sync")},
3756
3616
{PTP_DPC_FlashMode, PTP_VENDOR_NIKON, 32787, N_("Red-eye Reduction + Slow Sync")},
3757
{PTP_DPC_FocusMeteringMode, 0, 1, N_("Centre-spot")},
3758
{PTP_DPC_FocusMeteringMode, 0, 2, N_("Multi-spot")},
3759
{PTP_DPC_FocusMeteringMode, PTP_VENDOR_NIKON, 32784, N_("Single Area")},
3760
{PTP_DPC_FocusMeteringMode, PTP_VENDOR_NIKON, 32785, N_("Closest Subject")},
3761
{PTP_DPC_FocusMeteringMode, PTP_VENDOR_NIKON, 32786, N_("Group Dynamic")},
3762
{PTP_DPC_FocusMode, 0, 1, N_("Manual Focus")},
3763
{PTP_DPC_FocusMode, 0, 2, N_("Automatic")},
3764
{PTP_DPC_FocusMode, 0, 3, N_("Automatic Macro (close-up)")},
3765
{PTP_DPC_FocusMode, PTP_VENDOR_NIKON, 32784, "AF-S"},
3766
{PTP_DPC_FocusMode, PTP_VENDOR_NIKON, 32785, "AF-C"},
3767
PTP_VENDOR_VAL_BOOL(PTP_DPC_NIKON_ISOAuto,PTP_VENDOR_NIKON),
3768
PTP_VENDOR_VAL_BOOL(PTP_DPC_NIKON_ExposureCompensation,PTP_VENDOR_NIKON),
3769
PTP_VENDOR_VAL_BOOL(PTP_DPC_NIKON_AELockMode,PTP_VENDOR_NIKON),
3770
{PTP_DPC_NIKON_AELAFLMode, PTP_VENDOR_NIKON, 0, N_("AE/AF Lock")},
3771
{PTP_DPC_NIKON_AELAFLMode, PTP_VENDOR_NIKON, 1, N_("AF Lock only")},
3772
{PTP_DPC_NIKON_AELAFLMode, PTP_VENDOR_NIKON, 2, N_("AE Lock only")},
3773
{PTP_DPC_NIKON_AELAFLMode, PTP_VENDOR_NIKON, 3, N_("AF Lock Hold")},
3774
{PTP_DPC_NIKON_AELAFLMode, PTP_VENDOR_NIKON, 4, N_("AF On")},
3775
{PTP_DPC_NIKON_AELAFLMode, PTP_VENDOR_NIKON, 5, N_("Flash Lock")},
3776
{PTP_DPC_ExposureMeteringMode, 0, 1, N_("Average")},
3777
{PTP_DPC_ExposureMeteringMode, 0, 2, N_("Center Weighted Average")},
3778
{PTP_DPC_ExposureMeteringMode, 0, 3, N_("Multi-spot")},
3779
{PTP_DPC_ExposureMeteringMode, 0, 4, N_("Center-spot")},
3780
{PTP_DPC_ExposureProgramMode, 0, 1, "M"},
3617
{PTP_DPC_ExposureProgramMode, 0, 1, "M"}, /* 500E */
3781
3618
{PTP_DPC_ExposureProgramMode, 0, 3, "A"},
3782
3619
{PTP_DPC_ExposureProgramMode, 0, 4, "S"},
3783
3620
{PTP_DPC_ExposureProgramMode, 0, 2, "P"},
3796
3633
{PTP_DPC_StillCaptureMode, PTP_VENDOR_NIKON, 32787, N_("Remote")},
3797
3634
{PTP_DPC_StillCaptureMode, PTP_VENDOR_NIKON, 32787, N_("Mirror Up")},
3798
3635
{PTP_DPC_StillCaptureMode, PTP_VENDOR_NIKON, 32788, N_("Timer + Remote")},
3799
PTP_VENDOR_VAL_RBOOL(PTP_DPC_NIKON_AFAssist,PTP_VENDOR_NIKON),
3800
PTP_VENDOR_VAL_RBOOL(PTP_DPC_NIKON_ImageReview,PTP_VENDOR_NIKON),
3801
PTP_VENDOR_VAL_BOOL(PTP_DPC_NIKON_GridDisplay,PTP_VENDOR_NIKON),
3802
{PTP_DPC_NIKON_AutofocusMode, PTP_VENDOR_NIKON, 0, N_("AF-S")},
3803
{PTP_DPC_NIKON_AutofocusMode, PTP_VENDOR_NIKON, 1, N_("AF-C")},
3804
{PTP_DPC_NIKON_AFAreaIllumination, PTP_VENDOR_NIKON, 0, N_("Auto")},
3805
{PTP_DPC_NIKON_AFAreaIllumination, PTP_VENDOR_NIKON, 1, N_("Off")},
3806
{PTP_DPC_NIKON_AFAreaIllumination, PTP_VENDOR_NIKON, 2, N_("On")},
3807
{PTP_DPC_NIKON_ColorModel, PTP_VENDOR_NIKON, 0, "sRGB"},
3808
{PTP_DPC_NIKON_ColorModel, PTP_VENDOR_NIKON, 1, "AdobeRGB"},
3809
{PTP_DPC_NIKON_ColorModel, PTP_VENDOR_NIKON, 2, "sRGB"},
3810
{PTP_DPC_NIKON_FlashMode, PTP_VENDOR_NIKON, 0, "iTTL"},
3811
{PTP_DPC_NIKON_FlashMode, PTP_VENDOR_NIKON, 1, N_("Manual")},
3812
{PTP_DPC_NIKON_FlashMode, PTP_VENDOR_NIKON, 2, N_("Commander")},
3813
{PTP_DPC_NIKON_FlashModeManualPower, PTP_VENDOR_NIKON, 0, N_("Full")},
3814
{PTP_DPC_NIKON_FlashModeManualPower, PTP_VENDOR_NIKON, 1, "1/2"},
3815
{PTP_DPC_NIKON_FlashModeManualPower, PTP_VENDOR_NIKON, 2, "1/4"},
3816
{PTP_DPC_NIKON_FlashModeManualPower, PTP_VENDOR_NIKON, 3, "1/8"},
3817
{PTP_DPC_NIKON_FlashModeManualPower, PTP_VENDOR_NIKON, 4, "1/16"},
3818
PTP_VENDOR_VAL_RBOOL(PTP_DPC_NIKON_FlashSign,PTP_VENDOR_NIKON),
3819
{PTP_DPC_NIKON_RemoteTimeout, PTP_VENDOR_NIKON, 0, N_("1 min")},
3820
{PTP_DPC_NIKON_RemoteTimeout, PTP_VENDOR_NIKON, 1, N_("5 mins")},
3821
{PTP_DPC_NIKON_RemoteTimeout, PTP_VENDOR_NIKON, 2, N_("10 mins")},
3822
{PTP_DPC_NIKON_RemoteTimeout, PTP_VENDOR_NIKON, 3, N_("15 mins")},
3823
PTP_VENDOR_VAL_YN(PTP_DPC_NIKON_FlashOpen,PTP_VENDOR_NIKON),
3824
PTP_VENDOR_VAL_YN(PTP_DPC_NIKON_FlashCharged,PTP_VENDOR_NIKON),
3825
PTP_VENDOR_VAL_BOOL(PTP_DPC_NIKON_LongExposureNoiseReduction,PTP_VENDOR_NIKON),
3826
PTP_VENDOR_VAL_BOOL(PTP_DPC_NIKON_FileNumberSequence,PTP_VENDOR_NIKON),
3827
PTP_VENDOR_VAL_BOOL(PTP_DPC_NIKON_ReverseCommandDial,PTP_VENDOR_NIKON),
3828
PTP_VENDOR_VAL_RBOOL(PTP_DPC_NIKON_NoCFCard,PTP_VENDOR_NIKON),
3829
PTP_VENDOR_VAL_RBOOL(PTP_DPC_NIKON_ImageRotation,PTP_VENDOR_NIKON),
3830
PTP_VENDOR_VAL_BOOL(PTP_DPC_NIKON_Bracketing,PTP_VENDOR_NIKON),
3831
PTP_VENDOR_VAL_BOOL(PTP_DPC_NIKON_ImageCommentEnable,PTP_VENDOR_NIKON),
3832
{PTP_DPC_NIKON_AutofocusArea, PTP_VENDOR_NIKON, 0, N_("Centre")},
3833
{PTP_DPC_NIKON_AutofocusArea, PTP_VENDOR_NIKON, 1, N_("Top")},
3834
{PTP_DPC_NIKON_AutofocusArea, PTP_VENDOR_NIKON, 2, N_("Bottom")},
3835
{PTP_DPC_NIKON_AutofocusArea, PTP_VENDOR_NIKON, 3, N_("Left")},
3836
{PTP_DPC_NIKON_AutofocusArea, PTP_VENDOR_NIKON, 4, N_("Right")},
3837
{PTP_DPC_NIKON_OptimizeImage, PTP_VENDOR_NIKON, 0, N_("Normal")},
3838
{PTP_DPC_NIKON_OptimizeImage, PTP_VENDOR_NIKON, 1, N_("Vivid")},
3839
{PTP_DPC_NIKON_OptimizeImage, PTP_VENDOR_NIKON, 2, N_("Sharper")},
3840
{PTP_DPC_NIKON_OptimizeImage, PTP_VENDOR_NIKON, 3, N_("Softer")},
3841
{PTP_DPC_NIKON_OptimizeImage, PTP_VENDOR_NIKON, 4, N_("Direct Print")},
3842
{PTP_DPC_NIKON_OptimizeImage, PTP_VENDOR_NIKON, 5, N_("Portrait")},
3843
{PTP_DPC_NIKON_OptimizeImage, PTP_VENDOR_NIKON, 6, N_("Landscape")},
3844
{PTP_DPC_NIKON_OptimizeImage, PTP_VENDOR_NIKON, 7, N_("Custom")},
3846
{PTP_DPC_NIKON_ImageSharpening, PTP_VENDOR_NIKON, 0, N_("Auto")},
3636
{PTP_DPC_FocusMeteringMode, 0, 1, N_("Centre-spot")}, /* 501C */
3637
{PTP_DPC_FocusMeteringMode, 0, 2, N_("Multi-spot")},
3638
{PTP_DPC_FocusMeteringMode, PTP_VENDOR_NIKON, 32784, N_("Single Area")},
3639
{PTP_DPC_FocusMeteringMode, PTP_VENDOR_NIKON, 32785, N_("Closest Subject")},
3640
{PTP_DPC_FocusMeteringMode, PTP_VENDOR_NIKON, 32786, N_("Group Dynamic")},
3643
/* Nikon specific device properties */
3644
{PTP_DPC_NIKON_ImageSharpening, PTP_VENDOR_NIKON, 0, N_("Auto")}, /* D02A */
3847
3645
{PTP_DPC_NIKON_ImageSharpening, PTP_VENDOR_NIKON, 1, N_("Normal")},
3848
3646
{PTP_DPC_NIKON_ImageSharpening, PTP_VENDOR_NIKON, 2, N_("Low")},
3849
3647
{PTP_DPC_NIKON_ImageSharpening, PTP_VENDOR_NIKON, 3, N_("Medium Low")},
3859
3657
{PTP_DPC_NIKON_ToneCompensation, PTP_VENDOR_NIKON, 5, N_("High control")},
3860
3658
{PTP_DPC_NIKON_ToneCompensation, PTP_VENDOR_NIKON, 6, N_("Custom")},
3862
{PTP_DPC_NIKON_Saturation, PTP_VENDOR_NIKON, 0, N_("Normal")},
3863
{PTP_DPC_NIKON_Saturation, PTP_VENDOR_NIKON, 1, N_("Moderate")},
3864
{PTP_DPC_NIKON_Saturation, PTP_VENDOR_NIKON, 2, N_("Enhanced")},
3866
{PTP_DPC_NIKON_LensID, PTP_VENDOR_NIKON, 0, N_("Unknown")},
3867
{PTP_DPC_NIKON_LensID, PTP_VENDOR_NIKON, 38, "Sigma 70-300mm 1:4-5.6 D APO Macro"},
3868
{PTP_DPC_NIKON_LensID, PTP_VENDOR_NIKON, 83, "AF Nikkor 80-200mm 1:2.8 D ED"},
3869
{PTP_DPC_NIKON_LensID, PTP_VENDOR_NIKON, 118, "AF Nikkor 50mm 1:1.8 D"},
3870
{PTP_DPC_NIKON_LensID, PTP_VENDOR_NIKON, 127, "AF-S Nikkor 18-70mm 1:3.5-4.5G ED DX"},
3871
{PTP_DPC_NIKON_LensID, PTP_VENDOR_NIKON, 139, "AF-S Nikkor 18-200mm 1:3.5-5.6 GED DX VR"},
3872
{PTP_DPC_NIKON_LensID, PTP_VENDOR_NIKON, 147, "AF-S Nikkor 24-70mm 1:2.8G ED DX"},
3873
{PTP_DPC_NIKON_LensID, PTP_VENDOR_NIKON, 154, "AF-S Nikkor 18-55mm 1:3.5-F5.6G DX VR"},
3875
{PTP_DPC_NIKON_MonitorOff, PTP_VENDOR_NIKON, 0, N_("10 seconds")},
3876
{PTP_DPC_NIKON_MonitorOff, PTP_VENDOR_NIKON, 1, N_("20 seconds")},
3877
{PTP_DPC_NIKON_MonitorOff, PTP_VENDOR_NIKON, 2, N_("1 minute")},
3878
{PTP_DPC_NIKON_MonitorOff, PTP_VENDOR_NIKON, 3, N_("5 minutes")},
3879
{PTP_DPC_NIKON_MonitorOff, PTP_VENDOR_NIKON, 4, N_("10 minutes")},
3880
{PTP_DPC_NIKON_MonitorOff, PTP_VENDOR_NIKON, 5, N_("5 seconds")}, /* d80 observed */
3882
PTP_VENDOR_VAL_YN(PTP_DPC_NIKON_LowLight,PTP_VENDOR_NIKON),
3883
PTP_VENDOR_VAL_YN(PTP_DPC_NIKON_AFLockStatus,PTP_VENDOR_NIKON),
3884
PTP_VENDOR_VAL_YN(PTP_DPC_NIKON_AELockStatus,PTP_VENDOR_NIKON),
3885
PTP_VENDOR_VAL_YN(PTP_DPC_NIKON_FVLockStatus,PTP_VENDOR_NIKON),
3886
PTP_VENDOR_VAL_YN(PTP_DPC_NIKON_ACPower,PTP_VENDOR_NIKON),
3887
PTP_VENDOR_VAL_YN(PTP_DPC_NIKON_CSMMenu,PTP_VENDOR_NIKON),
3888
PTP_VENDOR_VAL_RBOOL(PTP_DPC_NIKON_BeepOff,PTP_VENDOR_NIKON),
3890
{PTP_DPC_NIKON_ISOAuto, PTP_VENDOR_NIKON, 0, "1/125"},
3660
{PTP_DPC_NIKON_ColorModel, PTP_VENDOR_NIKON, 0, "sRGB"}, /* D02C */
3661
{PTP_DPC_NIKON_ColorModel, PTP_VENDOR_NIKON, 1, "AdobeRGB"},
3662
{PTP_DPC_NIKON_ColorModel, PTP_VENDOR_NIKON, 2, "sRGB"},
3664
PTP_VENDOR_VAL_BOOL(PTP_DPC_NIKON_AutoDXCrop,PTP_VENDOR_NIKON), /* D033 */
3666
PTP_VENDOR_VAL_BOOL(PTP_DPC_NIKON_FocusAreaWrap,PTP_VENDOR_NIKON), /* D04F */
3668
PTP_VENDOR_VAL_BOOL(PTP_DPC_NIKON_EnableCopyright,PTP_VENDOR_NIKON), /* D053 */
3669
PTP_VENDOR_VAL_BOOL(PTP_DPC_NIKON_ISOAuto,PTP_VENDOR_NIKON), /* D054 */
3671
/* FIXME! this is not ISO Auto (which is a bool) Perhaps ISO Auto Time?*/
3672
{PTP_DPC_NIKON_ISOAuto, PTP_VENDOR_NIKON, 0, "1/125"}, /* D054 */
3891
3673
{PTP_DPC_NIKON_ISOAuto, PTP_VENDOR_NIKON, 1, "1/60"},
3892
3674
{PTP_DPC_NIKON_ISOAuto, PTP_VENDOR_NIKON, 2, "1/30"},
3893
3675
{PTP_DPC_NIKON_ISOAuto, PTP_VENDOR_NIKON, 3, "1/15"},
3901
3683
{PTP_DPC_NIKON_ISOAuto, PTP_VENDOR_NIKON, 11, "15"},
3902
3684
{PTP_DPC_NIKON_ISOAuto, PTP_VENDOR_NIKON, 12, "30"},
3904
{PTP_DPC_NIKON_CameraOrientation, PTP_VENDOR_NIKON, 0, "0'"},
3905
{PTP_DPC_NIKON_CameraOrientation, PTP_VENDOR_NIKON, 1, "270'"},
3906
{PTP_DPC_NIKON_CameraOrientation, PTP_VENDOR_NIKON, 2, "90'"},
3907
{PTP_DPC_NIKON_CameraOrientation, PTP_VENDOR_NIKON, 3, "180'"},
3909
{PTP_DPC_NIKON_SelfTimer, PTP_VENDOR_NIKON, 0, N_("2 seconds")},
3910
{PTP_DPC_NIKON_SelfTimer, PTP_VENDOR_NIKON, 1, N_("5 seconds")},
3911
{PTP_DPC_NIKON_SelfTimer, PTP_VENDOR_NIKON, 2, N_("10 seconds")},
3912
{PTP_DPC_NIKON_SelfTimer, PTP_VENDOR_NIKON, 3, N_("20 seconds")},
3914
{PTP_DPC_NIKON_MeterOff, PTP_VENDOR_NIKON, 0, N_("4 seconds")},
3686
{PTP_DPC_NIKON_EVStep, PTP_VENDOR_NIKON, 0, "1/3"}, /* D056 */
3687
{PTP_DPC_NIKON_EVStep, PTP_VENDOR_NIKON, 1, "1/2"},
3689
PTP_VENDOR_VAL_BOOL(PTP_DPC_NIKON_ExposureCompensation,PTP_VENDOR_NIKON),/*D058 */
3690
PTP_VENDOR_VAL_BOOL(PTP_DPC_NIKON_AELockMode,PTP_VENDOR_NIKON), /* D05E */
3692
{PTP_DPC_NIKON_AELAFLMode, PTP_VENDOR_NIKON, 0, N_("AE/AF Lock")}, /* D05F */
3693
{PTP_DPC_NIKON_AELAFLMode, PTP_VENDOR_NIKON, 1, N_("AF Lock only")},
3694
{PTP_DPC_NIKON_AELAFLMode, PTP_VENDOR_NIKON, 2, N_("AE Lock only")},
3695
{PTP_DPC_NIKON_AELAFLMode, PTP_VENDOR_NIKON, 3, N_("AF Lock Hold")},
3696
{PTP_DPC_NIKON_AELAFLMode, PTP_VENDOR_NIKON, 4, N_("AF On")},
3697
{PTP_DPC_NIKON_AELAFLMode, PTP_VENDOR_NIKON, 5, N_("Flash Lock")},
3699
{PTP_DPC_NIKON_MeterOff, PTP_VENDOR_NIKON, 0, N_("4 seconds")}, /* D062 */
3915
3700
{PTP_DPC_NIKON_MeterOff, PTP_VENDOR_NIKON, 1, N_("6 seconds")},
3916
3701
{PTP_DPC_NIKON_MeterOff, PTP_VENDOR_NIKON, 2, N_("8 seconds")},
3917
3702
{PTP_DPC_NIKON_MeterOff, PTP_VENDOR_NIKON, 3, N_("16 seconds")},
3918
3703
{PTP_DPC_NIKON_MeterOff, PTP_VENDOR_NIKON, 4, N_("30 minutes")},
3919
3704
{PTP_DPC_NIKON_MeterOff, PTP_VENDOR_NIKON, 5, N_("30 seconds")},
3921
{PTP_DPC_NIKON_BracketSet, PTP_VENDOR_NIKON, 0, N_("AE & Flash")},
3706
{PTP_DPC_NIKON_SelfTimer, PTP_VENDOR_NIKON, 0, N_("2 seconds")}, /* D063 */
3707
{PTP_DPC_NIKON_SelfTimer, PTP_VENDOR_NIKON, 1, N_("5 seconds")},
3708
{PTP_DPC_NIKON_SelfTimer, PTP_VENDOR_NIKON, 2, N_("10 seconds")},
3709
{PTP_DPC_NIKON_SelfTimer, PTP_VENDOR_NIKON, 3, N_("20 seconds")},
3711
{PTP_DPC_NIKON_MonitorOff, PTP_VENDOR_NIKON, 0, N_("10 seconds")}, /* D064 */
3712
{PTP_DPC_NIKON_MonitorOff, PTP_VENDOR_NIKON, 1, N_("20 seconds")},
3713
{PTP_DPC_NIKON_MonitorOff, PTP_VENDOR_NIKON, 2, N_("1 minute")},
3714
{PTP_DPC_NIKON_MonitorOff, PTP_VENDOR_NIKON, 3, N_("5 minutes")},
3715
{PTP_DPC_NIKON_MonitorOff, PTP_VENDOR_NIKON, 4, N_("10 minutes")},
3716
{PTP_DPC_NIKON_MonitorOff, PTP_VENDOR_NIKON, 5, N_("5 seconds")}, /* d80 observed */
3718
PTP_VENDOR_VAL_BOOL(PTP_DPC_NIKON_D3ExpDelayMode,PTP_VENDOR_NIKON), /* D06A */
3719
PTP_VENDOR_VAL_BOOL(PTP_DPC_NIKON_LongExposureNoiseReduction,PTP_VENDOR_NIKON), /* D06B */
3720
PTP_VENDOR_VAL_BOOL(PTP_DPC_NIKON_FileNumberSequence,PTP_VENDOR_NIKON), /* D06C */
3721
PTP_VENDOR_VAL_BOOL(PTP_DPC_NIKON_D7Illumination,PTP_VENDOR_NIKON), /* D06F */
3723
PTP_VENDOR_VAL_BOOL(PTP_DPC_NIKON_SHSET_CH_GUID_DISP,PTP_VENDOR_NIKON), /* D071 */
3725
{PTP_DPC_NIKON_FlashShutterSpeed, PTP_VENDOR_NIKON, 0, "1/60s"}, /* D075 */
3726
{PTP_DPC_NIKON_FlashShutterSpeed, PTP_VENDOR_NIKON, 1, "1/30s"},
3727
{PTP_DPC_NIKON_FlashShutterSpeed, PTP_VENDOR_NIKON, 2, "1/15s"},
3728
{PTP_DPC_NIKON_FlashShutterSpeed, PTP_VENDOR_NIKON, 3, "1/8s"},
3729
{PTP_DPC_NIKON_FlashShutterSpeed, PTP_VENDOR_NIKON, 4, "1/4s"},
3730
{PTP_DPC_NIKON_FlashShutterSpeed, PTP_VENDOR_NIKON, 5, "1/2s"},
3731
{PTP_DPC_NIKON_FlashShutterSpeed, PTP_VENDOR_NIKON, 6, "1s"},
3732
{PTP_DPC_NIKON_FlashShutterSpeed, PTP_VENDOR_NIKON, 7, "2s"},
3733
{PTP_DPC_NIKON_FlashShutterSpeed, PTP_VENDOR_NIKON, 8, "4s"},
3734
{PTP_DPC_NIKON_FlashShutterSpeed, PTP_VENDOR_NIKON, 9, "8s"},
3735
{PTP_DPC_NIKON_FlashShutterSpeed, PTP_VENDOR_NIKON, 10, "15s"},
3736
{PTP_DPC_NIKON_FlashShutterSpeed, PTP_VENDOR_NIKON, 11, "30s"},
3738
PTP_VENDOR_VAL_BOOL(PTP_DPC_NIKON_E4ModelingFlash,PTP_VENDOR_NIKON), /* D077 */
3740
{PTP_DPC_NIKON_BracketSet, PTP_VENDOR_NIKON, 0, N_("AE & Flash")}, /* D078 */
3922
3741
{PTP_DPC_NIKON_BracketSet, PTP_VENDOR_NIKON, 1, N_("AE only")},
3923
3742
{PTP_DPC_NIKON_BracketSet, PTP_VENDOR_NIKON, 2, N_("Flash only")},
3924
3743
{PTP_DPC_NIKON_BracketSet, PTP_VENDOR_NIKON, 3, N_("WB bracketing")},
3926
{PTP_DPC_NIKON_BracketOrder, PTP_VENDOR_NIKON, 0, N_("MTR > Under")},
3745
{PTP_DPC_NIKON_BracketOrder, PTP_VENDOR_NIKON, 0, N_("MTR > Under")}, /* D07A */
3927
3746
{PTP_DPC_NIKON_BracketOrder, PTP_VENDOR_NIKON, 1, N_("Under > MTR")},
3929
{PTP_DPC_NIKON_FlashCommanderMode, PTP_VENDOR_NIKON, 0, N_("TTL")},
3930
{PTP_DPC_NIKON_FlashCommanderMode, PTP_VENDOR_NIKON, 1, N_("Auto Aperture")},
3931
{PTP_DPC_NIKON_FlashCommanderMode, PTP_VENDOR_NIKON, 2, N_("Full Manual")},
3933
{PTP_DPC_NIKON_FlashModeCommanderPower, PTP_VENDOR_NIKON, 0, N_("Full")},
3934
{PTP_DPC_NIKON_FlashModeCommanderPower, PTP_VENDOR_NIKON, 1, "1/2"},
3935
{PTP_DPC_NIKON_FlashModeCommanderPower, PTP_VENDOR_NIKON, 2, "1/4"},
3936
{PTP_DPC_NIKON_FlashModeCommanderPower, PTP_VENDOR_NIKON, 3, "1/8"},
3937
{PTP_DPC_NIKON_FlashModeCommanderPower, PTP_VENDOR_NIKON, 4, "1/16"},
3938
{PTP_DPC_NIKON_FlashModeCommanderPower, PTP_VENDOR_NIKON, 5, "1/32"},
3939
{PTP_DPC_NIKON_FlashModeCommanderPower, PTP_VENDOR_NIKON, 6, "1/64"},
3940
{PTP_DPC_NIKON_FlashModeCommanderPower, PTP_VENDOR_NIKON, 7, "1/128"},
3942
{PTP_DPC_NIKON_PADVPMode, PTP_VENDOR_NIKON, 0, "1/125"},
3748
{PTP_DPC_NIKON_F1CenterButtonShootingMode, PTP_VENDOR_NIKON, 0, N_("Reset focus point to center")}, /* D080 */
3749
{PTP_DPC_NIKON_F1CenterButtonShootingMode, PTP_VENDOR_NIKON, 1, N_("Highlight active focus point")},
3750
{PTP_DPC_NIKON_F1CenterButtonShootingMode, PTP_VENDOR_NIKON, 2, N_("Unused")},
3752
PTP_VENDOR_VAL_BOOL(PTP_DPC_NIKON_F3PhotoInfoPlayback,PTP_VENDOR_NIKON),/* D083 */
3753
PTP_VENDOR_VAL_BOOL(PTP_DPC_NIKON_F5CustomizeCommDials,PTP_VENDOR_NIKON),/* D085 */
3754
PTP_VENDOR_VAL_BOOL(PTP_DPC_NIKON_ReverseCommandDial,PTP_VENDOR_NIKON), /* D086 */
3755
PTP_VENDOR_VAL_RBOOL(PTP_DPC_NIKON_F6ButtonsAndDials,PTP_VENDOR_NIKON), /* D089 */
3756
PTP_VENDOR_VAL_RBOOL(PTP_DPC_NIKON_NoCFCard,PTP_VENDOR_NIKON), /* D08A */
3757
PTP_VENDOR_VAL_RBOOL(PTP_DPC_NIKON_AFAreaPoint,PTP_VENDOR_NIKON), /* D08D */
3759
PTP_VENDOR_VAL_BOOL(PTP_DPC_NIKON_ImageCommentEnable,PTP_VENDOR_NIKON), /* D091 */
3760
PTP_VENDOR_VAL_RBOOL(PTP_DPC_NIKON_ImageRotation,PTP_VENDOR_NIKON), /* D092 */
3762
PTP_VENDOR_VAL_BOOL(PTP_DPC_NIKON_MovVoice,PTP_VENDOR_NIKON), /* D0A1 */
3764
PTP_VENDOR_VAL_BOOL(PTP_DPC_NIKON_Bracketing,PTP_VENDOR_NIKON), /* D0C0 */
3766
{PTP_DPC_NIKON_LensID, PTP_VENDOR_NIKON, 0, N_("Unknown")}, /* D0E0 */
3767
{PTP_DPC_NIKON_LensID, PTP_VENDOR_NIKON, 38, "Sigma 70-300mm 1:4-5.6 D APO Macro"},
3768
{PTP_DPC_NIKON_LensID, PTP_VENDOR_NIKON, 83, "AF Nikkor 80-200mm 1:2.8 D ED"},
3769
{PTP_DPC_NIKON_LensID, PTP_VENDOR_NIKON, 118, "AF Nikkor 50mm 1:1.8 D"},
3770
{PTP_DPC_NIKON_LensID, PTP_VENDOR_NIKON, 127, "AF-S Nikkor 18-70mm 1:3.5-4.5G ED DX"},
3771
{PTP_DPC_NIKON_LensID, PTP_VENDOR_NIKON, 139, "AF-S Nikkor 18-200mm 1:3.5-5.6 GED DX VR"},
3772
{PTP_DPC_NIKON_LensID, PTP_VENDOR_NIKON, 147, "AF-S Nikkor 24-70mm 1:2.8G ED DX"},
3773
{PTP_DPC_NIKON_LensID, PTP_VENDOR_NIKON, 154, "AF-S Nikkor 18-55mm 1:3.5-F5.6G DX VR"},
3774
{PTP_DPC_NIKON_FinderISODisp, PTP_VENDOR_NIKON, 0, "Show ISO sensitivity"},/* 0xD0F0 */
3775
{PTP_DPC_NIKON_FinderISODisp, PTP_VENDOR_NIKON, 1, "Show ISO/Easy ISO"},
3776
{PTP_DPC_NIKON_FinderISODisp, PTP_VENDOR_NIKON, 2, "Show frame count"},
3778
PTP_VENDOR_VAL_YN(PTP_DPC_NIKON_ACPower,PTP_VENDOR_NIKON), /* D101 */
3779
PTP_VENDOR_VAL_YN(PTP_DPC_NIKON_AFLockStatus,PTP_VENDOR_NIKON), /* D104 */
3780
PTP_VENDOR_VAL_YN(PTP_DPC_NIKON_AELockStatus,PTP_VENDOR_NIKON), /* D105 */
3781
PTP_VENDOR_VAL_YN(PTP_DPC_NIKON_FVLockStatus,PTP_VENDOR_NIKON), /* D106 */
3783
{PTP_DPC_NIKON_AutofocusArea, PTP_VENDOR_NIKON, 0, N_("Centre")}, /* D108 */
3784
{PTP_DPC_NIKON_AutofocusArea, PTP_VENDOR_NIKON, 1, N_("Top")},
3785
{PTP_DPC_NIKON_AutofocusArea, PTP_VENDOR_NIKON, 2, N_("Bottom")},
3786
{PTP_DPC_NIKON_AutofocusArea, PTP_VENDOR_NIKON, 3, N_("Left")},
3787
{PTP_DPC_NIKON_AutofocusArea, PTP_VENDOR_NIKON, 4, N_("Right")},
3789
{PTP_DPC_NIKON_RecordingMedia, PTP_VENDOR_NIKON, 0, N_("Card")}, /* D10B */
3790
{PTP_DPC_NIKON_RecordingMedia, PTP_VENDOR_NIKON, 1, N_("SDRam")},
3792
{PTP_DPC_NIKON_USBSpeed, PTP_VENDOR_NIKON, 0, N_("USB 1.1")}, /* D10C */
3793
{PTP_DPC_NIKON_USBSpeed, PTP_VENDOR_NIKON, 1, N_("USB 2.0")},
3795
{PTP_DPC_NIKON_CameraOrientation, PTP_VENDOR_NIKON, 0, "0'"}, /* D10E */
3796
{PTP_DPC_NIKON_CameraOrientation, PTP_VENDOR_NIKON, 1, "270'"},
3797
{PTP_DPC_NIKON_CameraOrientation, PTP_VENDOR_NIKON, 2, "90'"},
3798
{PTP_DPC_NIKON_CameraOrientation, PTP_VENDOR_NIKON, 3, "180'"},
3800
PTP_VENDOR_VAL_YN(PTP_DPC_NIKON_FNumberLock,PTP_VENDOR_NIKON), /* D110 */
3801
PTP_VENDOR_VAL_YN(PTP_DPC_NIKON_ExposureApertureLock,PTP_VENDOR_NIKON), /* D111 */
3802
PTP_VENDOR_VAL_YN(PTP_DPC_NIKON_TVLockSetting,PTP_VENDOR_NIKON), /* D112 */
3803
PTP_VENDOR_VAL_YN(PTP_DPC_NIKON_AVLockSetting,PTP_VENDOR_NIKON), /* D113 */
3805
{PTP_DPC_NIKON_IllumSetting,PTP_VENDOR_NIKON,0,N_("LCD Backlight")}, /* D114 */
3806
{PTP_DPC_NIKON_IllumSetting,PTP_VENDOR_NIKON,1,N_("LCD Backlight and Info Display")},
3808
PTP_VENDOR_VAL_YN(PTP_DPC_NIKON_ExternalFlashAttached,PTP_VENDOR_NIKON),/* D120 */
3809
PTP_VENDOR_VAL_YN(PTP_DPC_NIKON_ExternalFlashStatus,PTP_VENDOR_NIKON), /* D121 */
3811
{PTP_DPC_NIKON_OptimizeImage, PTP_VENDOR_NIKON, 0, N_("Normal")}, /* D140 */
3812
{PTP_DPC_NIKON_OptimizeImage, PTP_VENDOR_NIKON, 1, N_("Vivid")},
3813
{PTP_DPC_NIKON_OptimizeImage, PTP_VENDOR_NIKON, 2, N_("Sharper")},
3814
{PTP_DPC_NIKON_OptimizeImage, PTP_VENDOR_NIKON, 3, N_("Softer")},
3815
{PTP_DPC_NIKON_OptimizeImage, PTP_VENDOR_NIKON, 4, N_("Direct Print")},
3816
{PTP_DPC_NIKON_OptimizeImage, PTP_VENDOR_NIKON, 5, N_("Portrait")},
3817
{PTP_DPC_NIKON_OptimizeImage, PTP_VENDOR_NIKON, 6, N_("Landscape")},
3818
{PTP_DPC_NIKON_OptimizeImage, PTP_VENDOR_NIKON, 7, N_("Custom")},
3820
{PTP_DPC_NIKON_Saturation, PTP_VENDOR_NIKON, 0, N_("Normal")}, /* D142 */
3821
{PTP_DPC_NIKON_Saturation, PTP_VENDOR_NIKON, 1, N_("Moderate")},
3822
{PTP_DPC_NIKON_Saturation, PTP_VENDOR_NIKON, 2, N_("Enhanced")},
3824
PTP_VENDOR_VAL_RBOOL(PTP_DPC_NIKON_BeepOff,PTP_VENDOR_NIKON), /* D160 */
3826
{PTP_DPC_NIKON_AutofocusMode, PTP_VENDOR_NIKON, 0, N_("AF-S")}, /* D161 */
3827
{PTP_DPC_NIKON_AutofocusMode, PTP_VENDOR_NIKON, 1, N_("AF-C")},
3828
{PTP_DPC_NIKON_AutofocusMode, PTP_VENDOR_NIKON, 2, N_("AF-A")},
3829
{PTP_DPC_NIKON_AutofocusMode, PTP_VENDOR_NIKON, 3, N_("MF (fixed)")},
3830
{PTP_DPC_NIKON_AutofocusMode, PTP_VENDOR_NIKON, 4, N_("MF (selection)")},
3832
PTP_VENDOR_VAL_RBOOL(PTP_DPC_NIKON_AFAssist,PTP_VENDOR_NIKON), /* D163 */
3834
{PTP_DPC_NIKON_PADVPMode, PTP_VENDOR_NIKON, 0, "1/125"}, /* D164 */
3943
3835
{PTP_DPC_NIKON_PADVPMode, PTP_VENDOR_NIKON, 1, "1/60"},
3944
3836
{PTP_DPC_NIKON_PADVPMode, PTP_VENDOR_NIKON, 2, "1/30"},
3945
3837
{PTP_DPC_NIKON_PADVPMode, PTP_VENDOR_NIKON, 3, "1/15"},
3953
3845
{PTP_DPC_NIKON_PADVPMode, PTP_VENDOR_NIKON, 11, "15"},
3954
3846
{PTP_DPC_NIKON_PADVPMode, PTP_VENDOR_NIKON, 12, "30"},
3956
{PTP_DPC_NIKON_EVStep, PTP_VENDOR_NIKON, 0, "1/3"},
3957
{PTP_DPC_NIKON_EVStep, PTP_VENDOR_NIKON, 1, "1/2"},
3848
PTP_VENDOR_VAL_RBOOL(PTP_DPC_NIKON_ImageReview,PTP_VENDOR_NIKON), /* D165 */
3850
{PTP_DPC_NIKON_AFAreaIllumination, PTP_VENDOR_NIKON, 0, N_("Auto")}, /* D166 */
3851
{PTP_DPC_NIKON_AFAreaIllumination, PTP_VENDOR_NIKON, 1, N_("Off")},
3852
{PTP_DPC_NIKON_AFAreaIllumination, PTP_VENDOR_NIKON, 2, N_("On")},
3854
{PTP_DPC_NIKON_FlashMode, PTP_VENDOR_NIKON, 0, "iTTL"}, /* D167 */
3855
{PTP_DPC_NIKON_FlashMode, PTP_VENDOR_NIKON, 1, N_("Manual")},
3856
{PTP_DPC_NIKON_FlashMode, PTP_VENDOR_NIKON, 2, N_("Commander")},
3858
{PTP_DPC_NIKON_FlashCommanderMode, PTP_VENDOR_NIKON, 0, N_("TTL")}, /* D168 */
3859
{PTP_DPC_NIKON_FlashCommanderMode, PTP_VENDOR_NIKON, 1, N_("Auto Aperture")},
3860
{PTP_DPC_NIKON_FlashCommanderMode, PTP_VENDOR_NIKON, 2, N_("Full Manual")},
3862
PTP_VENDOR_VAL_RBOOL(PTP_DPC_NIKON_FlashSign,PTP_VENDOR_NIKON), /* D169 */
3864
{PTP_DPC_NIKON_RemoteTimeout, PTP_VENDOR_NIKON, 0, N_("1 min")}, /* D16B */
3865
{PTP_DPC_NIKON_RemoteTimeout, PTP_VENDOR_NIKON, 1, N_("5 mins")},
3866
{PTP_DPC_NIKON_RemoteTimeout, PTP_VENDOR_NIKON, 2, N_("10 mins")},
3867
{PTP_DPC_NIKON_RemoteTimeout, PTP_VENDOR_NIKON, 3, N_("15 mins")},
3869
PTP_VENDOR_VAL_BOOL(PTP_DPC_NIKON_GridDisplay,PTP_VENDOR_NIKON), /* D16C */
3871
{PTP_DPC_NIKON_FlashModeManualPower, PTP_VENDOR_NIKON, 0, N_("Full")}, /* D16D */
3872
{PTP_DPC_NIKON_FlashModeManualPower, PTP_VENDOR_NIKON, 1, "1/2"},
3873
{PTP_DPC_NIKON_FlashModeManualPower, PTP_VENDOR_NIKON, 2, "1/4"},
3874
{PTP_DPC_NIKON_FlashModeManualPower, PTP_VENDOR_NIKON, 3, "1/8"},
3875
{PTP_DPC_NIKON_FlashModeManualPower, PTP_VENDOR_NIKON, 4, "1/16"},
3877
{PTP_DPC_NIKON_FlashModeCommanderPower, PTP_VENDOR_NIKON, 0, N_("Full")},/* D16E */
3878
{PTP_DPC_NIKON_FlashModeCommanderPower, PTP_VENDOR_NIKON, 1, "1/2"},
3879
{PTP_DPC_NIKON_FlashModeCommanderPower, PTP_VENDOR_NIKON, 2, "1/4"},
3880
{PTP_DPC_NIKON_FlashModeCommanderPower, PTP_VENDOR_NIKON, 3, "1/8"},
3881
{PTP_DPC_NIKON_FlashModeCommanderPower, PTP_VENDOR_NIKON, 4, "1/16"},
3882
{PTP_DPC_NIKON_FlashModeCommanderPower, PTP_VENDOR_NIKON, 5, "1/32"},
3883
{PTP_DPC_NIKON_FlashModeCommanderPower, PTP_VENDOR_NIKON, 6, "1/64"},
3884
{PTP_DPC_NIKON_FlashModeCommanderPower, PTP_VENDOR_NIKON, 7, "1/128"},
3886
PTP_VENDOR_VAL_YN(PTP_DPC_NIKON_CSMMenu,PTP_VENDOR_NIKON), /* D180 */
3887
PTP_VENDOR_VAL_YN(PTP_DPC_NIKON_WarningDisplay,PTP_VENDOR_NIKON), /* D181 */
3889
{PTP_DPC_NIKON_BatteryCellKind, PTP_VENDOR_NIKON, 0, "LR6 (AA alkaline)"},/* D182 */
3890
{PTP_DPC_NIKON_BatteryCellKind, PTP_VENDOR_NIKON, 1, "HR6 (AA Ni-Mh)"},
3891
{PTP_DPC_NIKON_BatteryCellKind, PTP_VENDOR_NIKON, 2, "FR6 (AA Lithium)"},
3892
{PTP_DPC_NIKON_BatteryCellKind, PTP_VENDOR_NIKON, 3, "ZR6 (AA Ni-Mn)"},
3894
{PTP_DPC_NIKON_ISOAutoHiLimit, PTP_VENDOR_NIKON, 0, "400"}, /* D183 */
3895
{PTP_DPC_NIKON_ISOAutoHiLimit, PTP_VENDOR_NIKON, 1, "800"},
3896
{PTP_DPC_NIKON_ISOAutoHiLimit, PTP_VENDOR_NIKON, 2, "1600"},
3897
{PTP_DPC_NIKON_ISOAutoHiLimit, PTP_VENDOR_NIKON, 3, "3200"},
3898
{PTP_DPC_NIKON_ISOAutoHiLimit, PTP_VENDOR_NIKON, 4, "Hi 1"},
3900
{PTP_DPC_NIKON_InfoDispSetting, PTP_VENDOR_NIKON, 0, N_("Auto")}, /* 0xD187 */
3901
{PTP_DPC_NIKON_InfoDispSetting, PTP_VENDOR_NIKON, 1, N_("Dark on light")},
3902
{PTP_DPC_NIKON_InfoDispSetting, PTP_VENDOR_NIKON, 2, N_("Light on dark")},
3904
PTP_VENDOR_VAL_YN(PTP_DPC_NIKON_IndicatorDisp,PTP_VENDOR_NIKON), /* D18D */
3906
PTP_VENDOR_VAL_YN(PTP_DPC_NIKON_LiveViewStatus,PTP_VENDOR_NIKON), /* D1A2 */
3908
PTP_VENDOR_VAL_YN(PTP_DPC_NIKON_ExposureDisplayStatus,PTP_VENDOR_NIKON),/* D1B0 */
3909
PTP_VENDOR_VAL_YN(PTP_DPC_NIKON_InfoDispErrStatus,PTP_VENDOR_NIKON), /* D1B2 */
3910
PTP_VENDOR_VAL_YN(PTP_DPC_NIKON_ExposureIndicateLightup,PTP_VENDOR_NIKON),/* D1B3 */
3912
PTP_VENDOR_VAL_YN(PTP_DPC_NIKON_FlashOpen,PTP_VENDOR_NIKON), /* D1C0 */
3913
PTP_VENDOR_VAL_YN(PTP_DPC_NIKON_FlashCharged,PTP_VENDOR_NIKON), /* D1C1 */
3959
3915
/* Canon stuff */
3960
3916
PTP_VENDOR_VAL_BOOL(PTP_DPC_CANON_AssistLight,PTP_VENDOR_CANON),
4731
4693
ptp_remove_object_from_cache(PTPParams *params, uint32_t handle)
4699
ret = ptp_object_find (params, handle, &ob);
4700
if (ret != PTP_RC_OK)
4702
i = ob-params->objects;
4735
4703
/* remove object from object info cache */
4736
for (i = 0; i < params->handles.n; i++) {
4737
if (params->handles.Handler[i] == handle) {
4738
ptp_free_objectinfo(¶ms->objectinfo[i]);
4740
if (i < params->handles.n-1) {
4741
memmove(params->handles.Handler+i, params->handles.Handler+i+1,
4742
(params->handles.n-i-1)*sizeof(uint32_t));
4743
memmove(params->objectinfo+i, params->objectinfo+i+1,
4744
(params->handles.n-i-1)*sizeof(PTPObjectInfo));
4746
params->handles.n--;
4747
/* We use less memory than before so this shouldn't fail */
4748
params->handles.Handler = realloc(params->handles.Handler, sizeof(uint32_t)*params->handles.n);
4749
params->objectinfo = realloc(params->objectinfo, sizeof(PTPObjectInfo)*params->handles.n);
4704
ptp_free_object (ob);
4706
if (i < params->nrofobjects-1)
4707
memmove (ob,ob+1,(params->nrofobjects-1-i)*sizeof(PTPObject));
4708
params->nrofobjects--;
4709
/* We use less memory than before so this shouldn't fail */
4710
params->objects = realloc(params->objects, sizeof(PTPObject)*params->nrofobjects);
4713
static int _cmp_ob (const void *a, const void *b) {
4714
PTPObject *oa = (PTPObject*)a;
4715
PTPObject *ob = (PTPObject*)b;
4717
return oa->oid - ob->oid;
4721
ptp_objects_sort (PTPParams *params) {
4722
qsort (params->objects, params->nrofobjects, sizeof(PTPObject), _cmp_ob);
4725
/* Binary search in objects. Needs "objects" to be a sorted by objectid list! */
4727
ptp_object_find (PTPParams *params, uint32_t handle, PTPObject **retob) {
4731
*retob = bsearch (&tmpob, params->objects, params->nrofobjects, sizeof(tmpob), _cmp_ob);
4733
return PTP_RC_GeneralError;
4737
/* Binary search in objects + insert of not found. Needs "objects" to be a sorted by objectid list! */
4739
ptp_object_find_or_insert (PTPParams *params, uint32_t handle, PTPObject **retob) {
4740
int begin, end, cursor;
4744
if (!handle) return PTP_RC_GeneralError;
4746
if (!params->nrofobjects) {
4747
params->objects = calloc(1,sizeof(PTPObject));
4748
params->nrofobjects = 1;
4749
params->objects[0].oid = handle;
4750
*retob = ¶ms->objects[0];
4754
end = params->nrofobjects-1;
4755
/*ptp_debug (params, "searching %08x, total=%d", handle, params->nrofobjects);*/
4757
cursor = (end-begin)/2+begin;
4758
/*ptp_debug (params, "ob %d: %08x [%d-%d]", cursor, params->objects[cursor].oid, begin, end);*/
4759
if (params->objects[cursor].oid == handle) {
4760
*retob = ¶ms->objects[cursor];
4763
if (params->objects[cursor].oid < handle)
4767
if ((end - begin) <= 1)
4754
/* delete cached object properties if metadata cache exists */
4755
if (params->props != NULL) {
4756
int nrofoldprops = 0;
4757
int firstoldprop = 0;
4770
if (params->objects[begin].oid == handle) {
4771
*retob = ¶ms->objects[begin];
4774
if (params->objects[end].oid == handle) {
4775
*retob = ¶ms->objects[end];
4778
if ((begin == 0) && (handle < params->objects[0].oid)) {
4781
if ((end == params->nrofobjects-1) && (handle > params->objects[end].oid))
4786
/*ptp_debug (params, "inserting oid %x at [%x,%x], begin=%d, end=%d, insertat=%d\n", handle, params->objects[begin].oid, params->objects[end].oid, begin, end, insertat);*/
4787
newobs = realloc (params->objects, sizeof(PTPObject)*(params->nrofobjects+1));
4788
if (!newobs) return PTP_RC_GeneralError;
4789
params->objects = newobs;
4790
if (insertat<=params->nrofobjects)
4791
memmove (¶ms->objects[insertat+1],¶ms->objects[insertat],(params->nrofobjects-insertat)*sizeof(PTPObject));
4792
memset(¶ms->objects[insertat],0,sizeof(PTPObject));
4793
params->objects[insertat].oid = handle;
4794
*retob = ¶ms->objects[insertat];
4795
params->nrofobjects++;
4800
ptp_object_want (PTPParams *params, uint32_t handle, int want, PTPObject **retob) {
4803
//Camera *camera = ((PTPData *)params->data)->camera;
4807
ptp_debug (params, "ptp_object_want: querying handle 0?\n");
4808
return PTP_RC_GeneralError;
4810
ret = ptp_object_find_or_insert (params, handle, &ob);
4811
if (ret != PTP_RC_OK)
4812
return PTP_RC_GeneralError;
4814
/* Do we have all of it already? */
4815
if ((ob->flags & want) == want)
4818
#define X (PTPOBJECT_OBJECTINFO_LOADED|PTPOBJECT_STORAGEID_LOADED|PTPOBJECT_PARENTOBJECT_LOADED)
4819
if ((want & X) && ((ob->flags & X) != X)) {
4820
uint32_t saveparent = 0;
4759
for (i=0; i<params->nrofprops; i++) {
4760
MTPProperties *prop = ¶ms->props[i];
4761
if (prop->ObjectHandle == handle)
4764
if (nrofoldprops == 1) {
4769
for (i=firstoldprop;i<(firstoldprop+nrofoldprops);i++) {
4770
ptp_destroy_object_prop(¶ms->props[i]);
4772
memmove(¶ms->props[firstoldprop],
4773
¶ms->props[firstoldprop+nrofoldprops],
4774
(params->nrofprops-firstoldprop-nrofoldprops)*sizeof(MTPProperties));
4775
/* We use less memory than before so this shouldn't fail */
4776
params->props = realloc(params->props,
4777
(params->nrofprops - nrofoldprops)*sizeof(MTPProperties));
4778
params->nrofprops -= nrofoldprops;
4822
/* One EOS issue, where getobjecthandles(root) returns obs without root flag. */
4823
if (ob->flags & PTPOBJECT_PARENTOBJECT_LOADED)
4824
saveparent = ob->oi.ParentObject;
4826
ret = ptp_getobjectinfo (params, handle, &ob->oi);
4827
if (ret != PTP_RC_OK)
4829
if (!ob->oi.Filename) ob->oi.Filename=strdup("<none>");
4830
if (ob->flags & PTPOBJECT_PARENTOBJECT_LOADED)
4831
ob->oi.ParentObject = saveparent;
4833
/* Second EOS issue, 0x20000000 has 0x20000000 as parent */
4834
if (ob->oi.ParentObject == handle)
4835
ob->oi.ParentObject = 0;
4838
/* EOS bug, DCIM links back to itself. */
4841
if ( (want & PTPOBJECT_MTPPROPLIST_LOADED) &&
4842
(!(ob->flags & PTPOBJECT_MTPPROPLIST_LOADED))
4845
MTPProperties *props = NULL;
4847
if (params->device_flags & DEVICE_FLAG_BROKEN_MTPGETOBJPROPLIST) {
4848
want &= ~PTPOBJECT_MTPPROPLIST_LOADED;
4851
/* Microsoft/MTP has fast directory retrieval. */
4852
if (!ptp_operation_issupported(params,PTP_OC_MTP_GetObjPropList)) {
4853
want &= ~PTPOBJECT_MTPPROPLIST_LOADED;
4857
ptp_debug (params, "ptp2/mtpfast: reading mtp proplist of %08x", handle);
4858
ret = ptp_mtp_getobjectproplist (params, handle, &props, &nrofprops);
4859
if (ret != PTP_RC_OK)
4861
ob->mtpprops = props;
4862
ob->nrofmtpprops = nrofprops;
4867
PTPObjectInfo oinfo;
4869
memset (&oinfo,0,sizeof(oinfo));
4870
/* hmm, not necessary ... only if we would use it */
4871
for (j=0;j<nrofprops;j++) {
4873
switch (xpl->property) {
4874
case PTP_OPC_ParentObject:
4875
if (xpl->datatype != PTP_DTC_UINT32) {
4876
ptp_debug (params, "ptp2/mtpfast: parentobject has type 0x%x???", xpl->datatype);
4879
oinfo.ParentObject = xpl->propval.u32;
4880
ptp_debug (params, "ptp2/mtpfast: parent 0x%x", xpl->propval.u32);
4882
case PTP_OPC_ObjectFormat:
4883
if (xpl->datatype != PTP_DTC_UINT16) {
4884
ptp_debug (params, "ptp2/mtpfast: objectformat has type 0x%x???", xpl->datatype);
4887
oinfo.ObjectFormat = xpl->propval.u16;
4888
ptp_debug (params, "ptp2/mtpfast: ofc 0x%x", xpl->propval.u16);
4890
case PTP_OPC_ObjectSize:
4891
switch (xpl->datatype) {
4892
case PTP_DTC_UINT32:
4893
oinfo.ObjectCompressedSize = xpl->propval.u32;
4895
case PTP_DTC_UINT64:
4896
oinfo.ObjectCompressedSize = xpl->propval.u64;
4899
ptp_debug (params, "ptp2/mtpfast: objectsize has type 0x%x???", xpl->datatype);
4902
ptp_debug (params, "ptp2/mtpfast: objectsize %u", xpl->propval.u32);
4904
case PTP_OPC_StorageID:
4905
if (xpl->datatype != PTP_DTC_UINT32) {
4906
ptp_debug (params, "ptp2/mtpfast: storageid has type 0x%x???", xpl->datatype);
4909
oinfo.StorageID = xpl->propval.u32;
4910
ptp_debug (params, "ptp2/mtpfast: storageid 0x%x", xpl->propval.u32);
4912
case PTP_OPC_ProtectionStatus:/*UINT16*/
4913
if (xpl->datatype != PTP_DTC_UINT16) {
4914
ptp_debug (params, "ptp2/mtpfast: protectionstatus has type 0x%x???", xpl->datatype);
4917
oinfo.ProtectionStatus = xpl->propval.u16;
4918
ptp_debug (params, "ptp2/mtpfast: protection 0x%x", xpl->propval.u16);
4920
case PTP_OPC_ObjectFileName:
4921
if (xpl->datatype != PTP_DTC_STR) {
4922
ptp_debug (params, "ptp2/mtpfast: filename has type 0x%x???", xpl->datatype);
4925
if (xpl->propval.str) {
4926
ptp_debug (params, "ptp2/mtpfast: filename %s", xpl->propval.str);
4927
oinfo.Filename = strdup(xpl->propval.str);
4929
oinfo.Filename = NULL;
4932
case PTP_OPC_DateCreated:
4933
if (xpl->datatype != PTP_DTC_STR) {
4934
ptp_debug (params, "ptp2/mtpfast: datecreated has type 0x%x???", xpl->datatype);
4937
ptp_debug (params, "ptp2/mtpfast: capturedate %s", xpl->propval.str);
4938
oinfo.CaptureDate = ptp_unpack_PTPTIME (xpl->propval.str);
4940
case PTP_OPC_DateModified:
4941
if (xpl->datatype != PTP_DTC_STR) {
4942
ptp_debug (params, "ptp2/mtpfast: datemodified has type 0x%x???", xpl->datatype);
4945
ptp_debug (params, "ptp2/mtpfast: moddate %s", xpl->propval.str);
4946
oinfo.ModificationDate = ptp_unpack_PTPTIME (xpl->propval.str);
4949
if ((xpl->property & 0xfff0) == 0xdc00)
4950
ptp_debug (params, "ptp2/mtpfast:case %x type %x unhandled", xpl->property, xpl->datatype);
4954
if (!oinfo.Filename)
4955
/* i have one such file on my Creative */
4956
oinfo.Filename = strdup("<null>");
4958
ob->flags |= PTPOBJECT_MTPPROPLIST_LOADED;
4961
if ((ob->flags & want) == want)
4963
ptp_debug (params, "ptp_object_want: oid 0x%08x, want flags %x, have only %x?", handle, want, ob->flags);
4964
return PTP_RC_GeneralError;
4783
4969
ptp_add_object_to_cache(PTPParams *params, uint32_t handle)
4789
/* We have a new handle */
4790
params->handles.n++;
4791
n = params->handles.n;
4793
/* Insert the new handle */
4794
xhandler = (uint32_t*) realloc(params->handles.Handler,
4795
sizeof(uint32_t)*n);
4797
/* Well, out of memory is no I/O error really... */
4798
return PTP_ERROR_IO;
4800
params->handles.Handler = xhandler;
4801
params->handles.Handler[n-1] = handle;
4803
/* Insert a new object info struct and populate it */
4804
xoi = (PTPObjectInfo*)realloc(params->objectinfo,
4805
sizeof(PTPObjectInfo)*n);
4807
/* Well, out of memory is no I/O error really... */
4808
return PTP_ERROR_IO;
4810
params->objectinfo = xoi;
4811
memset(¶ms->objectinfo[n-1], 0, sizeof(PTPObjectInfo));
4812
ptp_getobjectinfo(params, handle, ¶ms->objectinfo[n-1]);
4814
/* Update proplist if we use cached props */
4815
if (params->props != NULL) {
4816
MTPProperties *props = NULL;
4817
MTPProperties *xprops;
4818
int no_new_props = 0;
4821
ret = ptp_mtp_getobjectproplist(params, handle, &props, &no_new_props);
4822
if (ret != PTP_RC_OK) {
4825
xprops = realloc(params->props, (params->nrofprops+no_new_props)*sizeof(MTPProperties));
4828
/* Well, out of memory is no I/O error really... */
4829
return PTP_ERROR_IO;
4831
params->props = xprops;
4832
memcpy(¶ms->props[params->nrofprops],&props[0],no_new_props*sizeof(MTPProperties));
4833
/* do not free the sub strings, we copied them above! Only free the array. */
4835
params->nrofprops += no_new_props;
4972
return ptp_object_want (params, handle, PTPOBJECT_OBJECTINFO_LOADED|PTPOBJECT_MTPPROPLIST_LOADED, &ob);