summaryrefslogtreecommitdiff
path: root/src/ptp.h
diff options
context:
space:
mode:
authorMarcus Meissner <marcus@jet.franken.de>2017-03-16 15:59:48 +0100
committerMarcus Meissner <marcus@jet.franken.de>2017-03-16 15:59:48 +0100
commitaa7d91a789873a9d86969028e57f888a1241c085 (patch)
tree57d3c17fd2e9243cca15724c0ba229309eeaafea /src/ptp.h
parente2bfba8fd746780c80d8729898bb686d03b5ed20 (diff)
downloadlibmtp-aa7d91a789873a9d86969028e57f888a1241c085.tar.gz
imported ptp* from libgphoto2
lots of buffer overread checks
Diffstat (limited to 'src/ptp.h')
-rw-r--r--src/ptp.h89
1 files changed, 85 insertions, 4 deletions
diff --git a/src/ptp.h b/src/ptp.h
index 62938b4..eda3e1b 100644
--- a/src/ptp.h
+++ b/src/ptp.h
@@ -172,6 +172,7 @@ typedef struct _PTPIPHeader PTPIPHeader;
/* not from standards papers, but from traces: */
#define PTP_VENDOR_SONY 0x00000011 /* observed in the A900 */
#define PTP_VENDOR_SAMSUNG 0x0000001a /* observed in the Samsung NX1000 */
+#define PTP_VENDOR_PARROT 0x0000001b /* observed in the Parrot Sequoia */
/* Vendor extension ID used for MTP (occasionaly, usualy 6 is used) */
#define PTP_VENDOR_MTP 0xffffffff
@@ -279,6 +280,7 @@ typedef struct _PTPIPHeader PTPIPHeader;
#define PTP_OC_CANON_902C 0x902C
#define PTP_OC_CANON_GetDirectory 0x902D
#define PTP_OC_CANON_902E 0x902E
+#define PTP_OC_CANON_902F 0x902F /* used during camera init */
#define PTP_OC_CANON_SetPairingInfo 0x9030
#define PTP_OC_CANON_GetPairingInfo 0x9031
@@ -407,6 +409,7 @@ typedef struct _PTPIPHeader PTPIPHeader;
#define PTP_OC_CANON_EOS_SetCTGInfo 0x913C
#define PTP_OC_CANON_EOS_SetRequestOLCInfoGroup 0x913D
#define PTP_OC_CANON_EOS_SetRequestRollingPitchingLevel 0x913E
+/* 3 args, 0x21201020, 0x110, 0x1000000 (potentially reverse order) */
#define PTP_OC_CANON_EOS_GetCameraSupport 0x913F
#define PTP_OC_CANON_EOS_SetRating 0x9140 /* 2 args */
#define PTP_OC_CANON_EOS_RequestInnerDevelopStart 0x9141 /* 2 args: 1 type, 1 object? */
@@ -439,6 +442,8 @@ typedef struct _PTPIPHeader PTPIPHeader;
#define PTP_OC_CANON_EOS_FAPIMessageTX 0x91FE
#define PTP_OC_CANON_EOS_FAPIMessageRX 0x91FF
+/* A1E8 ... also seen? is an error code? */
+
/* Nikon extension Operation Codes */
#define PTP_OC_NIKON_GetProfileAllData 0x9006
#define PTP_OC_NIKON_SendProfileData 0x9007
@@ -669,6 +674,22 @@ typedef struct _PTPIPHeader PTPIPHeader;
#define PTP_OC_LEICA_CloseLESession 0x9006
#define PTP_OC_LEICA_RequestObjectTransferReady 0x9007
+#define PTP_OC_PARROT_GetSunshineValues 0x9201
+#define PTP_OC_PARROT_GetTemperatureValues 0x9202
+#define PTP_OC_PARROT_GetAngleValues 0x9203
+#define PTP_OC_PARROT_GetGpsValues 0x9204
+#define PTP_OC_PARROT_GetGyroscopeValues 0x9205
+#define PTP_OC_PARROT_GetAccelerometerValues 0x9206
+#define PTP_OC_PARROT_GetMagnetometerValues 0x9207
+#define PTP_OC_PARROT_GetImuValues 0x9208
+#define PTP_OC_PARROT_GetStatusMask 0x9209
+#define PTP_OC_PARROT_EjectStorage 0x920A
+#define PTP_OC_PARROT_StartMagnetoCalib 0x9210
+#define PTP_OC_PARROT_StopMagnetoCalib 0x9211
+#define PTP_OC_PARROT_MagnetoCalibStatus 0x9212
+#define PTP_OC_PARROT_SendFirmwareUpdate 0x9213
+
+
/* Proprietary vendor extension operations mask */
#define PTP_OC_EXTENSION_MASK 0xF000
#define PTP_OC_EXTENSION 0x9000
@@ -744,6 +765,15 @@ typedef struct _PTPIPHeader PTPIPHeader;
#define PTP_RC_CANON_A009 0xA009
+#define PTP_RC_CANON_EOS_UnknownCommand 0xA001
+#define PTP_RC_CANON_EOS_OperationRefused 0xA005
+#define PTP_RC_CANON_EOS_LensCoverClosed 0xA006
+#define PTP_RC_CANON_EOS_LowBattery 0xA101
+#define PTP_RC_CANON_EOS_ObjectNotReady 0xA102
+#define PTP_RC_CANON_EOS_CannotMakeObject 0xA104
+#define PTP_RC_CANON_EOS_MemoryStatusNotReady 0xA106
+
+
/* Microsoft/MTP specific codes */
#define PTP_RC_MTP_Undefined 0xA800
#define PTP_RC_MTP_Invalid_ObjectPropCode 0xA801
@@ -825,10 +855,12 @@ typedef struct _PTPIPHeader PTPIPHeader;
#define PTP_EC_CANON_EOS_StoreRemoved 0xc193
#define PTP_EC_CANON_EOS_BulbExposureTime 0xc194
#define PTP_EC_CANON_EOS_RecordingTime 0xc195
-#define PTP_EC_CANON_EOS_RequestObjectTransferTS 0xC1a2
+#define PTP_EC_CANON_EOS_RequestObjectTransferTS 0xc1a2
#define PTP_EC_CANON_EOS_AfResult 0xc1a3
#define PTP_EC_CANON_EOS_CTGInfoCheckComplete 0xc1a4
#define PTP_EC_CANON_EOS_OLCInfoChanged 0xc1a5
+#define PTP_EC_CANON_EOS_ObjectAddedUnknown 0xc1a7
+#define PTP_EC_CANON_EOS_RequestObjectTransferNew 0xc1a9
#define PTP_EC_CANON_EOS_RequestObjectTransferFTP 0xc1f1
/* Nikon extension Event Codes */
@@ -854,6 +886,10 @@ typedef struct _PTPIPHeader PTPIPHeader;
#define PTP_EC_MTP_ObjectPropDescChanged 0xC802
#define PTP_EC_MTP_ObjectReferencesChanged 0xC803
+#define PTP_EC_PARROT_Status 0xC201
+#define PTP_EC_PARROT_MagnetoCalibrationStatus 0xC202
+
+
/* constants for GetObjectHandles */
#define PTP_GOH_ALL_STORAGE 0xffffffff
#define PTP_GOH_ALL_FORMATS 0x00000000
@@ -2066,10 +2102,15 @@ typedef struct _PTPCanonEOSDeviceInfo {
#define PTP_DPC_SONY_ColorTemp 0xD20F
#define PTP_DPC_SONY_CCFilter 0xD210
#define PTP_DPC_SONY_AspectRatio 0xD211
+#define PTP_DPC_SONY_FocusFound 0xD213 /* seems to be signaled (1->2) when focus is achieved */
+#define PTP_DPC_SONY_ObjectInMemory 0xD215 /* used to signal when to retrieve new object */
#define PTP_DPC_SONY_ExposeIndex 0xD216
+#define PTP_DPC_SONY_BatteryLevel 0xD218
#define PTP_DPC_SONY_PictureEffect 0xD21B
#define PTP_DPC_SONY_ABFilter 0xD21C
#define PTP_DPC_SONY_ISO 0xD21E /* ? */
+#define PTP_DPC_SONY_AutoFocus 0xD2C1 /* ? half-press */
+#define PTP_DPC_SONY_Capture 0xD2C2 /* ? full-press */
/* also seen: D2C3 D2C4 */
/* semi control opcodes */
#define PTP_DPC_SONY_Movie 0xD2C8 /* ? */
@@ -2108,6 +2149,32 @@ typedef struct _PTPCanonEOSDeviceInfo {
#define PTP_DPC_RICOH_ShutterSpeed 0xD00F
+/* https://github.com/Parrot-Developers/sequoia-ptpy */
+#define PTP_DPC_PARROT_PhotoSensorEnableMask 0xD201
+#define PTP_DPC_PARROT_PhotoSensorsKeepOn 0xD202
+#define PTP_DPC_PARROT_MultispectralImageSize 0xD203
+#define PTP_DPC_PARROT_MainBitDepth 0xD204
+#define PTP_DPC_PARROT_MultispectralBitDepth 0xD205
+#define PTP_DPC_PARROT_HeatingEnable 0xD206
+#define PTP_DPC_PARROT_WifiStatus 0xD207
+#define PTP_DPC_PARROT_WifiSSID 0xD208
+#define PTP_DPC_PARROT_WifiEncryptionType 0xD209
+#define PTP_DPC_PARROT_WifiPassphrase 0xD20A
+#define PTP_DPC_PARROT_WifiChannel 0xD20B
+#define PTP_DPC_PARROT_Localization 0xD20C
+#define PTP_DPC_PARROT_WifiMode 0xD20D
+#define PTP_DPC_PARROT_AntiFlickeringFrequency 0xD210
+#define PTP_DPC_PARROT_DisplayOverlayMask 0xD211
+#define PTP_DPC_PARROT_GPSInterval 0xD212
+#define PTP_DPC_PARROT_MultisensorsExposureMeteringMode 0xD213
+#define PTP_DPC_PARROT_MultisensorsExposureTime 0xD214
+#define PTP_DPC_PARROT_MultisensorsExposureProgramMode 0xD215
+#define PTP_DPC_PARROT_MultisensorsExposureIndex 0xD216
+#define PTP_DPC_PARROT_MultisensorsIrradianceGain 0xD217
+#define PTP_DPC_PARROT_MultisensorsIrradianceIntegrationTime 0xD218
+#define PTP_DPC_PARROT_OverlapRate 0xD219
+
+
/* MTP specific Object Properties */
#define PTP_OPC_StorageID 0xDC01
#define PTP_OPC_ObjectFormat 0xDC02
@@ -2388,6 +2455,7 @@ struct _PTPParams {
PTPIOGetResp getresp_func;
PTPIOGetData getdata_func;
PTPIOGetResp event_check;
+ PTPIOGetResp event_check_queue;
PTPIOGetResp event_wait;
PTPIOCancelReq cancelreq_func;
@@ -2423,6 +2491,13 @@ struct _PTPParams {
/* live view enabled */
int inliveview;
+ /* PTP: caching time for properties, default 2 */
+ int cachetime;
+
+ /* PTP: Storage Caching */
+ PTPStorageIDs storageids;
+ int storagechanged;
+
/* PTP: Device Property Caching */
PTPDeviceProperty *deviceproperties;
unsigned int nrofdeviceproperties;
@@ -2475,7 +2550,7 @@ struct _PTPParams {
};
/* Asynchronous event callback */
-typedef void(* PTPEventCbFn) (PTPParams *params, uint16_t code, PTPContainer *event, void *user_data);
+typedef void (*PTPEventCbFn)(PTPParams *params, uint16_t code, PTPContainer *event, void *user_data);
/* last, but not least - ptp functions */
uint16_t ptp_usb_sendreq (PTPParams* params, PTPContainer* req, int dataphase);
@@ -2484,9 +2559,10 @@ uint16_t ptp_usb_senddata (PTPParams* params, PTPContainer* ptp,
uint16_t ptp_usb_getresp (PTPParams* params, PTPContainer* resp);
uint16_t ptp_usb_getdata (PTPParams* params, PTPContainer* ptp,
PTPDataHandler *handler);
-uint16_t ptp_usb_event_check (PTPParams* params, PTPContainer* event);
-uint16_t ptp_usb_event_wait (PTPParams* params, PTPContainer* event);
uint16_t ptp_usb_event_async (PTPParams *params, PTPEventCbFn cb, void *user_data);
+uint16_t ptp_usb_event_wait (PTPParams* params, PTPContainer* event);
+uint16_t ptp_usb_event_check (PTPParams* params, PTPContainer* event);
+uint16_t ptp_usb_event_check_queue (PTPParams* params, PTPContainer* event);
uint16_t ptp_usb_control_get_extended_event_data (PTPParams *params, char *buffer, int *size);
uint16_t ptp_usb_control_device_reset_request (PTPParams *params);
@@ -2503,6 +2579,7 @@ uint16_t ptp_ptpip_getdata (PTPParams* params, PTPContainer* ptp,
PTPDataHandler *handler);
uint16_t ptp_ptpip_event_wait (PTPParams* params, PTPContainer* event);
uint16_t ptp_ptpip_event_check (PTPParams* params, PTPContainer* event);
+uint16_t ptp_ptpip_event_check_queue (PTPParams* params, PTPContainer* event);
uint16_t ptp_getdeviceinfo (PTPParams* params, PTPDeviceInfo* deviceinfo);
@@ -2579,6 +2656,8 @@ uint16_t ptp_getobjectinfo (PTPParams *params, uint32_t handle,
uint16_t ptp_getobject (PTPParams *params, uint32_t handle,
unsigned char** object);
+uint16_t ptp_getobject_with_size (PTPParams *params, uint32_t handle,
+ unsigned char** object, unsigned int *size);
uint16_t ptp_getobject_tofd (PTPParams* params, uint32_t handle, int fd);
uint16_t ptp_getobject_to_handler (PTPParams* params, uint32_t handle, PTPDataHandler*);
uint16_t ptp_getpartialobject (PTPParams* params, uint32_t handle, uint32_t offset,
@@ -2647,6 +2726,7 @@ uint16_t ptp_getfilesystemmanifest (PTPParams* params, uint32_t storage,
uint16_t ptp_check_event (PTPParams *params);
+uint16_t ptp_check_event_queue (PTPParams *params);
uint16_t ptp_wait_event (PTPParams *params);
uint16_t ptp_add_event (PTPParams *params, PTPContainer *evt);
int ptp_get_one_event (PTPParams *params, PTPContainer *evt);
@@ -2928,6 +3008,7 @@ uint16_t ptp_canon_get_directory (PTPParams* params, PTPObjectHandles *handles,
*
**/
#define ptp_canon_setobjectarchive(params,oid,flags) ptp_generic_no_data(params,PTP_OC_CANON_SetObjectArchive,2,oid,flags)
+#define ptp_canon_eos_setobjectattributes(params,oid,flags) ptp_generic_no_data(params,PTP_OC_CANON_EOS_SetObjectAttributes,2,oid,flags)
uint16_t ptp_canon_get_customize_data (PTPParams* params, uint32_t themenr,
unsigned char **data, unsigned int *size);
uint16_t ptp_canon_getpairinginfo (PTPParams* params, uint32_t nr, unsigned char**, unsigned int*);